Improved sign window

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

User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Improved sign window

Post by XeryusTC »

I've made a small patch that improves on the sign edit window a bit. This patch allows easier manipulation of signs throughout the game.

Current features:
  • Added a delete sign button
  • Allow all 30 characters to be entered
  • Cycle through all the signs from the edit window (either alphabetical or via internal structures, configural by a patch)
  • No text is displayed when the sign is just created
  • Only allow one sign per tile (original by Oxygene )
  • Change sign height on terraform (original by Oxygene)
Attachments
sign_gui_r10235.diff
(13.24 KiB) Downloaded 184 times
Last edited by XeryusTC on 20 Jun 2007 16:47, edited 10 times in total.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
jasperthecat1
Engineer
Engineer
Posts: 55
Joined: 09 Mar 2007 23:10
Location: Bloomington, Indiana

Post by jasperthecat1 »

keep up the good work! that's awesome!
littlemikey
Engineer
Engineer
Posts: 117
Joined: 24 May 2007 00:30

Post by littlemikey »

Can you post a screenshot please?
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Post by Wolf01 »

if you could make something like this, maybe with a limit of 1024 chars you are a genius :D
Attachments
ottd_signs_extended.PNG
ottd_signs_extended.PNG (4.91 KiB) Viewed 5020 times
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

I was thinking of putting more characters into signs too, but I didn't think about multiline really. I just stretched up the array a bit but the sign became too big for the game and it only rendered a small part of the background and cut of a piece of the text, so there is also some change needed there.
But I'll see what I can do about the maximum amount of characters on a sign, there seem to be comming quite some complications along the way so don't expect it too soon.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
jasperthecat1
Engineer
Engineer
Posts: 55
Joined: 09 Mar 2007 23:10
Location: Bloomington, Indiana

Post by jasperthecat1 »

Can you put it in Openttd 0.5.2?
Sacro
Tycoon
Tycoon
Posts: 1145
Joined: 18 Jun 2005 21:08
Location: Here
Contact:

Post by Sacro »

jasperthecat1 wrote:Can you put it in Openttd 0.5.2?
No, that'd require some sort of time machine...

0.5.2 has already been released.
We Am De Best

Host of ThroughTheTube site
User avatar
Zojj
Engineer
Engineer
Posts: 97
Joined: 27 Apr 2007 17:58
Location: Vegas baby
Contact:

Post by Zojj »

r10170 has also already been 'released'...

You could still make a patch to put it in 0.5.2. Would it cause desync?
I'm on the Zoloft to keep me from killing yall

My patches: Better graphs - Train acceleration - Crash rates
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

You could try to apply it to 0.5.2 but it is possible that applying it fails (I don't know how much the code affected by the patch has been touched).
And no, it won't cause desyncs AFAIK, it still uses the same methods as before, there is only a shortcut for deleting signs and a client side method to cycle through all the signs.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
benc
Engineer
Engineer
Posts: 62
Joined: 30 Apr 2007 01:57

Re: Improved sign window

Post by benc »

XeryusTC wrote:* Cycle through all the signs from the edit window
Found a bug with this feature. Steps to recreate:
  • Create 4 signs
  • Click on any of the signs and then Next will only cycle through the first 3. The Prev button will cycle through all 4, though.
  • Delete the 1st sign
  • Use the Next or Prev button some more; OpenTTD will crash with "!invalid string id 0 in GetString()" when it hits where the 1st sign used to be
Also, general coding style... would be easier to grok without gotos. :)
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Improved sign window

Post by XeryusTC »

benc wrote:
XeryusTC wrote:* Cycle through all the signs from the edit window
Found a bug with this feature. Steps to recreate:
  • Create 4 signs
  • Click on any of the signs and then Next will only cycle through the first 3. The Prev button will cycle through all 4, though.
  • Delete the 1st sign
  • Use the Next or Prev button some more; OpenTTD will crash with "!invalid string id 0 in GetString()" when it hits where the 1st sign used to be
I've fixed the invalid string bug earlier today, but that switched the other problem around to the previous button. I have fixed that now too and I'll upload a new version.
And for the gotos: I mainly used them to prevent code duplication (or making more functions) and also a little bit because I borrowed code from some other OTTD window ;).
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

A little bump here, I fixed a warning and updated some coding style issues. See first post for new patch.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
Oxygene
Engineer
Engineer
Posts: 12
Joined: 24 Mar 2006 21:49

Post by Oxygene »

The patch works quite well. Thanks for your work, XeryusTC.

I've attached two images for the interested. The first one shows XeryusTC's sign edit box.
The second one is an animation which shows how signs are now attached to the original tile so that they also move when terraforming.
Attachments
signs attached to the tiles move when terraforming
signs attached to the tiles move when terraforming
anim2.gif (217.75 KiB) Viewed 4522 times
This is the sign edit box with the extra delete button and the navigation buttons.
This is the sign edit box with the extra delete button and the navigation buttons.
signedit.png (54.76 KiB) Viewed 4522 times
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

I updated the patch again, there are a minor update and I moved some code. Note that the move affects network play, when someone places a second sign on a tile where there was already a sign then you won't see it. Sign IDs might also be screwed from that point and you might see signs disappearing when a sign gets deleted from a double-sign-tile. It will not cause desyncs AFAIK though.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
TheJosh
Engineer
Engineer
Posts: 75
Joined: 17 Apr 2007 12:19
Contact:

Post by TheJosh »

go for trunk!
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

A patch update, I added a method to cycle through the signs list alphabetically. The old method is still available and you can switch between them with a patch setting.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

OpenTTD: peter1138 * r10401 /trunk/src/ (lang/english.txt main_gui.cpp signs.h signs_gui.cpp): -Feature: new sign editor features including switching to previous/next sign (XeryusTC)
This means that this patch will be in today's nightly and you don't have to use the outdated patch on the top of the page anymore.
Have fun with it!
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
kaan
Route Supervisor
Route Supervisor
Posts: 399
Joined: 02 Apr 2007 20:13
Location: Nørup, Denmark

Post by kaan »

XeryusTC wrote:
OpenTTD: peter1138 * r10401 /trunk/src/ (lang/english.txt main_gui.cpp signs.h signs_gui.cpp): -Feature: new sign editor features including switching to previous/next sign (XeryusTC)
This means that this patch will be in today's nightly and you don't have to use the outdated patch on the top of the page anymore.
Have fun with it!
:D

Code: Select all

if (YouAreHappyAndYouKnowIt) {
    ClapYourHands();
}
User avatar
CMircea
Chairman
Chairman
Posts: 887
Joined: 29 Dec 2006 14:05

Post by CMircea »

The fastest patch to go in 2007's trunk!
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Post by Rubidium »

Desolator wrote:The fastest patch to go in 2007's trunk!
Lets just say this is a horrible lie. I've committed some user-made patches much much faster than this patch has been committed.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests