Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef OBJECT_MAP_H
00013 #define OBJECT_MAP_H
00014
00015 #include "water_map.h"
00016 #include "object_type.h"
00017
00018 ObjectType GetObjectType(TileIndex t);
00019
00027 static inline bool IsObjectType(TileIndex t, ObjectType type)
00028 {
00029 return GetObjectType(t) == type;
00030 }
00031
00038 static inline bool IsObjectTypeTile(TileIndex t, ObjectType type)
00039 {
00040 return IsTileType(t, MP_OBJECT) && GetObjectType(t) == type;
00041 }
00042
00049 static inline ObjectID GetObjectIndex(TileIndex t)
00050 {
00051 assert(IsTileType(t, MP_OBJECT));
00052 return _m[t].m2 | _m[t].m5 << 16;
00053 }
00054
00061 static inline byte GetObjectRandomBits(TileIndex t)
00062 {
00063 assert(IsTileType(t, MP_OBJECT));
00064 return _m[t].m3;
00065 }
00066
00067
00076 static inline void MakeObject(TileIndex t, Owner o, ObjectID index, WaterClass wc, byte random)
00077 {
00078 SetTileType(t, MP_OBJECT);
00079 SetTileOwner(t, o);
00080 SetWaterClass(t, wc);
00081 _m[t].m2 = index;
00082 _m[t].m3 = random;
00083 _m[t].m4 = 0;
00084 _m[t].m5 = index >> 16;
00085 SB(_m[t].m6, 2, 4, 0);
00086 _me[t].m7 = 0;
00087 }
00088
00089 #endif