Changeset - r17832:1bf540f50d96
[Not reviewed]
master
0 4 0
frosch - 13 years ago 2011-07-04 20:25:17
frosch@openttd.org
(svn r22633) -Fix: Implement variables 25 and 7F for railtypes.
4 files changed with 17 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -4599,6 +4599,7 @@ static void RailTypeMapSpriteGroup(ByteR
 
			if (railtypes[i] != INVALID_RAILTYPE) {
 
				RailtypeInfo *rti = &_railtypes[railtypes[i]];
 

	
 
				rti->grffile[ctype] = _cur_grffile;
 
				rti->group[ctype] = _cur_grffile->spritegroups[groupid];
 
			}
 
		}
src/newgrf_railtype.cpp
Show inline comments
 
@@ -67,7 +67,7 @@ static const SpriteGroup *RailTypeResolv
 
	return NULL;
 
}
 

	
 
static inline void NewRailTypeResolver(ResolverObject *res, TileIndex tile, TileContext context)
 
static inline void NewRailTypeResolver(ResolverObject *res, TileIndex tile, TileContext context, const GRFFile *grffile)
 
{
 
	res->GetRandomBits = &RailTypeGetRandomBits;
 
	res->GetTriggers   = &RailTypeGetTriggers;
 
@@ -85,6 +85,8 @@ static inline void NewRailTypeResolver(R
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 

	
 
	res->grffile         = grffile;
 
}
 

	
 
/**
 
@@ -104,7 +106,7 @@ SpriteID GetCustomRailSprite(const Railt
 
	const SpriteGroup *group;
 
	ResolverObject object;
 

	
 
	NewRailTypeResolver(&object, tile, context);
 
	NewRailTypeResolver(&object, tile, context, rti->grffile[rtsg]);
 

	
 
	group = SpriteGroup::Resolve(rti->group[rtsg], &object);
 
	if (group == NULL || group->GetNumResults() == 0) return 0;
 
@@ -140,5 +142,7 @@ uint8 GetReverseRailTypeTranslation(Rail
 
 */
 
void GetRailTypeResolver(ResolverObject *ro, uint index)
 
{
 
	NewRailTypeResolver(ro, index, TCX_NORMAL);
 
	/* There is no unique GRFFile for the tile. Multiple GRFs can define different parts of the railtype.
 
	 * However, currently the NewGRF Debug GUI does not display variables depending on the GRF (like 0x7F) anyway. */
 
	NewRailTypeResolver(ro, index, TCX_NORMAL, NULL);
 
}
src/rail.h
Show inline comments
 
@@ -233,6 +233,11 @@ struct RailtypeInfo {
 
	byte sorting_order;
 

	
 
	/**
 
	 * NewGRF providing the Action3 for the railtype. NULL if not available.
 
	 */
 
	const GRFFile *grffile[RTSG_END];
 

	
 
	/**
 
	 * Sprite groups for resolving sprites
 
	 */
 
	const SpriteGroup *group[RTSG_END];
src/table/railtypes.h
Show inline comments
 
@@ -105,6 +105,7 @@ static const RailtypeInfo _original_rail
 
		0 << 4 | 7,
 

	
 
		{ NULL },
 
		{ NULL },
 
	},
 

	
 
	/** Electrified railway */
 
@@ -197,6 +198,7 @@ static const RailtypeInfo _original_rail
 
		1 << 4 | 7,
 

	
 
		{ NULL },
 
		{ NULL },
 
	},
 

	
 
	/** Monorail */
 
@@ -285,6 +287,7 @@ static const RailtypeInfo _original_rail
 
		2 << 4 | 7,
 

	
 
		{ NULL },
 
		{ NULL },
 
	},
 

	
 
	/** Maglev */
 
@@ -373,6 +376,7 @@ static const RailtypeInfo _original_rail
 
		3 << 4 | 7,
 

	
 
		{ NULL },
 
		{ NULL },
 
	},
 
};
 

	
0 comments (0 inline, 0 general)