My patch(es) (place house manually)

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

oberhümer
Tycoon
Tycoon
Posts: 1277
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

My patch(es) (place house manually)

Post by oberhümer » 14 Jun 2010 22:36

I've completely given up that old patch and made something more immediately useful - a mechanism for placing single houses in the scenario editor. It's attached as a diff against r22277, with a screenshot. The only thing I haven't been able to figure out yet is how to show a preview of the house being built.

--------------------------------------------------------------------------------------

This patch converts Toyland to a "real" world map, with rainforests, deserts, snow and(not really represented)savanna areas. It is unfinished, I do not think I will work much more on it, so I hereby present it to anyone who wants to take it up.
Attachments
real_toyland.patch
Old landscape patch for r19547
(32.83 KiB) Downloaded 158 times
screenshot.png
Screenshot of house builder
(57.04 KiB) Downloaded 2 times
house_placing_r22277.diff
Allow manual house construction
(23.07 KiB) Downloaded 207 times
Last edited by oberhümer on 16 May 2011 01:22, edited 3 times in total.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---

maquinista
Tycoon
Tycoon
Posts: 1808
Joined: 10 Jul 2006 00:43
Location: Spain

Re: Turn Toyland into semi-realistic world landscape(UNFINISHED)

Post by maquinista » 15 Jun 2010 18:51

Do You have a screenshot?
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]

oberhümer
Tycoon
Tycoon
Posts: 1277
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: Turn Toyland into semi-realistic world landscape(UNFINISHED)

Post by oberhümer » 16 Jun 2010 14:51

Here. Normal trees are arctic, savanna trees temperate(for whatever reason).
Attachments
Unbenannt, 1. Jan 2050.png
Clearly visible climate zones.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---

User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: Turn Toyland into semi-realistic world landscape(UNFINISHED)

Post by lawton27 » 16 Jun 2010 17:13

Why is there a long rectangular strip of snow at sea level?

User avatar
SwissFan91
Tycoon
Tycoon
Posts: 2384
Joined: 08 Feb 2009 18:36
Location: Alberta, Canada

Re: Turn Toyland into semi-realistic world landscape(UNFINISHED)

Post by SwissFan91 » 16 Jun 2010 17:15

INteresting concept, I'd like to see how this develops.
Image
Total Alpine Replacement Set: Industry, Town, Objects
**ATTENTION**: If anyone would like me to help draw snow stages in any of their GRFs let me know. I genuinely enjoy drawing them.

Arie-
Director
Director
Posts: 593
Joined: 20 Jan 2009 16:07

Re: Turn Toyland into semi-realistic world landscape(UNFINISHED)

Post by Arie- » 16 Jun 2010 18:34

lawton27 wrote:Why is there a long rectangular strip of snow at sea level?
My guess would be that the world generation looks like (from north west to bottom east): temperate - savanna - desert - savanna - temperate. The grfs did not support the savannah, so graphics are not correct, but this was to illustrate the idea. Again, this is what I'm guessing.

User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: Turn Toyland into semi-realistic world landscape(UNFINISHED)

Post by lawton27 » 16 Jun 2010 18:39

If so I would suggest via height, lowest level jungle, then desert, temperate, arctic, combined with more hight levels patch you could have a huge fun and varied game.

Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: Turn Toyland into semi-realistic world landscape(UNFINISHED)

Post by Kogut » 16 Jun 2010 20:04

lawton27 wrote:Why is there a long rectangular strip of snow at sea level?
oberhümer wrote: Unfinished/unattempted:
- Separation of snow and desert code, so desert is not also drawn as snow
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD

PKRanger
Engineer
Engineer
Posts: 14
Joined: 28 Nov 2008 09:48

Re: Turn Toyland into semi-realistic world landscape(UNFINISHED)

Post by PKRanger » 21 Jun 2010 10:36

Concept looks interesting, hope to see an stable/corrected version soon.

Keep up the good work.
! Hanno's Goal & Quest's > 1980 ~ 2000 < ! -> 1.0.1 Goal & Quests.
! Hanno's 1.0.2 Testing > 1980 ~ 2000 < ! | -> 1.0.2 Goal & Quests.

oberhümer
Tycoon
Tycoon
Posts: 1277
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: My patch(es) (place house manually)

Post by oberhümer » 15 May 2011 21:48

I created another patch, see the first post.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---

Nagyzee
Transport Coordinator
Transport Coordinator
Posts: 261
Joined: 05 Jun 2008 16:45
Location: Hungary

Re: My patch(es) (place house manually)

Post by Nagyzee » 15 May 2011 21:52

Wow, this looks great. I'm one of those freaks who tries to design towns down to almost every single house when making scenarios. This would save me an awful lot of time. Hopefully this will get included in Chill's patchpack soon.

User avatar
ChillCore
Tycoon
Tycoon
Posts: 2656
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: My patch(es) (place house manually)

