tron@3314: /* $Id$ */ tron@3314: tron@3314: #include "industry.h" tron@3314: #include "macros.h" tron@3314: #include "tile.h" tron@3314: tron@3314: tron@3314: static inline uint GetIndustryIndex(TileIndex t) tron@3314: { tron@3369: assert(IsTileType(t, MP_INDUSTRY)); tron@3314: return _m[t].m2; tron@3314: } tron@3314: tron@3314: static inline Industry* GetIndustryByTile(TileIndex t) tron@3314: { tron@3314: return GetIndustry(GetIndustryIndex(t)); tron@3314: } tron@3320: tron@3320: tron@3369: static inline bool IsIndustryCompleted(TileIndex t) tron@3321: { tron@3369: assert(IsTileType(t, MP_INDUSTRY)); tron@3369: return HASBIT(_m[t].m1, 7); tron@3321: } tron@3321: tron@3321: tron@3331: static inline uint GetIndustryGfx(TileIndex t) tron@3331: { tron@3369: assert(IsTileType(t, MP_INDUSTRY)); tron@3331: return _m[t].m5; tron@3331: } tron@3331: tron@3331: static inline void SetIndustryGfx(TileIndex t, uint gfx) tron@3331: { tron@3369: assert(IsTileType(t, MP_INDUSTRY)); tron@3331: _m[t].m5 = gfx; tron@3331: } tron@3331: tron@3331: tron@3320: static inline void MakeIndustry(TileIndex t, uint index, uint gfx) tron@3320: { tron@3320: SetTileType(t, MP_INDUSTRY); tron@3320: _m[t].m1 = 0; tron@3320: _m[t].m2 = index; tron@3320: _m[t].m3 = 0; tron@3320: _m[t].m4 = 0; tron@3320: _m[t].m5 = gfx; tron@3320: }