Page 1 of 1

Better statue placement

Posted: 27 Jul 2010 09:47
by pavel1269
The normal placement just searches for first tile, which it can replace (house/tree/nothing) and do that. Often in smaller cities or cities which bizarre layout, it can replace "majority" (like 1-3 in city and one of them got replaced) of bigger houses. This patch is providing that it will search a little around for free tile (trees/nothing) and place statue there. If it fails, it will work as before.

EDIT: Added last revision of the patch.

Re: Better statue placement

Posted: 27 Jul 2010 15:23
by JacobD88
Brilliant, thanks Pavel :bow:

It's little patches like this i love, might go back to placing statues again now, as i was always annoyed that sometimes, where the appropriate building was few in number placing a statue could stop a town accepting say goods (as that requires several buildings being present to change station acceptance) as the building, usually at the town centre, got built on :roll: Hopefully this will reduce that considerably :D

Re: Better statue placement

Posted: 27 Jul 2010 19:17
by pavel1269
A little update to current trunk, see first post. I will keep here also older version, because of nightly es.

Re: Better statue placement

Posted: 17 Mar 2011 09:52
by pavel1269
Update to trunk

Re: Better statue placement

Posted: 20 Mar 2011 18:05
by JacobD88
Thanks Pavel, still using this patch :bow:

I'm surprised no-one else has commented here, as mentioned in my last post, it's a very small change, but makes a big difference for small towns and some cargo types such as goods acceptance. Any devs tried this patch out? If so, what would pavel need to do for it to make it into trunk?

Re: Better statue placement

Posted: 21 Mar 2011 18:06
by belugas
I just wanted to mention that duplicate code, with very little difference is not a good coding style.
It's just my hint, code style wise.

Re: Better statue placement

Posted: 21 Mar 2011 20:39
by pavel1269
Thanks for your remark. Here's patch with updated coding style.

There is still one global variable. It could be removed as well, but would require (at least from my point of view) a structure given to the CircularSearch and this seems, again for me, better way.

EDIT: Patch removed.

Re: Better statue placement

Posted: 05 Apr 2012 22:05
by pavel1269
Update to current trunk.

EDIT: Fixed coding style and stuff. (Thanks Alberth)
EDIT2: While fixing coding style, I created bug. Fortunately no one downloaded that bugged version. (Thanks Alberth)
EDIT3: Patch removed, in trunk (yay). Last revision of my patch in first post.

Re: Better statue placement

Posted: 08 Apr 2012 17:36
by Alberth
It's in trunk!

Code: Select all

changeset:   19206:2a301ee800ca
tag:         tip
user:        alberth
date:        Sun Apr 08 17:30:20 2012 +0000
summary:     (svn r24105) -Feature: Be more careful with the population of a small town while placing a statue.

changeset:   19205:ffc3cdc27a30
user:        alberth
date:        Sun Apr 08 17:29:00 2012 +0000
summary:     (svn r24104) -Codechange: Output the resulting tile through the user data.

changeset:   19204:90b494b476b1
user:        alberth
date:        Sun Apr 08 17:27:47 2012 +0000
summary:     (svn r24103) -Codechange: Handle clear tiles separately from house tiles.

changeset:   19203:ab4ae39b95d1
user:        alberth
date:        Sun Apr 08 17:26:59 2012 +0000
summary:     (svn r24102) -Codechange: Refactor tile clearability test out of the statue callback.

changeset:   19202:0519840052c3
user:        alberth
date:        Sun Apr 08 17:26:01 2012 +0000
summary:     (svn r24101) -Codechange: Reverse a condition for increased readability.
Compared to the last version we exchanged, I eliminated _statue_house, and split out the clear tiles as a separate problem.
An other dev prefered struct, so I changed that too.

Thank you for your work.

Re: Better statue placement

Posted: 08 Apr 2012 17:52
by pavel1269
Nice. I thank you, for picking this patch.

Re: Better statue placement

Posted: 08 Apr 2012 19:22
by HackaLittleBit
Thanks Pavel1269
Thanks Albert

Re: Better statue placement

Posted: 08 Apr 2012 20:32
by bremerjoe
@ Pavel1269: Looks like a very useful upgrade/addition for the game. Congratulations for having provided a patch that actually made it to trunk! :D

Re: Better statue placement

Posted: 08 Apr 2012 20:47
by PaulC
Perhaps I'm being dense, but what does this feature actually do? I just gave it a quick try in the lastet nightly and in one town the statue wiped out a 2x2 shopping mall!

Re: Better statue placement

Posted: 08 Apr 2012 20:55
by pavel1269
pavel1269 wrote:The normal placement just searches for first tile, which it can replace (house/tree/nothing) and do that. Often in smaller cities or cities which bizarre layout, it can replace "majority" (like 1-3 in city and one of them got replaced) of bigger houses. This patch is providing that it will search a little around for free tile (trees/nothing) and place statue there. If it fails, it will work as before.
Little around, means 5 * 5 square. Center tile is center of the town. So mostly, only small towns aka villages are affected.

That should explain everything. Anything more?

Re: Better statue placement

Posted: 08 Apr 2012 22:04
by PaulC
OK, I see. :) That's certainly useful, but some suggestions for improvement:

* Avoid replacing buildings with certain flags set, i.e. multi-tile buildings, churches, stadiums
* For cities search a wider area, e.g. 7*7
* Thinking outside the box here, but what about placing statues manually?

Re: Better statue placement

Posted: 09 Apr 2012 07:22
by Alberth
You're in the wrong forum now ;)