src/town.h
branchcpp_gui
changeset 6308 646711c5feaa
parent 6307 f40e88cff863
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
   139 	byte road_build_months;
   139 	byte road_build_months;
   140 
   140 
   141 	/* Index in town array */
   141 	/* Index in town array */
   142 	TownID index;
   142 	TownID index;
   143 
   143 
       
   144 	/* If this is a larger town, and should grow more quickly. */
       
   145 	bool larger_town;
       
   146 
   144 	/* NOSAVE: UpdateTownRadius updates this given the house count. */
   147 	/* NOSAVE: UpdateTownRadius updates this given the house count. */
   145 	uint16 radius[5];
   148 	uint16 radius[5];
   146 
   149 
   147 	/* NOSAVE: The number of each type of building in the town. */
   150 	/* NOSAVE: The number of each type of building in the town. */
   148 	BuildingCounts building_counts;
   151 	BuildingCounts building_counts;
   179 	/* grf file related properties*/
   182 	/* grf file related properties*/
   180 	uint8 local_id;                    ///< id defined by the grf file for this house
   183 	uint8 local_id;                    ///< id defined by the grf file for this house
   181 	const struct GRFFile *grffile;     ///< grf file that introduced this house
   184 	const struct GRFFile *grffile;     ///< grf file that introduced this house
   182 };
   185 };
   183 
   186 
       
   187 enum TownSizeMode {
       
   188 	TSM_RANDOM,
       
   189 	TSM_FIXED,
       
   190 	TSM_CITY
       
   191 };
       
   192 
   184 VARDEF HouseSpec _house_specs[HOUSE_MAX];
   193 VARDEF HouseSpec _house_specs[HOUSE_MAX];
   185 
   194 
   186 uint32 GetWorldPopulation();
   195 uint32 GetWorldPopulation();
   187 
   196 
   188 void UpdateTownVirtCoord(Town *t);
   197 void UpdateTownVirtCoord(Town *t);
   189 void InitializeTown();
   198 void InitializeTown();
   190 void ShowTownViewWindow(TownID town);
   199 void ShowTownViewWindow(TownID town);
   191 void ExpandTown(Town *t);
   200 void ExpandTown(Town *t);
   192 Town *CreateRandomTown(uint attempts, uint size_mode);
   201 Town *CreateRandomTown(uint attempts, TownSizeMode mode, uint size);
   193 
   202 
   194 enum {
   203 enum {
   195 	ROAD_REMOVE = 0,
   204 	ROAD_REMOVE = 0,
   196 	UNMOVEABLE_REMOVE = 1,
   205 	UNMOVEABLE_REMOVE = 1,
   197 	TUNNELBRIDGE_REMOVE = 1,
   206 	TUNNELBRIDGE_REMOVE = 1,
   277 	return town->xy != 0;
   286 	return town->xy != 0;
   278 }
   287 }
   279 
   288 
   280 /**
   289 /**
   281  * Check if a TownID is valid.
   290  * Check if a TownID is valid.
   282  * @param TownID to inquiry
   291  * @param index to inquiry in the pool of town
   283  * @return true if it exists
   292  * @return true if it exists
   284  */
   293  */
   285 static inline bool IsValidTownID(TownID index)
   294 static inline bool IsValidTownID(TownID index)
   286 {
   295 {
   287 	return index < GetTownPoolSize() && IsValidTown(GetTown(index));
   296 	return index < GetTownPoolSize() && IsValidTown(GetTown(index));