src/newgrf_spritegroup.h
branchNewGRF_ports
changeset 6870 ca3fd1fbe311
parent 6743 cabfaa4a0295
child 6872 1c4a4a609f85
equal deleted inserted replaced
6869:76282d3b748d 6870:ca3fd1fbe311
     5 #ifndef NEWGRF_SPRITEGROUP_H
     5 #ifndef NEWGRF_SPRITEGROUP_H
     6 #define NEWGRF_SPRITEGROUP_H
     6 #define NEWGRF_SPRITEGROUP_H
     7 
     7 
     8 #include "town.h"
     8 #include "town.h"
     9 #include "industry.h"
     9 #include "industry.h"
       
    10 #include "newgrf_storage.h"
    10 
    11 
    11 /**
    12 /**
    12  * Gets the value of a so-called newgrf "register".
    13  * Gets the value of a so-called newgrf "register".
    13  * @param i index of the register
    14  * @param i index of the register
    14  * @pre i < 0x110
    15  * @pre i < 0x110
    15  * @return the value of the register
    16  * @return the value of the register
    16  */
    17  */
    17 static inline uint32 GetRegister(uint i)
    18 static inline uint32 GetRegister(uint i)
    18 {
    19 {
    19 	assert(i < 0x110);
    20 	extern TemporaryStorageArray<uint32, 0x110> _temp_store;
    20 	extern uint32 _temp_store[0x110];
    21 	return _temp_store.Get(i);
    21 	return _temp_store[i];
       
    22 }
    22 }
    23 
    23 
    24 struct SpriteGroup;
    24 struct SpriteGroup;
    25 
    25 
    26 
    26 
    74 	DSGA_OP_AND,  ///< a & b
    74 	DSGA_OP_AND,  ///< a & b
    75 	DSGA_OP_OR,   ///< a | b
    75 	DSGA_OP_OR,   ///< a | b
    76 	DSGA_OP_XOR,  ///< a ^ b
    76 	DSGA_OP_XOR,  ///< a ^ b
    77 	DSGA_OP_STO,  ///< store a into temporary storage, indexed by b. return a
    77 	DSGA_OP_STO,  ///< store a into temporary storage, indexed by b. return a
    78 	DSGA_OP_RST,  ///< return b
    78 	DSGA_OP_RST,  ///< return b
       
    79 	DSGA_OP_STOP, ///< store a into persistent storage, indexed by b, return a
       
    80 	DSGA_OP_ROR,  ///< rotate a b positions to the right
       
    81 	DSGA_OP_SCMP, ///< (signed) comparision (a < b -> 0, a == b = 1, a > b = 2)
       
    82 	DSGA_OP_UCMP, ///< (unsigned) comparision (a < b -> 0, a == b = 1, a > b = 2)
    79 };
    83 };
    80 
    84 
    81 
    85 
    82 struct DeterministicSpriteGroupAdjust {
    86 struct DeterministicSpriteGroupAdjust {
    83 	DeterministicSpriteGroupAdjustOperation operation;
    87 	DeterministicSpriteGroupAdjustOperation operation;
   197 	uint32 reseed;
   201 	uint32 reseed;
   198 	VarSpriteGroupScope scope;
   202 	VarSpriteGroupScope scope;
   199 
   203 
   200 	bool info_view; ///< Indicates if the item is being drawn in an info window
   204 	bool info_view; ///< Indicates if the item is being drawn in an info window
   201 
   205 
       
   206 	BaseStorageArray *psa; ///< The persistent storage array of this resolved object.
       
   207 
   202 	union {
   208 	union {
   203 		struct {
   209 		struct {
   204 			const struct Vehicle *self;
   210 			const struct Vehicle *self;
   205 			const struct Vehicle *parent;
   211 			const struct Vehicle *parent;
   206 			EngineID self_type;
   212 			EngineID self_type;
   224 			TileIndex tile;
   230 			TileIndex tile;
   225 			Industry *ind;
   231 			Industry *ind;
   226 			IndustryGfx gfx;
   232 			IndustryGfx gfx;
   227 		} industry;
   233 		} industry;
   228 		struct {
   234 		struct {
   229 			TileIndex tile;
       
   230 			const IndustrySpec *spec;
       
   231 			uint itspec_index;
       
   232 		} industry_location;
       
   233 		struct {
       
   234 			const struct CargoSpec *cs;
   235 			const struct CargoSpec *cs;
   235 		} cargo;
   236 		} cargo;
   236 	} u;
   237 	} u;
   237 
   238 
   238 	uint32 (*GetRandomBits)(const struct ResolverObject*);
   239 	uint32 (*GetRandomBits)(const struct ResolverObject*);