[patch]Picking and placing single houses

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
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch]Picking and placing single houses in scenario edi

Post by adf88 »

Confirmed and fixed (it was a false-positive).
Attachments
fix-house-placing-uninitilaized-warning.diff
(802 Bytes) Downloaded 189 times
:] don't worry, be happy and checkout my patches
User avatar
Whopper
Engineer
Engineer
Posts: 115
Joined: 04 Mar 2007 15:14

Re: [patch]Picking and placing single houses in scenario edi

Post by Whopper »

Great work so far guys!
Unfortunately it's still quite unworkable because most buildings can't be placed in the areas I want them to.
Would it be possible to remove all the restrictions on placing buildings?

And it seems the game crashes a lot when using eyecandy as well in the map editor ...
Attached the error code.
Attachments
crashes.txt
(8.24 KiB) Downloaded 191 times
Image
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch]Picking and placing single houses in scenario edi

Post by adf88 »

Whopper wrote:Unfortunately it's still quite unworkable because most buildings can't be placed in the areas I want them to.
I'm working on it. In the next version I'll give possibility to ignore the town zones when placing houses. Also I'll allow to check what's the town zone on a given tile.

Another thing I'm planning is to give some extra information to CBID_HOUSE_CONSTRUCTION NewGRF callback (this callback decides whether a house can be placed on a given tile). The information will tell whether the house is being placed manually or not. NewGRF makers are sometimes quite restrictive on house location and the callback frequently disallows a house to be built. This approach is required to control town layouts while they grow. However, manual placement is something different and the callback should be less restrictive. Unfortunately you will have to wait a bit for this feature - the patch must get into the trunk (if ever) and GRF makers must update their town sets.
:] don't worry, be happy and checkout my patches
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch]Picking and placing single houses in scenario editor

Post by adf88 »

oberhümer wrote:Minor update to r27356. And an uninitialized variable warning...
Whopper wrote:And it seems the game crashes a lot when using eyecandy as well in the map editor ...
Attached the error code.
There is a bug in the patch from oberhümer. It reveals itself when you open booth the "place object" tool and the "place house" tool - just don't do this ;)
http://www.tt-forums.net/download/file.php?id=186856
Basically the "place object" window couldn't coexist with "place house" window before. I'm aware of a recent change in the trunk about the "place object" window (it's not a PickerWindowBase anymore) and that's probably the cause of the problems.

EDIT: it's actually a trunk bug, not related to the patch

New version of the patch (I'm working on it) should be just fine.
:] don't worry, be happy and checkout my patches
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: [patch]Picking and placing single houses in scenario editor

Post by cirdan »

I am considering merging this patch into my fork. Do you have a public repository with your code, other than the patch sequence attached to the first post in this thread? Otherwise, what author information should I use for your code? (Git requires a valid e-mail address for the author of a commit.)
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch]Picking and placing single houses in scenario editor

Post by adf88 »

No, I don't have a public repository. But you can use this address: "adf88[obvious character]interia.pl"
:] don't worry, be happy and checkout my patches
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: [patch]Picking and placing single houses in scenario editor

Post by cirdan »

Thank you. Note that your address will appear (unobfuscated) in my public repository. Is this fine with you?
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch]Picking and placing single houses in scenario editor

Post by adf88 »

That's OK.
:] don't worry, be happy and checkout my patches
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: [patch]Picking and placing single houses in scenario editor

Post by cirdan »

I have merged this patch into my branch; details here. I decided to only add the ability to build houses from the scenario editor, and not from a game script, for the time being, and to lift some building restrictions, such as town zones. I also had to rewrite some parts of the code due to divergences between openttd revision 26400 (against which your latest patch was created) and current trunk, and then between openttd trunk and my branch. Still, most of the work is yours, and I wanted to commend you for such a nicely written patch.

There are some issues I found during review, in case you want to fix them in a future version of your patch:
  • In patch 230, file src/terraform_gui.cpp, hunk 5

    Code: Select all

    @@ -711,6 +726,8 @@
                    this->RaiseButtons();
                    this->SetDirty();
                    DeleteWindowById(WC_BUILD_OBJECT, 0);
    +               DeleteWindowById(WC_BUILD_HOUSE, 0);
    +               DeleteWindowById(WC_SELECT_STATION, 0);
            }
     
            static HotkeyList hotkeys;
    I think that there is a typo and "WC_SELECT_STATION" should be "WC_SELECT_TOWN". (Note however that openttd trunk has changed the object selection window to a standalone window, so you may want to do the same for the house selection window as I did.)
  • The town selection window is not properly invalidated when towns are created or removed; doing so in the editor while the window is open may lead to weird strings displayed or even crashes.
  • Sprite offsets in the default house set are not applied correctly when drawing in the selection window; this is most noticeable with statues. Also, GUI zoom seems to be ignored; look here for how I modified DrawOldHouseTileInGUI.
User avatar
openbu.org
Engineer
Engineer
Posts: 74
Joined: 14 Nov 2014 07:40
Location: USA
Contact:

Re: [patch]Picking and placing single houses in scenario editor

Post by openbu.org »

Great. :bow:
place houses manually in multiplay games.
Attachments
f.png
f.png (25.94 KiB) Viewed 7112 times
User avatar
Streckenläufer
Engineer
Engineer
Posts: 57
Joined: 22 Jun 2012 14:45
Location: Berlin-Germany

Re: [patch]Picking and placing single houses in scenario editor

Post by Streckenläufer »