Post by ChillCore » 16 May 2011 00:58

oberhümer wrote: I created another patch, see the first post.
Would it not have been better to create a new thread, somehow I do not see the relationship between the old patch and this new.

Nagyzee wrote: Hopefully this will get included in Chill's patchpack soon.
The aim for any patch should be trunk inclusion and not some patchpack. ;)


Anyway,
I do like the idea of selecting houses and being able to build them ... but , without wanting to be rude (my coding is far from perfect neither), I can/will not include it in its current form for the following reasons.

- I have the feeling that at least 1 new file is missing in the patch as is ...
-- Five new strings are defined in english.txt but none are used in the attached version.
-- WC_BUILD_HOUSE is declared but there is no discription in the patch of this new window.
- There is lots of outcommented code in town_cmd.cpp ... because the outcommenting is not commented, outcommented means ¿not functional? ¿not needed? ¿buggy? (strike as needed.)
- The previewing of houses does not function yet, as stated in the first post.

Code: Select all

+	if (Town::GetNumItems() == 0) return_cmd_error(STR_ERROR_MUST_FOUND_TOWN_FIRST);
- It is perfectly possible to create a town and delete all houses and roads that belong to it without deleting it completely ... The error message is IMHO incorrect as the town already exist, else you would not be able to check properties of it?


Maybe some more after viewing the complete patch ...
Note:I can not comment on the functionality because I have not tested yet and I only had a quick look at the code.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

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.

oberhümer
Tycoon
Tycoon
Posts: 1277
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: My patch(es) (place house manually)

Post by oberhümer » 16 May 2011 01:06

Anyway, here's a binary, split into two parts because it is too big to attach as one file. 7-Zip is able to open it if you remove the ".txt" at the end.
Attachments
bundle.zip.001.txt
(5 MiB) Downloaded 103 times
bundle.zip.002.txt
(3.39 MiB) Downloaded 117 times
Last edited by oberhümer on 16 May 2011 01:35, edited 2 times in total.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---

oberhümer
Tycoon
Tycoon
Posts: 1277
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: My patch(es) (place house manually)

Post by oberhümer » 16 May 2011 01:13

ChillCore wrote:Would it not have been better to create a new thread, somehow I do not see the relationship between the old patch and this new.
Yes, there is none... I just want to keep everything together.
ChillCore wrote: - I have the feeling that at least 1 new file is missing in the patch as is ...
Not anymore.
ChillCore wrote: - There is lots of outcommented code in town_cmd.cpp ... because the outcommenting is not commented, outcommented means ¿not functional? ¿not needed? ¿buggy? (strike as needed.)
Fixed that too.
ChillCore wrote:

Code: Select all

+	if (Town::GetNumItems() == 0) return_cmd_error(STR_ERROR_MUST_FOUND_TOWN_FIRST);
- It is perfectly possible to create a town and delete all houses and roads that belong to it without deleting it completely ... The error message is IMHO incorrect as the town already exist, else you would not be able to check properties of it?
I think you're misunderstanding something here, what that code checks for is how many towns there are in the town pool.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---

User avatar
ChillCore
Tycoon
Tycoon
Posts: 2656
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: My patch(es) (place house manually)

Post by ChillCore » 16 May 2011 01:23

oberhümer wrote:
ChillCore wrote: Would it not have been better to create a new thread, somehow I do not see the relationship between the old patch and this new.
Yes, there is none... I just want to keep everything together.
Okidoki, it is your thread and more people have done that before ... I just do not see the advantage or the point of doing that.
- I have the feeling that at least 1 new file is missing in the patch as is ...
Not anymore.
Thank you for replacing the patch with the complete version.
Will give it a spin tomorrow. :)
- There is lots of outcommented code in town_cmd.cpp ... because the outcommenting is not commented, outcommented means ¿not functional? ¿not needed? ¿buggy? (strike as needed.)
Right, I'll fix that.
Thank you.

Code: Select all

+   if (Town::GetNumItems() == 0) return_cmd_error(STR_ERROR_MUST_FOUND_TOWN_FIRST);
- It is perfectly possible to create a town and delete all houses and roads that belong to it without deleting it completely ... The error message is IMHO incorrect as the town already exist, else you would not be able to check properties of it?
I think you're misunderstanding something here, what that code checks for is how many towns there are in the town pool.
:oops: Thank you for explaining.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

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.

oberhümer
Tycoon
Tycoon
Posts: 1277
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: My patch(es) (place house manually)

Post by oberhümer » 22 May 2011 00:59

Can anybody explain why this function only draws the ground sprite of the (NewGRF) house, and the one of the first building stage at that? (tested with Swedish Houses)

Code: Select all

