Problems with NML Houses

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Problems with NML Houses

Post by planetmaker »

Andrew350 wrote:The problem of all the houses not showing up seems to be because you aren't setting a house id in the item definitions. Adding one just before HOUSE_SIZE_1x1 seems to work:

item (FEAT_HOUSES, item_rij50, 01, HOUSE_SIZE_1X1) {
...
}

I'm not sure if that's working as intended or not, I just know it works ;)
If that's the solution to all the trouble as described by YSH, that's interesting. It *should* work without as the ID is optional. But if it works with it, that's at least a good hint as in where the problem hides :-)
User avatar
YSH
Engineer
Engineer
Posts: 101
Joined: 15 Jan 2008 15:05

Re: Problems with NML Houses

Post by YSH »

Adding an ID of -1 to each item does indeed work, for the multi-tile houses also.
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: Problems with NML Houses

Post by Andrew350 »

Hi all, quick question. If I try to set IDs for only a few houses and leave the rest blank, then only the ones which I've set IDs for will show up in-game. Leaving them all blank works fine though. Is this intentional (i.e. should you only assign IDs on an all or none basis), or is it possibly related to the bug above?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Problems with NML Houses

Post by planetmaker »

Andrew350 wrote:Hi all, quick question. If I try to set IDs for only a few houses and leave the rest blank, then only the ones which I've set IDs for will show up in-game. Leaving them all blank works fine though. Is this intentional (i.e. should you only assign IDs on an all or none basis), or is it possibly related to the bug above?
That does not sound like intended. It should - in principle - work with any combination and automatically assign an ID to the ones where you haven't defined explicitly an ID.
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: Problems with NML Houses

Post by Andrew350 »

It seems that as long as the houses are defined "in order" everything works fine regardless of the IDs being set, but if I mix it up, say like this:

id 00
id 01
blank (no id)
id 03
id 02
blank
...etc


The first "blank" house in this scenario will not appear in-game, but any others defined afterwards will. And if I remove the house "id 02", then it shows up fine. The above setup should work, though, correct?
User avatar
andov3
Engineer
Engineer
Posts: 19
Joined: 20 Jun 2014 13:32
Location: Indonesia

Re: Problems with NML Houses

Post by andov3 »

okay this thread about nml problem with houses right, i want to ask a question, how to match the houses direction with the road direction?
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Problems with NML Houses

Post by planetmaker »

andov3 wrote:okay this thread about nml problem with houses right, i want to ask a question, how to match the houses direction with the road direction?
You can check the tile class of the adjacent tiles to be of type TILE_CLASS_ROAD by means of the variable nearby_tile_class. Choose the appropriate sprite(s) depending on the result of that check.

The more advanced solution, which also makes sure that the house does no change when the adjacent roads change, is to (mis)use the animation frame to store the result.
User avatar
YSH
Engineer
Engineer
Posts: 101
Joined: 15 Jan 2008 15:05

Re: Problems with NML Houses

Post by YSH »

planetmaker wrote:The more advanced solution, which also makes sure that the house does no change when the adjacent roads change, is to (mis)use the animation frame to store the result.
Or you can make a separate item for each direction of the house, and using construction_check only let them be build facing a road.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Problems with NML Houses

Post by planetmaker »

YSH wrote:
planetmaker wrote:The more advanced solution, which also makes sure that the house does no change when the adjacent roads change, is to (mis)use the animation frame to store the result.
Or you can make a separate item for each direction of the house, and using construction_check only let them be build facing a road.
Yes, that might be a lot easier
User avatar
andov3
Engineer
Engineer
Posts: 19
Joined: 20 Jun 2014 13:32
Location: Indonesia

Re: Problems with NML Houses

Post by andov3 »

nah i only got 2 sprites, the first one is facing south west, the second one is facing northwest, which variable ? the construction_check or the NEARBY_TILE_ROAD?
User avatar
YSH
Engineer
Engineer
Posts: 101
Joined: 15 Jan 2008 15:05

Re: Problems with NML Houses

Post by YSH »

You would have a switch checking the road tile:

Code: Select all

// Road to the South
switch (FEAT_HOUSES,SELF, switch_roadS, nearby_tile_class(1,0))
{
		TILE_CLASS_ROAD: 1;
		return 0;
}
and place construction_check in the graphics part of the item:

Code: Select all

construction_check: switch_roadS;
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 15 guests