Changeset - r15440:46e2c17b11f1
[Not reviewed]
master
0 1 0
terkhen - 14 years ago 2010-07-09 16:41:51
terkhen@openttd.org
(svn r20099) -Fix [FS#3882]: Give priority to ownership errors while removing roads.
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/road_cmd.cpp
Show inline comments
 
@@ -852,24 +852,27 @@ CommandCost CmdRemoveLongRoad(TileIndex 
 
				if (flags & DC_EXEC) {
 
					money -= ret.GetCost();
 
					if (money < 0) {
 
						_additional_cash_required = DoCommand(start_tile, end_tile, p2, flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD).GetCost();
 
						return cost;
 
					}
 
					RemoveRoad(tile, flags, bits, rt, true, false);
 
				}
 
				cost.AddCost(ret);
 
				had_success = true;
 
			} else {
 
				last_error = ret;
 

	
 
				/* Ownership errors are more important. */
 
				if (last_error.GetErrorMessage() == STR_ERROR_OWNED_BY) break;
 
			}
 
		}
 

	
 
		if (tile == end_tile) break;
 

	
 
		tile += (axis == AXIS_Y) ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
 
	}
 

	
 
	return had_success ? cost : last_error;
 
}
 

	
 
/** Build a road depot.
0 comments (0 inline, 0 general)