1
0
Fork 0

(svn r27271) [1.5] -Backport from trunk:

- Fix: Invalid infrastructure counting when crossing tram tracks with railroads [FS#6281] (r27252)
- Fix: Broken error message in configure [FS#6286] (r27250)
- Fix: Town labels on smallmap and zoomed-out viewports were not centered [FS#6257] (r27248)
- Fix: Removing a rail waypoint used the remove-rail-station cost [FS#6251] (r27245)
release/1.5
frosch 2015-05-08 17:30:07 +00:00
parent de3f7697a5
commit 24fdbabaf9
7 changed files with 37 additions and 30 deletions

View File

@ -2940,7 +2940,7 @@ detect_icu() {
# It was forced, so it should be found. # It was forced, so it should be found.
if [ "$with_icu" != "1" ]; then if [ "$with_icu" != "1" ]; then
log 1 "configure: error: icu-config couldn't be found" log 1 "configure: error: icu-config couldn't be found"
log 1 "configure: error: you supplied '$with_icuconfig', but it seems invalid" log 1 "configure: error: you supplied '$with_icu', but it seems invalid"
exit 1 exit 1
fi fi

View File

@ -485,31 +485,31 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
RoadTypes roadtypes = GetRoadTypes(tile); RoadTypes roadtypes = GetRoadTypes(tile);
RoadBits road = GetRoadBits(tile, ROADTYPE_ROAD); RoadBits road = GetRoadBits(tile, ROADTYPE_ROAD);
RoadBits tram = GetRoadBits(tile, ROADTYPE_TRAM); RoadBits tram = GetRoadBits(tile, ROADTYPE_TRAM);
switch (roadtypes) { if ((track == TRACK_X && (road | tram) == ROAD_Y) ||
default: break; (track == TRACK_Y && (road | tram) == ROAD_X)) {
case ROADTYPES_TRAM: switch (roadtypes) {
/* Tram crossings must always have road. */ default: break;
if (flags & DC_EXEC) { case ROADTYPES_TRAM:
SetRoadOwner(tile, ROADTYPE_ROAD, _current_company); /* Tram crossings must always have road. */
Company *c = Company::GetIfValid(_current_company); if (flags & DC_EXEC) {
if (c != NULL) { SetRoadOwner(tile, ROADTYPE_ROAD, _current_company);
/* A full diagonal tile has two road bits. */ Company *c = Company::GetIfValid(_current_company);
c->infrastructure.road[ROADTYPE_ROAD] += 2; if (c != NULL) {
DirtyCompanyInfrastructureWindows(c->index); /* A full diagonal tile has two road bits. */
c->infrastructure.road[ROADTYPE_ROAD] += 2;
DirtyCompanyInfrastructureWindows(c->index);
}
} }
} roadtypes |= ROADTYPES_ROAD;
roadtypes |= ROADTYPES_ROAD; break;
break;
case ROADTYPES_ALL: case ROADTYPES_ALL:
if (road != tram) return CMD_ERROR; if (road != tram) return CMD_ERROR;
break; break;
} }
road |= tram; road |= tram;
if ((track == TRACK_X && road == ROAD_Y) ||
(track == TRACK_Y && road == ROAD_X)) {
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
MakeRoadCrossing(tile, GetRoadOwner(tile, ROADTYPE_ROAD), GetRoadOwner(tile, ROADTYPE_TRAM), _current_company, (track == TRACK_X ? AXIS_Y : AXIS_X), railtype, roadtypes, GetTownIndex(tile)); MakeRoadCrossing(tile, GetRoadOwner(tile, ROADTYPE_ROAD), GetRoadOwner(tile, ROADTYPE_TRAM), _current_company, (track == TRACK_X ? AXIS_Y : AXIS_X), railtype, roadtypes, GetTownIndex(tile));
UpdateLevelCrossing(tile, false); UpdateLevelCrossing(tile, false);

View File

@ -1623,11 +1623,12 @@ CommandCost CmdRemoveFromRailWaypoint(TileIndex start, DoCommandFlag flags, uint
* Remove a rail station/waypoint * Remove a rail station/waypoint
* @param st The station/waypoint to remove the rail part from * @param st The station/waypoint to remove the rail part from
* @param flags operation to perform * @param flags operation to perform
* @param removal_cost the cost for removing a tile
* @tparam T the type of station to remove * @tparam T the type of station to remove
* @return cost or failure of operation * @return cost or failure of operation
*/ */
template <class T> template <class T>
CommandCost RemoveRailStation(T *st, DoCommandFlag flags) CommandCost RemoveRailStation(T *st, DoCommandFlag flags, Money removal_cost)
{ {
/* Current company owns the station? */ /* Current company owns the station? */
if (_current_company != OWNER_WATER) { if (_current_company != OWNER_WATER) {
@ -1649,7 +1650,7 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags)
CommandCost ret = EnsureNoVehicleOnGround(tile); CommandCost ret = EnsureNoVehicleOnGround(tile);
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
cost.AddCost(_price[PR_CLEAR_STATION_RAIL]); cost.AddCost(removal_cost);
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
/* read variables before the station tile is removed */ /* read variables before the station tile is removed */
Track track = GetRailStationTrack(tile); Track track = GetRailStationTrack(tile);
@ -1704,7 +1705,7 @@ static CommandCost RemoveRailStation(TileIndex tile, DoCommandFlag flags)
} }
Station *st = Station::GetByTile(tile); Station *st = Station::GetByTile(tile);
CommandCost cost = RemoveRailStation(st, flags); CommandCost cost = RemoveRailStation(st, flags, _price[PR_CLEAR_STATION_RAIL]);
if (flags & DC_EXEC) st->RecomputeIndustriesNear(); if (flags & DC_EXEC) st->RecomputeIndustriesNear();
@ -1724,7 +1725,7 @@ static CommandCost RemoveRailWaypoint(TileIndex tile, DoCommandFlag flags)
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAIL_WAYPOINT); return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAIL_WAYPOINT);
} }
return RemoveRailStation(Waypoint::GetByTile(tile), flags); return RemoveRailStation(Waypoint::GetByTile(tile), flags, _price[PR_CLEAR_WAYPOINT_RAIL]);
} }

View File

@ -114,7 +114,7 @@ void DrawTextEffects(DrawPixelInfo *dpi)
for (TextEffect *te = _text_effects.Begin(); te != end; te++) { for (TextEffect *te = _text_effects.Begin(); te != end; te++) {
if (te->string_id == INVALID_STRING_ID) continue; if (te->string_id == INVALID_STRING_ID) continue;
if (te->mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) { if (te->mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
ViewportAddString(dpi, ZOOM_LVL_OUT_8X, te, te->string_id, te->string_id - 1, 0, te->params_1, te->params_2); ViewportAddString(dpi, ZOOM_LVL_OUT_8X, te, te->string_id, te->string_id - 1, STR_NULL, te->params_1, te->params_2);
} }
} }
} }

View File

@ -377,7 +377,8 @@ void Town::UpdateVirtCoord()
SetDParam(0, this->index); SetDParam(0, this->index);
SetDParam(1, this->cache.population); SetDParam(1, this->cache.population);
this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_LVL_BASE, this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_LVL_BASE,
_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN); _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN,
STR_VIEWPORT_TOWN);
SetWindowDirty(WC_TOWN_VIEW, this->index); SetWindowDirty(WC_TOWN_VIEW, this->index);
} }

