Changeset - r7337:e3b141f0eeba
[Not reviewed]
master
0 3 0
belugas - 17 years ago 2007-07-27 02:41:29
belugas@openttd.org
(svn r10700) -Codechange: Enable to jump (by default) to the overriding industry tile spec of the one been queried.
Only on certain very specific circumstances do we need the original spec
3 files changed with 11 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/industry.h
Show inline comments
 
@@ -202,13 +202,13 @@ struct IndustryTileSpec {
 
	bool enabled;                         ///< entity still avaible (by default true).newgrf can disable it, though
 
	struct GRFFileProps grf_prop;
 
};
 

	
 
/* industry_cmd.cpp*/
 
const IndustrySpec *GetIndustrySpec(IndustryType thistype);    ///< Array of industries data
 
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx);  ///< Array of industry tiles data
 
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx, bool full_check = true);  ///< Array of industry tiles data
 
void ResetIndustries();
 
void PlantRandomFarmField(const Industry *i);
 

	
 
/* writable arrays of specs */
 
extern IndustrySpec _industry_specs[NUM_INDUSTRYTYPES];
 
extern IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES];
src/industry_cmd.cpp
Show inline comments
 
@@ -121,19 +121,25 @@ const IndustrySpec *GetIndustrySpec(Indu
 

	
 
/**
 
 * Accessor for array _industry_tile_specs.
 
 * This will ensure at once : proper access and
 
 * not allowing modifications of it.
 
 * @param gfx of industrytile (which is the index in _industry_tile_specs)
 
 * @param full_check (default to true) verify if an override is available.
 
 *  If so, use it instead of the gfx provided.
 
 * @pre gfx < INVALID_INDUSTRYTILE
 
 * @return a pointer to the corresponding industrytile spec
 
 **/
 
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx)
 
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx, bool full_check)
 
{
 
	assert(gfx < INVALID_INDUSTRYTILE);
 
	return &_industry_tile_specs[gfx];
 
	const IndustryTileSpec *its = &_industry_tile_specs[gfx];
 
	if (full_check && its->grf_prop.override != INVALID_INDUSTRYTILE) {
 
		its = &_industry_tile_specs[its->grf_prop.override];
 
	}
 
	return its;
 
}
 

	
 
void DestroyIndustry(Industry *i)
 
{
 
	BEGIN_TILE_LOOP(tile_cur, i->width, i->height, i->xy);
 
		if (IsTileType(tile_cur, MP_INDUSTRY)) {
src/newgrf_industries.cpp
Show inline comments
 
@@ -84,14 +84,14 @@ static uint GetClosestWaterDistance(Tile
 
uint32 GetIndustryIDAtOffset(TileIndex new_tile, TileIndex old_tile, const Industry *i)
 
{
 
	if (IsTileType(new_tile, MP_INDUSTRY)) {  // Is this an industry tile?
 

	
 
		if (GetIndustryIndex(new_tile) == i->index) {  // Does it belong to the same industry?
 
			IndustryGfx gfx = GetIndustryGfx(new_tile);
 
			const IndustryTileSpec *indtsp = GetIndustryTileSpec(gfx);
 
			const IndustryTileSpec *indold = GetIndustryTileSpec(GetIndustryGfx(old_tile));
 
			const IndustryTileSpec *indtsp = GetIndustryTileSpec(gfx, false);
 
			const IndustryTileSpec *indold = GetIndustryTileSpec(GetIndustryGfx(old_tile), false);
 

	
 
			if (gfx < NEW_INDUSTRYOFFSET) {  // Does it belongs to an old type?
 
				/* It is an old tile.  We have to see if it's been overriden */
 
				if (indtsp->grf_prop.override == INVALID_INDUSTRYTILE) {  // has it been overridden?
 
					return 0xFF << 8 | gfx; // no. Tag FF + the gfx id of that tile
 
				} else { // yes.  FInd out if it is from the same grf file or not
0 comments (0 inline, 0 general)