Files
@ r7596:afd285ff90bb
Branch filter:
Location: cpp/openttd-patchpack/source/src/newgrf_commons.h - annotation
r7596:afd285ff90bb
3.0 KiB
text/x-c
(svn r11123) -Update: WebTranslator2 update to 2007-09-17 12:45:29
afrikaans - 47 fixed, 52 changed by TrueTenacity (99)
brazilian_portuguese - 23 changed by fukumori (23)
bulgarian - 14 fixed by thetitan (14)
catalan - 3 changed by arnaullv (3)
croatian - 6 fixed, 12 changed by knovak (15), tperic (3)
danish - 20 fixed by ThomasA (20)
finnish - 20 fixed by habazi (20)
german - 10 fixed by Timwi (10)
hungarian - 1 fixed by miham (1)
italian - 1 fixed by lorenzodv (1)
japanese - 6 fixed by ickoonite (6)
norwegian_nynorsk - 6 fixed by pollux (6)
piglatin - 20 fixed by adammw (20)
russian - 20 fixed by Smoky555 (20)
slovak - 1 fixed by lengyel (1)
slovenian - 7 fixed by Necrolyte (7)
spanish - 1 changed by Cabu (1)
traditional_chinese - 21 fixed by xbddc (21)
afrikaans - 47 fixed, 52 changed by TrueTenacity (99)
brazilian_portuguese - 23 changed by fukumori (23)
bulgarian - 14 fixed by thetitan (14)
catalan - 3 changed by arnaullv (3)
croatian - 6 fixed, 12 changed by knovak (15), tperic (3)
danish - 20 fixed by ThomasA (20)
finnish - 20 fixed by habazi (20)
german - 10 fixed by Timwi (10)
hungarian - 1 fixed by miham (1)
italian - 1 fixed by lorenzodv (1)
japanese - 6 fixed by ickoonite (6)
norwegian_nynorsk - 6 fixed by pollux (6)
piglatin - 20 fixed by adammw (20)
russian - 20 fixed by Smoky555 (20)
slovak - 1 fixed by lengyel (1)
slovenian - 7 fixed by Necrolyte (7)
spanish - 1 changed by Cabu (1)
traditional_chinese - 21 fixed by xbddc (21)
r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r7325:df3b64d742c5 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6835:9051f7024392 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r7325:df3b64d742c5 r7325:df3b64d742c5 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r7325:df3b64d742c5 r6629:10368ea45a15 r6835:9051f7024392 r7325:df3b64d742c5 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6629:10368ea45a15 r6835:9051f7024392 r7325:df3b64d742c5 r7325:df3b64d742c5 r7325:df3b64d742c5 r7325:df3b64d742c5 r6835:9051f7024392 r7325:df3b64d742c5 r7325:df3b64d742c5 r6835:9051f7024392 r6835:9051f7024392 r7000:2cb5bda647b1 r7000:2cb5bda647b1 r7325:df3b64d742c5 r7325:df3b64d742c5 r7325:df3b64d742c5 r7325:df3b64d742c5 r7325:df3b64d742c5 r7325:df3b64d742c5 r7000:2cb5bda647b1 r7000:2cb5bda647b1 r6629:10368ea45a15 r6835:9051f7024392 r7000:2cb5bda647b1 r6629:10368ea45a15 r6801:3c6b56e07296 r6827:5f08bab6696e r6801:3c6b56e07296 r6629:10368ea45a15 | /* $Id$ */
/** @file newgrf_commons.h This file simplyfies and embeds a common mechanism of
* loading/saving and mapping of grf entities.
*/
#ifndef NEWGRF_COMMONS_H
#define NEWGRF_COMMONS_H
/**
* Maps an entity id stored on the map to a GRF file.
* Entities are objects used ingame (houses, industries, industry tiles) for
* which we need to correlate the ids from the grf files with the ones in the
* the savegames themselves.
* An array of EntityIDMapping structs is saved with the savegame so
* that those GRFs can be loaded in a different order, or removed safely. The
* index in the array is the entity's ID stored on the map.
*
* The substitute ID is the ID of an original entity that should be used instead
* if the GRF containing the new entity is not available.
*/
struct EntityIDMapping {
uint32 grfid; ///< The GRF ID of the file the entity belongs to
uint8 entity_id; ///< The entity ID within the GRF file
uint8 substitute_id; ///< The (original) entity ID to use if this GRF is not available
};
class OverrideManagerBase {
protected:
uint16 *entity_overrides;
uint16 max_offset; ///< what is the length of the original entity's array of specs
uint16 max_new_entities; ///< what is the amount of entities, old and new summed
uint16 invalid_ID; ///< ID used to dected invalid entities;
public:
EntityIDMapping *mapping_ID; ///< mapping of ids from grf files. Public out of convenience
OverrideManagerBase(uint16 offset, uint16 maximum, uint16 invalid);
virtual ~OverrideManagerBase();
void ResetOverride();
void ResetMapping();
void Add(uint8 local_id, uint entity_type);
virtual uint16 AddEntityID(byte grf_local_id, uint32 grfid, byte substitute_id);
uint16 GetSubstituteID(byte entity_id);
uint16 GetID(uint8 grf_local_id, uint32 grfid);
inline uint16 GetMaxMapping() { return max_new_entities; }
inline uint16 GetMaxOffset() { return max_offset; }
};
struct HouseSpec;
class HouseOverrideManager : public OverrideManagerBase {
public:
HouseOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) :
OverrideManagerBase(offset, maximum, invalid) {}
void SetEntitySpec(const HouseSpec *hs);
};
struct IndustrySpec;
class IndustryOverrideManager : public OverrideManagerBase {
public:
IndustryOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) :
OverrideManagerBase(offset, maximum, invalid) {}
virtual uint16 AddEntityID(byte grf_local_id, uint32 grfid, byte substitute_id);
void SetEntitySpec(const IndustrySpec *inds);
};
struct IndustryTileSpec;
class IndustryTileOverrideManager : public OverrideManagerBase {
public:
IndustryTileOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) :
OverrideManagerBase(offset, maximum, invalid) {}
void SetEntitySpec(const IndustryTileSpec *indts);
};
extern HouseOverrideManager _house_mngr;
extern IndustryOverrideManager _industry_mngr;
extern IndustryTileOverrideManager _industile_mngr;
uint32 GetTerrainType(TileIndex tile);
TileIndex GetNearbyTile(byte parameter, TileIndex tile);
#endif /* NEWGRF_COMMONS_H */
|