View File

@ -1309,8 +1309,9 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
* @param center the (preferred) center of the viewport sign * @param center the (preferred) center of the viewport sign
* @param top the new top of the sign * @param top the new top of the sign
* @param str the string to show in the sign * @param str the string to show in the sign
* @param str_small the string to show when zoomed out. STR_NULL means same as \a str
*/ */
void ViewportSign::UpdatePosition(int center, int top, StringID str) void ViewportSign::UpdatePosition(int center, int top, StringID str, StringID str_small)
{ {
if (this->width_normal != 0) this->MarkDirty(); if (this->width_normal != 0) this->MarkDirty();
@ -1323,6 +1324,9 @@ void ViewportSign::UpdatePosition(int center, int top, StringID str)
this->center = center; this->center = center;
/* zoomed out version */ /* zoomed out version */
if (str_small != STR_NULL) {
GetString(buffer, str_small, lastof(buffer));
}
this->width_small = VPSM_LEFT + Align(GetStringBoundingBox(buffer, FS_SMALL).width, 2) + VPSM_RIGHT; this->width_small = VPSM_LEFT + Align(GetStringBoundingBox(buffer, FS_SMALL).width, 2) + VPSM_RIGHT;
this->MarkDirty(); this->MarkDirty();

View File

@ -14,6 +14,7 @@
#include "zoom_type.h" #include "zoom_type.h"
#include "strings_type.h" #include "strings_type.h"
#include "table/strings.h"
class LinkGraphOverlay; class LinkGraphOverlay;
@ -50,7 +51,7 @@ struct ViewportSign {
uint16 width_normal; ///< The width when not zoomed out (normal font) uint16 width_normal; ///< The width when not zoomed out (normal font)
uint16 width_small; ///< The width when zoomed out (small font) uint16 width_small; ///< The width when zoomed out (small font)
void UpdatePosition(int center, int top, StringID str); void UpdatePosition(int center, int top, StringID str, StringID str_small = STR_NULL);
void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const; void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
}; };