src/water_cmd.cpp
changeset 8368 dcee6c9440b5
parent 8361 7963f4b11d96
child 8380 174326093caa
equal deleted inserted replaced
8367:1337e3aab307 8368:dcee6c9440b5
    54 	/* Mark tile dirty in all cases */
    54 	/* Mark tile dirty in all cases */
    55 	MarkTileDirtyByTile(t);
    55 	MarkTileDirtyByTile(t);
    56 
    56 
    57 	/* Non-sealevel -> canal */
    57 	/* Non-sealevel -> canal */
    58 	if (TileHeight(t) != 0) {
    58 	if (TileHeight(t) != 0) {
    59 		MakeCanal(t, o);
    59 		MakeCanal(t, o, Random());
    60 		return;
    60 		return;
    61 	}
    61 	}
    62 
    62 
    63 	bool has_water = false;
    63 	bool has_water = false;
    64 	bool has_canal = false;
    64 	bool has_canal = false;
    69 			has_water |= IsSea(neighbour) || IsCoast(neighbour) || (IsShipDepot(neighbour) && GetShipDepotWaterOwner(neighbour) == OWNER_WATER);
    69 			has_water |= IsSea(neighbour) || IsCoast(neighbour) || (IsShipDepot(neighbour) && GetShipDepotWaterOwner(neighbour) == OWNER_WATER);
    70 			has_canal |= IsCanal(neighbour) || (IsShipDepot(neighbour) && GetShipDepotWaterOwner(neighbour) != OWNER_WATER);
    70 			has_canal |= IsCanal(neighbour) || (IsShipDepot(neighbour) && GetShipDepotWaterOwner(neighbour) != OWNER_WATER);
    71 		}
    71 		}
    72 	}
    72 	}
    73 	if (has_canal || !has_water) {
    73 	if (has_canal || !has_water) {
    74 		MakeCanal(t, o);
    74 		MakeCanal(t, o, Random());
    75 	} else {
    75 	} else {
    76 		MakeWater(t);
    76 		MakeWater(t);
    77 	}
    77 	}
    78 }
    78 }
    79 
    79 
   126 void MakeWaterOrCanalDependingOnOwner(TileIndex tile, Owner o)
   126 void MakeWaterOrCanalDependingOnOwner(TileIndex tile, Owner o)
   127 {
   127 {
   128 	if (o == OWNER_WATER) {
   128 	if (o == OWNER_WATER) {
   129 		MakeWater(tile);
   129 		MakeWater(tile);
   130 	} else {
   130 	} else {
   131 		MakeCanal(tile, o);
   131 		MakeCanal(tile, o, Random());
   132 	}
   132 	}
   133 }
   133 }
   134 
   134 
   135 static CommandCost RemoveShipDepot(TileIndex tile, uint32 flags)
   135 static CommandCost RemoveShipDepot(TileIndex tile, uint32 flags)
   136 {
   136 {
   303 
   303 
   304 		if (flags & DC_EXEC) {
   304 		if (flags & DC_EXEC) {
   305 			if (TileHeight(tile) == 0 && p2 == 1) {
   305 			if (TileHeight(tile) == 0 && p2 == 1) {
   306 				MakeWater(tile);
   306 				MakeWater(tile);
   307 			} else if (p2 == 2) {
   307 			} else if (p2 == 2) {
   308 				MakeRiver(tile);
   308 				MakeRiver(tile, Random());
   309 			} else {
   309 			} else {
   310 				MakeCanal(tile, _current_player);
   310 				MakeCanal(tile, _current_player, Random());
   311 			}
   311 			}
   312 			MarkTileDirtyByTile(tile);
   312 			MarkTileDirtyByTile(tile);
   313 			MarkTilesAroundDirty(tile);
   313 			MarkTilesAroundDirty(tile);
   314 		}
   314 		}
   315 
   315