WC_SELECT_TOWN gives a crash, when clicking on ... see picture
WC_SELECT_STATION is ok.
Attachments
house_error.jpg
house_error.jpg (21.36 KiB) Viewed 7082 times
MfG Streckenläufer
OpenTTD V1.7.1, r27930 - Trafficlight - Bridge/tunnel Signals - Watertunnel - HousePlacing - SeaplaneAirport - Clipboard - Win7 64bit - MinGW/msys
!Sorry for my google English translator!
User avatar
Streckenläufer
Engineer
Engineer
Posts: 57
Joined: 22 Jun 2012 14:45
Location: Berlin-Germany

Re: [patch]Picking and placing single houses in scenario edi

Post by Streckenläufer »

adf88 wrote:I'm working on it. In the next version I'll give possibility to ignore the town zones when placing houses. Also I'll allow to check what's the town zone on a given tile.
Hello adf88 is already canceled this dependence?
MfG Streckenläufer
OpenTTD V1.7.1, r27930 - Trafficlight - Bridge/tunnel Signals - Watertunnel - HousePlacing - SeaplaneAirport - Clipboard - Win7 64bit - MinGW/msys
!Sorry for my google English translator!
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch]Picking and placing single houses in scenario editor

Post by adf88 »

Yes, new version is almost ready. Grab an unofficial alpha if you wish.
Attachments
hp.zip
(62.38 KiB) Downloaded 178 times
:] don't worry, be happy and checkout my patches
User avatar
Streckenläufer
Engineer
Engineer
Posts: 57
Joined: 22 Jun 2012 14:45
Location: Berlin-Germany

Re: [patch]Picking and placing single houses in scenario editor

Post by Streckenläufer »

Hello adf88,

did everything meticulously applied by hand, get the following error.
town_land.h line: 2276? (see Appendix)
Attachments
town_land_h.jpg
town_land_h.jpg (57.8 KiB) Viewed 1264 times
town_land_h_compile.jpg
(391.62 KiB) Not downloaded yet
town_land_h_2.jpg
town_land_h_2.jpg (48.43 KiB) Viewed 1264 times
MfG Streckenläufer
OpenTTD V1.7.1, r27930 - Trafficlight - Bridge/tunnel Signals - Watertunnel - HousePlacing - SeaplaneAirport - Clipboard - Win7 64bit - MinGW/msys
!Sorry for my google English translator!
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch]Picking and placing single houses in scenario editor

Post by adf88 »

OK, now my compiler is sensitive to narrowing conversions and I did remove the issue.

// EDIT
Something went wrong with the upload. The file is updated now.
Attachments
hp.zip
House placing v4 alpha3 OpenTTD r27523
(64.56 KiB) Downloaded 184 times
Last edited by adf88 on 25 Mar 2016 06:27, edited 1 time in total.
:] don't worry, be happy and checkout my patches
b1tm4rx1st
Engineer
Engineer
Posts: 19
Joined: 25 Mar 2016 01:26
Location: Netherlands....

Re: [patch]Picking and placing single houses in scenario editor

Post by b1tm4rx1st »

On what version do i have to apply thepatch?

I would love the custom house placing and funding options...


version=r27356?

Code: Select all

svn update -r 27356
Skipped '.'
Summary of conflicts:
  Skipped paths: 1

And can someone tell me where i can get the correct version? and how to apply the diffs to it.. (ubuntu 14.04 r higher)

Compiling from source works ok but i cant download the correct version and cause of that i cant apply the diff correctly

And yes i saw these links:
https://wiki.openttd.org/Compiling_on_( ... install_it

i can apply the diffs (above this post) to 27525 but then i have the problem that i dont see any houses... and the windows of house placing works but there is no button showing up in it
Does this patch get injected in the main version in the future?
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: [patch]Picking and placing single houses in scenario editor

Post by adf88 »

r27523 but 27525 should be fine too. Make sure you cleaned up everything correctly. Also have in mind that this is just a "work in progress". Official release will be soon (download at front page of this thread).
:] don't worry, be happy and checkout my patches
b1tm4rx1st
Engineer
Engineer
Posts: 19
Joined: 25 Mar 2016 01:26
Location: Netherlands....

Re: [patch]Picking and placing single houses in scenario editor

Post by b1tm4rx1st »

27523 works but while compiling i got these errors

Code: Select all



[/In file included from /openttd/src/saveload/oldloader_sl.cpp:36:0:
/openttd/src/saveload/../table/townname.h:1840:29: warning: ‘_name_czech_subst_stem’ defined but not used [-Wunused-variable]
 static const CzechNameSubst _name_czech_subst_stem[] = {
                             ^
/openttd/src/saveload/../table/townname.h:1893:29: warning: ‘_name_czech_subst_ending’ defined but not used [-Wunused-variable]
 static const CzechNameSubst _name_czech_subst_ending[] = {
                             ^
And when im in game and want to start a new scenario ive got the error there is no space for placing some towns xD
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: [patch]Picking and placing single houses in scenario editor

Post by Leanden »

Are savegames made with this patch compatible with trunk?
Image
b1tm4rx1st
Engineer
Engineer
Posts: 19
Joined: 25 Mar 2016 01:26
Location: Netherlands....

Re: [patch]Picking and placing single houses in scenario editor

Post by b1tm4rx1st »

Leanden wrote:Are savegames made with this patch compatible with trunk?
so far as i know yes... there were some scenarios that were compatible... but ur world gets really fast messed up if you dont change the grow settings of a city to no growth...
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Google Adsense [Bot] and 8 guests