update to 1.5.2

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2015-09-01 22:52:41 +03:00
parent 641df04e75
commit 48992033ed
87 changed files with 1446 additions and 847 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: road_cmd.cpp 27186 2015-03-14 14:27:07Z michi_cc $ */
/* $Id: road_cmd.cpp 27350 2015-07-30 18:50:39Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -237,10 +237,10 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
SetRoadTypes(tile, GetRoadTypes(tile) & ~RoadTypeToRoadTypes(rt));
/* If the owner of the bridge sells all its road, also move the ownership
* to the owner of the other roadtype. */
* to the owner of the other roadtype, unless the bridge owner is a town. */
RoadType other_rt = (rt == ROADTYPE_ROAD) ? ROADTYPE_TRAM : ROADTYPE_ROAD;
Owner other_owner = GetRoadOwner(tile, other_rt);
if (other_owner != GetTileOwner(tile)) {
if (!IsTileOwner(tile, other_owner) && !IsTileOwner(tile, OWNER_TOWN)) {
SetTileOwner(tile, other_owner);
SetTileOwner(other_end, other_owner);
}
@@ -384,7 +384,10 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
/* Update rail count for level crossings. The plain track should still be accounted
* for, so only subtract the difference to the level crossing cost. */
c = Company::GetIfValid(GetTileOwner(tile));
if (c != NULL) c->infrastructure.rail[GetRailType(tile)] -= LEVELCROSSING_TRACKBIT_FACTOR - 1;
if (c != NULL) {
c->infrastructure.rail[GetRailType(tile)] -= LEVELCROSSING_TRACKBIT_FACTOR - 1;
DirtyCompanyInfrastructureWindows(c->index);
}
} else {
SetRoadTypes(tile, rts);
}
@@ -563,6 +566,15 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
return_cmd_error(STR_ERROR_ALREADY_BUILT);
}
/* Disallow breaking end-of-line of someone else
* so trams can still reverse on this tile. */
if (rt == ROADTYPE_TRAM && HasExactlyOneBit(existing)) {
Owner owner = GetRoadOwner(tile, rt);
if (Company::IsValidID(owner)) {
CommandCost ret = CheckOwnership(owner);
if (ret.Failed()) return ret;
}
}
break;
}
@@ -629,7 +641,10 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Update rail count for level crossings. The plain track is already
* counted, so only add the difference to the level crossing cost. */
c = Company::GetIfValid(GetTileOwner(tile));
if (c != NULL) c->infrastructure.rail[GetRailType(tile)] += LEVELCROSSING_TRACKBIT_FACTOR - 1;
if (c != NULL) {
c->infrastructure.rail[GetRailType(tile)] += LEVELCROSSING_TRACKBIT_FACTOR - 1;
DirtyCompanyInfrastructureWindows(c->index);
}
/* Always add road to the roadtypes (can't draw without it) */
bool reserved = HasBit(GetRailReservationTrackBits(tile), railtrack);