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: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

My patch(es) (place house manually)

Post by oberhümer »

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 263 times
Screenshot of house builder
Screenshot of house builder
screenshot.png (57.04 KiB) Viewed 1229 times
house_placing_r22277.diff
Allow manual house construction
(23.07 KiB) Downloaded 328 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: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

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

Post by maquinista »

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: 1283
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 »

Here. Normal trees are arctic, savanna trees temperate(for whatever reason).
Attachments
Clearly visible climate zones.
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 »

Why is there a long rectangular strip of snow at sea level?
User avatar
SwissFan91
Tycoon
Tycoon
Posts: 2395
Joined: 08 Feb 2009 18:36
Location: Alberta, Canada

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

Post by SwissFan91 »

INteresting concept, I'd like to see how this develops.
Total Alpine Replacement Set: Industry, Town, Objects
Arie-
Director
Director
Posts: 593
Joined: 20 Jan 2009 16:07

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

Post by Arie- »

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 »

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 »

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 »

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: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

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

Post by oberhümer »

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 »

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: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

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

Post by ChillCore »

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: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

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

Post by oberhümer »

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 198 times
bundle.zip.002.txt
(3.39 MiB) Downloaded 262 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: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

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

Post by oberhümer »

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: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

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

Post by ChillCore »

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: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

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

Post by oberhümer »

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 »

@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 »

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: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

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

Post by oberhümer »

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

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

Post by ZxBiohazardZx »

i took the liberty of updating patch to r24018:
house_placing_r24018-1.diff
(13.14 KiB) Downloaded 180 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: No registered users and 15 guests