src/industry_map.h
changeset 9718 4b7468076d31
parent 8119 52b48108425a
child 9838 976f08497fa7
equal deleted inserted replaced
9717:b7806a165a75 9718:4b7468076d31
     5 #ifndef INDUSTRY_MAP_H
     5 #ifndef INDUSTRY_MAP_H
     6 #define INDUSTRY_MAP_H
     6 #define INDUSTRY_MAP_H
     7 
     7 
     8 #include "industry.h"
     8 #include "industry.h"
     9 #include "tile_map.h"
     9 #include "tile_map.h"
    10 
    10 #include "water_map.h"
    11 
    11 
    12 
    12 
    13 /**
    13 /**
    14  * The following enums are indices used to know what to draw for this industry tile.
    14  * The following enums are indices used to know what to draw for this industry tile.
    15  * They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h
    15  * They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h
   153 	_m[t].m5 = GB(gfx, 0, 8);
   153 	_m[t].m5 = GB(gfx, 0, 8);
   154 	SB(_m[t].m6, 2, 1, GB(gfx, 8, 1));
   154 	SB(_m[t].m6, 2, 1, GB(gfx, 8, 1));
   155 }
   155 }
   156 
   156 
   157 /**
   157 /**
       
   158  * Tests if the industry tile was built on water.
       
   159  * @param t the industry tile
       
   160  * @return true iff on water
       
   161  */
       
   162 static inline bool IsIndustryTileOnWater(TileIndex t)
       
   163 {
       
   164 	assert(IsTileType(t, MP_INDUSTRY));
       
   165 	return (GetWaterClass(t) != WATER_CLASS_INVALID);
       
   166 }
       
   167 
       
   168 /**
   158  * Make the given tile an industry tile
   169  * Make the given tile an industry tile
   159  * @param t      the tile to make an industry tile
   170  * @param t      the tile to make an industry tile
   160  * @param index  the industry this tile belongs to
   171  * @param index  the industry this tile belongs to
   161  * @param gfx    the graphics to use for the tile
   172  * @param gfx    the graphics to use for the tile
   162  * @param random the random value
   173  * @param random the random value
   163  */
   174  */
   164 static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random)
   175 static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx, uint8 random, WaterClass wc)
   165 {
   176 {
   166 	SetTileType(t, MP_INDUSTRY);
   177 	SetTileType(t, MP_INDUSTRY);
   167 	_m[t].m1 = 0;
   178 	_m[t].m1 = 0;
   168 	_m[t].m2 = index;
   179 	_m[t].m2 = index;
   169 	_m[t].m3 = 0;
   180 	_m[t].m3 = 0;
   170 	_m[t].m4 = 0;
   181 	_m[t].m4 = 0;
   171 	SetIndustryGfx(t, gfx);
   182 	SetIndustryGfx(t, gfx);
   172 	_me[t].m7 = random;
   183 	_me[t].m7 = random;
       
   184 	SetWaterClass(t, wc);
   173 }
   185 }
   174 
   186 
   175 /**
   187 /**
   176  * Returns this indutry tile's construction counter value
   188  * Returns this indutry tile's construction counter value
   177  * @param tile the tile to query
   189  * @param tile the tile to query