void DrawNewHouseTileInGUI(int x, int y, HouseID house_id)
{
	HouseSpec *hs = HouseSpec::Get(house_id);
	const SpriteGroup *group;
	ResolverObject object;

	NewHouseResolver(&object, house_id, INVALID_TILE, NULL);

	group = SpriteGroup::Resolve(hs->grf_prop.spritegroup[0], &object);
	if (group == NULL || group->type != SGT_TILELAYOUT)	return;
	
	const DrawTileSprites *dts = ((const TileLayoutSpriteGroup *)group)->dts;

	SpriteID image = dts->ground.sprite;
	PaletteID pal  = dts->ground.pal;

	if (GB(image, 0, SPRITE_WIDTH) != 0) {
 		DrawSprite(image, GroundSpritePaletteTransform(image, pal, PAL_NONE), x, y);
	}
	const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group;
	/* Limit the building stage to the number of stages supplied. */
	byte stage = (byte )TOWN_HOUSE_COMPLETED;
//	stage = Clamp(stage - 4 + tlgroup->num_building_stages, 0, tlgroup->num_building_stages - 1);
	DrawNewGRFTileSeqInGUI(x, y, dts, stage, PAL_NONE);
}
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---

Nagyzee
Transport Coordinator
Transport Coordinator
Posts: 261
Joined: 05 Jun 2008 16:45
Location: Hungary

Re: My patch(es) (place house manually)

Post by Nagyzee » 28 May 2011 07:42

@oberhümer
Is this patch save game (or saved scenario) compatible with trunk btw? I clearly remember that the fantastic Cindini map was partly done with the help of a house placer patch like yours which was compatible with unpatched OTTD. So I thought maybe this one is compatible, too.:)



@ChillCore:
Of course all patches should strive for inclusion in trunk but for me it makes little difference whether it gets included into your patchpack or into trunk as I play your patchpack exclusively. Or rather, I use its scenario editor as it takes a lot of time to design scenarios I'm satisfied with. :lol:

Nagyzee
Transport Coordinator
Transport Coordinator
Posts: 261
Joined: 05 Jun 2008 16:45
Location: Hungary

Re: My patch(es) (place house manually)

Post by Nagyzee » 22 Jun 2011 03:24

I've been toying around with your house placer patch lately. While doing so I've run into problems. So far I have found the following:


Sets from which houses can be placed with your patch without serious problems (at least I haven't had serious problem with them yet):
- Swedish Houses (1.1) - Ran into the minor problem of the original 1x1 church showing up when placing one of the 2x2 shopping areas once (this problem was also gone after a restart of OTTD, see below), nothing else yet
- ECS Houses
(- original houses)


Weird behaviour:
- TTRS (both 3.02 and 3.11) - Sometimes I can't place any of its buildings, sometimes I can place most except for a select few that can't be placed at all, and a few that show up incorrectly (for example some of the statues in the set show up as the original fountain or the original statue)
- Japanese Buildings (v2.0) - Sometimes I can place everything without a problem, sometimes nothing, sometimes only 4-5 buildings of the set show up on the list and I can't build even those...
- Houses in Alpine climate - Sometimes I can't place any of its buildings, sometimes I can place all without a problem
- Suburban Renewal Houses (v0.11) - Same as with Alpine


I've tested the problematic newgrfs in the scenario editor completely alone, no other newgrfs loaded whatsoever. The weirdest thing is that sometimes a simple restart of the game changes the behaviour. For example when I couldn't build houses from the Japanese Buildings set I simply quit the program, started it up again and then it worked correctly. Problems seem to occur more likely if newgrf settings in the main menu have been changed since the last restart of the program.

A typical example:
I'm working in the scenario editor with a set of grfs. I quit the editor, change the newgrf list to include only say TTRS then I start a new map in scenario editor. In this case I most often can't place TTRS buildings in the editor. If then I shut down the program, restart it and go straight to the editor without touching anything else then most often I can place TTRS houses. It's as if newgrf setting changes don't register till a restart.


Edit:
Just tried TTRS and Swedish Houses together (TTRS first in the list). Even after a restart I can't build any of the Swedish houses. From the TTRS houses I can build most except for the last 5-6 or so on the list. It seems the problems are universal, not newgrf-specific.

oberhümer
Tycoon
Tycoon
Posts: 1277
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

Re: My patch(es) (place house manually)

Post by oberhümer » 05 Jul 2011 22:56

Just checked it out, and I have absolutely no idea.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---

ZxBiohazardZx
Tycoon
Tycoon
Posts: 1534
Joined: 14 Mar 2006 12:46
Location: Netherlands
Contact:

Re: My patch(es) (place house manually)

Post by ZxBiohazardZx » 09 Mar 2012 19:45

i took the liberty of updating patch to r24018:
house_placing_r24018-1.diff
(13.14 KiB) Downloaded 88 times
not sure on crashes/errors, i just ported it over, no extra features or stuff added yet, just check if it works and give some feedback if you can:)

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: broodje and 5 guests