src/tree_cmd.cpp
branchcpp_gui
changeset 6268 4b5241e5dd10
parent 5919 2b58160d667d
child 6298 c30fe89622df
equal deleted inserted replaced
6267:7c8ec33959b1 6268:4b5241e5dd10
   226 	// make sure sx,sy are smaller than ex,ey
   226 	// make sure sx,sy are smaller than ex,ey
   227 	ex = TileX(tile);
   227 	ex = TileX(tile);
   228 	ey = TileY(tile);
   228 	ey = TileY(tile);
   229 	sx = TileX(p2);
   229 	sx = TileX(p2);
   230 	sy = TileY(p2);
   230 	sy = TileY(p2);
   231 	if (ex < sx) intswap(ex, sx);
   231 	if (ex < sx) Swap(ex, sx);
   232 	if (ey < sy) intswap(ey, sy);
   232 	if (ey < sy) Swap(ey, sy);
   233 
   233 
   234 	cost = 0; // total cost
   234 	cost = 0; // total cost
   235 
   235 
   236 	for (x = sx; x <= ex; x++) {
   236 	for (x = sx; x <= ex; x++) {
   237 		for (y = sy; y <= ey; y++) {
   237 		for (y = sy; y <= ey; y++) {
   238 			TileIndex tile = TileXY(x, y);
   238 			TileIndex tile = TileXY(x, y);
   239 
       
   240 			if (!EnsureNoVehicle(tile)) continue;
       
   241 
   239 
   242 			switch (GetTileType(tile)) {
   240 			switch (GetTileType(tile)) {
   243 				case MP_TREES:
   241 				case MP_TREES:
   244 					// no more space for trees?
   242 					// no more space for trees?
   245 					if (_game_mode != GM_EDITOR && GetTreeCount(tile) == 3) {
   243 					if (_game_mode != GM_EDITOR && GetTreeCount(tile) == 3) {