src/industry_cmd.cpp
branchgamebalance
changeset 9913 e79cd19772dd
parent 9912 1ac8aac92385
equal deleted inserted replaced
9912:1ac8aac92385 9913:e79cd19772dd
   278 	image = dits->building.sprite;
   278 	image = dits->building.sprite;
   279 	if (image != 0) {
   279 	if (image != 0) {
   280 		if (HASBIT(_transparent_opt, TO_INDUSTRIES)) {
   280 		if (HASBIT(_transparent_opt, TO_INDUSTRIES)) {
   281 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
   281 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
   282 			pal = PALETTE_TO_TRANSPARENT;
   282 			pal = PALETTE_TO_TRANSPARENT;
       
   283 		} else if (HASBIT(image, PALETTE_MODIFIER_COLOR) && dits->building.pal == PAL_NONE) {
       
   284 			pal = GENERAL_SPRITE_COLOR(ind->random_color);
   283 		} else {
   285 		} else {
   284 			pal = dits->building.pal;
   286 			pal = dits->building.pal;
   285 		}
   287 		}
   286 
   288 
   287 		AddSortableSpriteToDraw(image, pal,
   289 		AddSortableSpriteToDraw(image, pal,
   332 		SetDParamX(td->dparam, 0, td->str);
   334 		SetDParamX(td->dparam, 0, td->str);
   333 		td->str = STR_2058_UNDER_CONSTRUCTION;
   335 		td->str = STR_2058_UNDER_CONSTRUCTION;
   334 	}
   336 	}
   335 }
   337 }
   336 
   338 
   337 static int32 ClearTile_Industry(TileIndex tile, byte flags)
   339 static CommandCost ClearTile_Industry(TileIndex tile, byte flags)
   338 {
   340 {
   339 	Industry *i = GetIndustryByTile(tile);
   341 	Industry *i = GetIndustryByTile(tile);
   340 	const IndustrySpec *indspec = GetIndustrySpec(i->type);
   342 	const IndustrySpec *indspec = GetIndustrySpec(i->type);
   341 
   343 
   342 	/* water can destroy industries
   344 	/* water can destroy industries
  1129 					GetTileSlope(cur_tile, NULL) != SLOPE_FLAT) {
  1131 					GetTileSlope(cur_tile, NULL) != SLOPE_FLAT) {
  1130 				return false;
  1132 				return false;
  1131 			}
  1133 			}
  1132 		} else {
  1134 		} else {
  1133 			if (!EnsureNoVehicle(cur_tile)) return false;
  1135 			if (!EnsureNoVehicle(cur_tile)) return false;
       
  1136 			if (MayHaveBridgeAbove(cur_tile) && IsBridgeAbove(cur_tile)) return false;
       
  1137 
  1134 			IndustyBehaviour ind_behav = GetIndustrySpec(type)->behaviour;
  1138 			IndustyBehaviour ind_behav = GetIndustrySpec(type)->behaviour;
  1135 
  1139 
  1136 			if (ind_behav & INDUSTRYBEH_BUILT_ONWATER) {
  1140 			if (ind_behav & INDUSTRYBEH_BUILT_ONWATER) {
  1137 				/* As soon as the tile is not water, bail out.
  1141 				/* As soon as the tile is not water, bail out.
  1138 				 * But that does not mean the search is over.  You have
  1142 				 * But that does not mean the search is over.  You have
  1463  * @param flags of operations to conduct
  1467  * @param flags of operations to conduct
  1464  * @param p1 industry type see build_industry.h and see industry.h
  1468  * @param p1 industry type see build_industry.h and see industry.h
  1465  * @param p2 unused
  1469  * @param p2 unused
  1466  * @return index of the newly create industry, or CMD_ERROR if it failed
  1470  * @return index of the newly create industry, or CMD_ERROR if it failed
  1467  */
  1471  */
  1468 int32 CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1472 CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1469 {
  1473 {
  1470 	int num;
  1474 	int num;
  1471 	const IndustryTileTable * const *itt;
  1475 	const IndustryTileTable * const *itt;
  1472 	const IndustryTileTable *it;
  1476 	const IndustryTileTable *it;
  1473 	const IndustrySpec *indspec;
  1477 	const IndustrySpec *indspec;