Patch: new town grids (r15096)

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
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Patch: new town grids (r15096)

Post by Wolf01 »

The best would be that each town could pick a random grid when generated, so you can have differently shaped towns... grids are boring :(
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Patch: new town grids (r15096)

Post by Gremnon »

I think that was suggested back before I made this version of the patch, having towns select random grids. I'm not entirely certain if that's possible, given the way I've coded this one, but I'll have a look into it, see if I can't work out a way.
Andreander
Engineer
Engineer
Posts: 24
Joined: 27 Jun 2007 16:23
Location: Evil Lair, Norway

Re: Patch: new town grids (r14667)

Post by Andreander »

robo wrote:Is it possible to make a more realistic grid like the New York grid (240m x 60m)?
To be honest, I think the 4x4 or 5x5 is quite realistic considering the town I live in: map

meh, some are more like 3x5, 4x5 and 4x6, but you catch my drift! The town _feels_ square, and that's what matters :D

I love the square towns in OpenTTD and especially that all the towns line up perfectly (at least with 3x3 grid, haven't tested higher), whoever made that work, extra kudos for you :bow:
We're all scared. You hid in that ditch because you think there's still hope. The only hope you have is to accept the fact that you're already dead. And the sooner you accept that, the sooner you'll be able to function as a soldier is supposed to function. Without mercy. Without compassion. Without remorse. All war depends on it

- Captain Ronald Speirs E CO 2nd BATL 506th REG 101st airborne div 8th core 1st ARMY
User avatar
FHS
Director
Director
Posts: 577
Joined: 18 Apr 2009 17:17
Location: Basel, CH

Re: Patch: new town grids (r15096)

Post by FHS »

You like digging graves?

Look at the date!
Andreander
Engineer
Engineer
Posts: 24
Joined: 27 Jun 2007 16:23
Location: Evil Lair, Norway

Re: Patch: new town grids (r15096)

Post by Andreander »

I only looked at the year, forgot the year is already 5 months old, sorry <.<
We're all scared. You hid in that ditch because you think there's still hope. The only hope you have is to accept the fact that you're already dead. And the sooner you accept that, the sooner you'll be able to function as a soldier is supposed to function. Without mercy. Without compassion. Without remorse. All war depends on it

- Captain Ronald Speirs E CO 2nd BATL 506th REG 101st airborne div 8th core 1st ARMY
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Patch: new town grids (r15096)

Post by XeryusTC »

FHS wrote:You like digging graves?

Look at the date!
Except from the fact that the topic is relatively recent (within half a year) and that the poster actually had something to add to the discussion your point is totally valid.
Oh wait, it isn't
Andreander wrote:I love the square towns in OpenTTD and especially that all the towns line up perfectly (at least with 3x3 grid, haven't tested higher), whoever made that work, extra kudos for you :bow:
Actually they aren't lined up afaik, the map generator just generates random location and it can be that towns are offset to each other with 2x2 or 3x3 grids, although that might have changed in the past 2 months or so.
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
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: Patch: new town grids (r15096)

Post by Eddi »

that has chaged in the past 2 months or so
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2874
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: Patch: new town grids (r15096)

Post by ChillCore »

Make that three months or so.
changelog.txt with 0.7.1-RC1 wrote: - Feature: Make the road grids of town match, when all are using the same road layout ofcourse [FS#2390] (r14821)
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Patch: new town grids (r15096)

Post by Gremnon »

Okay, a post to a thread that's old, I know. It's my thread, and it's my patch, so there.

I've just tried (again) to update this patch to trunk, and hit a slight problem. I can't find where the settings that appear in Advanced Settings in game appear.
The file they *used* to appear in, doesn't seem to contain any trace of the settings, and at the moment, I'm wondering if anyone knows where I should be looking instead before I go raiding everything and wasting some time.

And if anyone wants to, go ahead, rewrite the patch yourself to match trunk. I'd prefer to do it myself, but if you think you can do it better than me go ahead before I go insane first.

As to the issue mentioned, I don't think it's possible that towns of different grids can line up on the map, if even on one axis. Might be nice, but I doubt it's possible.

Edit: After a closer look, I realise I made a mistake. It's not the part in the Advanced Settings GUI, it's the part that used to be in the settings.cpp file. I'm attempting to figure it out again, any help is appreciated.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: new town grids (r15096)

Post by Roujin »

Uhm.. I didn't really understand what exactly your problem is.

As you may know this feature has been changed in trunk not to affect all of the towns, but each town may have their individual road scheme.
Thus, the setting in "advanced settings" has been changed to one that sets only the default for newly built towns (on generation, or in scedit).
Each town has their own personal layout to be saved, so this is found in src/saveload/town_sl.cpp. Is that what you're looking for?

Code: Select all

	SLE_CONDVAR(Town, layout,                SLE_UINT8,                113, SL_MAX_VERSION),
* @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
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Patch: new town grids (r15096)

Post by Gremnon »

Aha, that's the missing link.
Thanks, that's what I was after, I think I might be able to push out an update for this patch now.
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Patch: new town grids (r15096)

Post by Gremnon »

Hmm... I think that might be wrong.
Alright, attempt number two to explain, see if you can figure this out.

Have a look in the patch, at what gets done in settings.cpp
That's the bit I'm having trouble bringing up to date. Everything else seems to be able to patch in with little or no changes at all, but the chunk in settings.cpp I can't figure out where it goes now, and I don't think it's in the saveload commands.

Late edit: There seems to be a few other places too, I'll make a list of the problem chunks tomorrow for people to try and figure out if they like.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patch: new town grids (r15096)

Post by Terkhen »

I had to do this too for the Found a Town patch while bringing it back from a similar revision number. I have attached three of the incremental versions I made while updating: r15400 has setting info in settings.cpp file and entries on settings_gui.cpp called PatchEntry("..."). Settings in 15400 still work the same way they did in 15096. r15700 has setting info in settings.cpp and entries on settings_gui.cpp called SettingEntry("...") (this also altered the name for STR_PATCHES_ strings to STR_CONFIG_). Finally, r15850 has setting info in table/settings.h. I hope these three files help you with this problem.

You will have to face another issue, though. Somewhere between r15096 and current trunk, a new feature related to town grids was added. Individual towns can have different town grid settings, and these individual settings can be selected at the create town window. This means that you will have to edit the Create town GUI (besides other things), which now uses nested widgets (you can check some helpful advice from Alberth about nested widgets in the Found a town thread). I recommend creating something like the table size selector in Office 2007. If not, a pair of buttons that create a textbox when clicked should be okay too.

Edit: For checking changes in trunk and dealing with them, I did the following:

1) Browse the SVN repository and search the file that is causing you problems: http://vcs.openttd.org/svn/browser/trun ... ttings.cpp

2) Click on "Last Change": http://vcs.openttd.org/svn/changeset/17 ... ttings.cpp

3) Edit the revision number to match the revision of the patch you are updating: http://vcs.openttd.org/svn/changeset/15 ... ttings.cpp

4) Click on "Next Change" until you can find the changes to trunk you were looking for. Use the changelog and description of that revision to know why your patch don't apply, and update it accordingly.
Attachments
found_town_15400.diff
(14.65 KiB) Downloaded 125 times
found_town_15700.diff
(15.49 KiB) Downloaded 115 times
found_town_15850.diff
(16.23 KiB) Downloaded 132 times
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: Patch: new town grids (r15096)

Post by Gremnon »

I'll have a look into the town creation thing once I get the main patch up, but for when I do, what ideally I'd like it to do is mimic the same behavior as the advanced settings options - that is, you select Geometric Grid, and then give it the X and Y values. How this would work, however, I'm not sure.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests