[Patch] Transparency Lock (in trunk r12102)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

[Patch] Transparency Lock (in trunk r12102)

Post by Roujin »

From the discussion in this topic I got the idea to make this patch.

It creates the possibility to CTRL-click a transparency option to "lock" it, meaning pressing the invisible toggle key 'x' won't toggle this option anymore. The locks are saved like the transparency itself to the openttd config. Meaning if you load a game, start a new game or anything, your last used settings will be used again.

I also changed the strings a bit so it indicates that you can lock them with CTRL.

This patch is rather small, and I hope it can be included to trunk soon.

Screenshot:
In this example, the signs are locked to transparent and the loading indicators are locked to visible.
In this example, the signs are locked to transparent and the loading indicators are locked to visible.
transparency lock teaser.png (57.73 KiB) Viewed 6782 times
Download:
transparency_lock_v1_r12099.diff
Transparency lock for r12099
(6.83 KiB) Downloaded 184 times
Credits: thanks to wolf01 for letting me have a look at your code regarding transparency ;)
Last edited by Roujin on 10 Feb 2008 15:30, edited 1 time in total.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Trond
Tycoon
Tycoon
Posts: 973
Joined: 25 Jan 2008 07:32
Location: Gamle Ørnenuten

Re: [Patch] Transparency Lock (r12099)

Post by Trond »

Nice!

not sure if this idea belongs here, but still: would be nice if you included a save of the position of the transparency toolbar... So I dont have to relocate it to the correct position every time I open it ;)
..: Trond :.. because you deserve it! Image

The whole problem with the world is that fools and fanatics are always so certain of themselves,
and wiser people so full of doubts.
Bertrand Russell

MyGRFs: Norwegian Funny Town Names 4 | LOTR & WoW Town Names 2 | Islandic Town Names 1 | Random Norwegian Town Names
Favorites: GRFCrawler | ISR | WIKI | Now Playing: OpenTTD 1.3.2 w/YAPP 3.0-RC3.9ish
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Transparency Lock (r12099)

Post by Roujin »

Revision: 12102
Author: maedhros
Date: 15:49:44, Sonntag, 10. Februar 2008
Message:
-Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
[...]
The patch is now included in trunk. Thanks Maedhros! :)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Tom0004
Chairman
Chairman
Posts: 822
Joined: 01 Jul 2007 22:33
Location: Manchester, UK

Re: [Patch] Transparency Lock (in trunk r12102)

Post by Tom0004 »

I think thats the fastest I've ever seen a patch make trunk :shock:
nautre125
Engineer
Engineer
Posts: 74
Joined: 04 Feb 2008 10:58
Location: Strasbourg, France

Re: [Patch] Transparency Lock (in trunk r12102)

Post by nautre125 »

wouh that was fast ! congratz :) and ofc thanks for that new feature.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Transparency Lock (in trunk r12102)

Post by Roujin »

I think it's got a lot to do with patch size ^^ chance to be included in trunk must be decreased exponentially with patch size or something :lol:

This one is really compact because I even found a lock sprite to reuse :) originally wanted to include a newly drawn sprite, but then I found the lock sprite already used ;)

(I wish my bigger patches would get as much attention as the small ones :mrgreen: )
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
Maedhros
OpenTTD Developer
OpenTTD Developer
Posts: 603
Joined: 30 Mar 2006 18:24
Location: Durham, UK

Re: [Patch] Transparency Lock (in trunk r12102)

Post by Maedhros »

It's got a fair amount to do with patch size - it's small and easy to read - and it also fixes something that's been annoying me for a while, all of which help. ;-)

Large patches are much more difficult to read and understand completely, and I'm afraid unless it's something that really interests me (and usually not even then) I just don't have enough time to read them.
No-one's more important than the earthworm.
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: [Patch] Transparency Lock (in trunk r12102)

Post by 3iff »

I've had a problem with this...seems to forget the settings on a reload.

I have vehicle loading locked on, but on a reload the settings are locked off. Seems that the savegame doesn't remember the current settings for locks...nightly 12208 win9x was the last one I used.

I find it strange that this hasn't already been mentioned, so is it something I'm doing wrong? I generally know what I'm doing and haven't spotted any relevant patch setting to cope with this...
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Transparency Lock (in trunk r12102)

Post by Roujin »

It's not saved in savegames, but within the config file. So it's global for all of your games.

If you load something or start a new game, the setting doesn't change. It remains the same what you've set up last.
Even if you exit the game (to your OS) and start it again, transparency and transparency lock settings should be what you last used.


The numbers in the config file (transparency = [x] and transparency_locks = [y]) are a bitmask over the transparency options. e.g. i have transparency_locks = 385, convert that to binary -> 110000001, that means (reading from right to left) I have options 1, 8 and 9 locked (signs, catenary and loading indicators).
The same with transparency; there, '1' means transparent.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: [Patch] Transparency Lock (in trunk r12102)

Post by 3iff »

Thanks for that...I'll check my settings. Somehow I thought the settings were in the savegame, no idea why!
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: [Patch] Transparency Lock (in trunk r12102)

Post by 3iff »

Ok, I understand what the settings are, but it doesn't work as I would expect it to...

The config file has the correct setting of 256 for tranparency_locks, meaning that the vehicle loading indicator is locked on. But, if I exit the game with transparency on, and then reload the game, I get vehicle loading indicators locked, but locked as transparent (not in display mode!)...see picture...

I would have expected the settings to remember that I want that option on display regardless of whether I exit the game with general transparency on of off...but it seems that the settings only remember to lock that option without remembering whether it's on or off.

Is this right?
Minningville Transport, 8th Dec 2053.png
Minningville Transport, 8th Dec 2053.png (84.33 KiB) Viewed 449 times
sc79
Director
Director
Posts: 586
Joined: 22 Feb 2005 09:51

Re: [Patch] Transparency Lock (in trunk r12102)

Post by sc79 »

I have that problem as well (but I'm using custom r12180, so I didn't post anything). I have loading indicators locked 'on' (so they always display, and don't toggle). If the game is saved in transparency mode, it gets switched on reload, so they never display, and don't toggle. If saved in normal mode, the setting works as expected.
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: [Patch] Transparency Lock (in trunk r12102)

Post by 3iff »

sc79

Thanks for that, at least it's not just me!
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Transparency Lock (in trunk r12102)

Post by Roujin »

hmm thanks for the bug report, i'll look into it.

edit: bug confirmed. Happens only on exit game (to OS). Working on it...
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Transparency Lock (in trunk r12102)

Post by Roujin »

I've made a patch to fix this bug. Made bugreport and added the patch to flyspray.

Since this is in trunk already, you could have made a bugreport on flyspray yourself instead of posting here in the first place ;)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: [Patch] Transparency Lock (in trunk r12102)

Post by 3iff »

Roujin,

Apologies, but I wasn't sure if it was a bug or just me incorrectly understanding the new feature...something I've been guilty of in the past.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: [Patch] Transparency Lock (in trunk r12102)

Post by Roujin »

No problem, 3iff ;) No one will kill you for misunderstanding something.. (maybe DaleStan, he'll kill you with words :lol: )

So, again, thanks for reporting this, I had stubled over some irregularity regarding transparency before but was never able to get what exactly it was. :)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests