diff --git a/Makefile.bundle.in b/Makefile.bundle.in index 6a1f3657fb..446890a522 100644 --- a/Makefile.bundle.in +++ b/Makefile.bundle.in @@ -88,7 +88,8 @@ endif $(Q)cp "$(BIN_DIR)/scripts/"* "$(BUNDLE_DIR)/scripts/" ifdef MENU_DIR $(Q)cp "$(ROOT_DIR)/media/openttd.desktop" "$(BUNDLE_DIR)/media/" - $(Q)cat "$(ROOT_DIR)/media/openttd.desktop" | sed s/=openttd/=$(BINARY_NAME)/g > "$(ROOT_DIR)/media/openttd.desktop.install" + $(Q)$(AWK) -f "$(ROOT_DIR)/media/openttd.desktop.translation.awk" "$(SRC_DIR)/lang/"*.txt | $(SORT) >> "$(BUNDLE_DIR)/media/openttd.desktop" + $(Q)sed s/=openttd/=$(BINARY_NAME)/g "$(BUNDLE_DIR)/media/openttd.desktop" > "$(ROOT_DIR)/media/openttd.desktop.install" endif ifeq ($(TTD), openttd.exe) $(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/readme.txt" "$(BUNDLE_DIR)/COPYING" "$(BUNDLE_DIR)/changelog.txt" "$(BUNDLE_DIR)/known-bugs.txt" diff --git a/Makefile.in b/Makefile.in index c4200b833a..d4bb0c02d1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -43,6 +43,7 @@ OSXAPP = !!OSXAPP!! LIPO = !!LIPO!! REVISION = !!REVISION!! AWK = !!AWK!! +SORT = !!SORT!! DISTCC = !!DISTCC!! RES := $(shell if [ ! -f $(CONFIG_CACHE_PWD) ] || [ "`pwd`" != "`cat $(CONFIG_CACHE_PWD)`" ]; then echo "`pwd`" > $(CONFIG_CACHE_PWD); fi ) diff --git a/bin/ai/regression/regression.txt b/bin/ai/regression/regression.txt index 0402a50c8d..4479e7788e 100644 --- a/bin/ai/regression/regression.txt +++ b/bin/ai/regression/regression.txt @@ -7093,7 +7093,7 @@ ERROR: HasNext() is invalid as Begin() is never called IsBuoyTile(): false IsLockTile(): false IsCanalTile(): false - GetBankBalance(): 480703 + GetBankBalance(): 479851 BuildWaterDepot(): true BuildDock(): true BuildBuoy(): true @@ -7106,7 +7106,7 @@ ERROR: HasNext() is invalid as Begin() is never called IsBuoyTile(): true IsLockTile(): true IsCanalTile(): true - GetBankBalance(): 451154 + GetBankBalance(): 450302 --AIWaypointList(BUOY)-- Count(): 1 @@ -7125,7 +7125,7 @@ ERROR: HasNext() is invalid as Begin() is never called IsBuoyTile(): false IsLockTile(): false IsCanalTile(): false - GetBankBalance(): 428509 + GetBankBalance(): 427657 BuildWaterDepot(): true BuildDock(): true diff --git a/media/openttd.desktop.in b/media/openttd.desktop.in index 5c37ac4981..d1cd8c70f7 100644 --- a/media/openttd.desktop.in +++ b/media/openttd.desktop.in @@ -4,8 +4,8 @@ Type=Application Version=1.1 Name=!!MENU_NAME!! -Comment=A clone of Transport Tycoon Deluxe Icon=openttd Exec=!!TTD!! Terminal=false Categories=!!MENU_GROUP!! +Comment=A clone of Transport Tycoon Deluxe diff --git a/media/openttd.desktop.translation.awk b/media/openttd.desktop.translation.awk new file mode 100644 index 0000000000..943cb498f5 --- /dev/null +++ b/media/openttd.desktop.translation.awk @@ -0,0 +1,15 @@ +# $Id$ + +# This file is part of OpenTTD. +# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. +# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + +# +# Awk script to automatically generate a single comment line +# for a translated desktop shortcut. If it does not exist there +# is no output. +# + +/##isocode/ { lang = $2; next } +/STR_DESKTOP_SHORTCUT_COMMENT/ { sub("^[^:]*:", "", $0); print "Comment[" lang "]=" $0; next} diff --git a/src/ai/api/ai_bridge.hpp b/src/ai/api/ai_bridge.hpp index e9daa27b48..19e6bbed1d 100644 --- a/src/ai/api/ai_bridge.hpp +++ b/src/ai/api/ai_bridge.hpp @@ -86,7 +86,7 @@ public: static int32 GetMaxSpeed(BridgeID bridge_id); /** - * Get the new cost of a bridge. + * Get the new cost of a bridge, excluding the road and/or rail. * @param bridge_id The bridge to get the new cost of. * @param length The length of the bridge. * @pre IsValidBridge(bridge_id). diff --git a/src/ai/api/ai_changelog.hpp b/src/ai/api/ai_changelog.hpp index d79431811d..db675e1a53 100644 --- a/src/ai/api/ai_changelog.hpp +++ b/src/ai/api/ai_changelog.hpp @@ -14,6 +14,11 @@ * functions may still be available if you return an older API version * in GetAPIVersion() in info.nut. * + * \b 1.0.2 + * + * Other changes: + * \li AIBridge::GetPrice now returns the price of the bridge without the cost for the rail or road. + * * \b 1.0.1 * * API additions: diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 05882d6b0f..3a4868208c 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -14,6 +14,7 @@ #include "command_func.h" #include "economy_func.h" #include "bridge.h" +#include "rail.h" #include "strings_func.h" #include "window_func.h" #include "sound_func.h" @@ -394,6 +395,13 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo bl = new GUIBridgeList(); + Money infra_cost = 0; + switch (transport_type) { + case TRANSPORT_ROAD: infra_cost = (bridge_len + 2) * _price[PR_BUILD_ROAD] * 2; break; + case TRANSPORT_RAIL: infra_cost = (bridge_len + 2) * RailBuildCost((RailType)road_rail_type); break; + default: break; + } + /* loop for all bridgetypes */ for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) { if (CheckBridgeAvailability(brd_type, bridge_len).Succeeded()) { @@ -403,7 +411,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo item->spec = GetBridgeSpec(brd_type); /* Add to terraforming & bulldozing costs the cost of the * bridge itself (not computed with DC_QUERY_COST) */ - item->cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item->spec->price) >> 8); + item->cost = ret.GetCost() + (((int64)tot_bridgedata_len * _price[PR_BUILD_BRIDGE] * item->spec->price) >> 8) + infra_cost; } } } diff --git a/src/lang/english.txt b/src/lang/english.txt index 7cd03f652d..75b6dc4c23 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3639,6 +3639,9 @@ STR_ERROR_CAN_T_PLACE_SIGN_HERE :{WHITE}Can't pl STR_ERROR_CAN_T_CHANGE_SIGN_NAME :{WHITE}Can't change sign name... STR_ERROR_CAN_T_DELETE_SIGN :{WHITE}Can't delete sign... +# Translatable comment for OpenTTD's desktop shortcut +STR_DESKTOP_SHORTCUT_COMMENT :A clone of Transport Tycoon Deluxe + ##id 0x2000 # Town building names STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1 :Tall office block diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 9b2a5dcb5a..d90b8eb3ac 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -490,24 +490,35 @@ struct NewsWindow : Window { virtual void OnInvalidateData(int data) { /* The chatbar has notified us that is was either created or closed */ + int newtop = this->top + this->chat_height - data; this->chat_height = data; + this->SetWindowTop(newtop); } virtual void OnTick() { /* Scroll up newsmessages from the bottom in steps of 4 pixels */ - int y = max(this->top - 4, _screen.height - this->height - this->status_height - this->chat_height); - if (y == this->top) return; - - if (this->viewport != NULL) this->viewport->top += y - this->top; - - int diff = Delta(this->top, y); - this->top = y; - - SetDirtyBlocks(this->left, this->top, this->left + this->width, this->top + this->height + diff); + int newtop = max(this->top - 4, _screen.height - this->height - this->status_height - this->chat_height); + this->SetWindowTop(newtop); } private: + /** + * Moves the window so #newtop is new 'top' coordinate. Makes screen dirty where needed. + * @param newtop new top coordinate + */ + void SetWindowTop(int newtop) + { + if (this->top == newtop) return; + + int mintop = min(newtop, this->top); + int maxtop = max(newtop, this->top); + if (this->viewport != NULL) this->viewport->top += newtop - this->top; + this->top = newtop; + + SetDirtyBlocks(this->left, mintop, this->left + this->width, maxtop + this->height); + } + StringID GetCompanyMessageString() const { switch (this->ni->subtype) { diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index f9f9f6242c..e7af8aec01 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -871,6 +871,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u } cost.AddCost(_price[PR_BUILD_DEPOT_TRAIN]); + cost.AddCost(RailBuildCost(railtype)); return cost; } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 1a37910ef5..7ae08b1e68 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1020,6 +1020,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 if (cost.Failed()) return cost; /* Add construction expenses. */ cost.AddCost((numtracks * _price[PR_BUILD_STATION_RAIL] + _price[PR_BUILD_STATION_RAIL_LENGTH]) * plat_len); + cost.AddCost(numtracks * plat_len * RailBuildCost(rt)); Station *st = NULL; CommandCost ret = FindJoiningStation(est, station_to_join, adjacent, new_location, &st); diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 200d44abf2..0968de9e1f 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -465,6 +465,12 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u if (!(flags & DC_QUERY_COST) || (c != NULL && c->is_ai)) { bridge_len += 2; // begin and end tiles/ramps + switch (transport_type) { + case TRANSPORT_ROAD: cost.AddCost(bridge_len * _price[PR_BUILD_ROAD] * 2); break; + case TRANSPORT_RAIL: cost.AddCost(bridge_len * RailBuildCost(railtype)); break; + default: break; + } + if (c != NULL) bridge_len = CalcBridgeLenCostFactor(bridge_len); cost.AddCost((int64)bridge_len * _price[PR_BUILD_BRIDGE] * GetBridgeSpec(bridge_type)->price >> 8); @@ -590,6 +596,13 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, cost.AddCost(_price[PR_BUILD_TUNNEL]); cost.AddCost(ret); + /* Pay for the rail/road in the tunnel including entrances */ + switch (transport_type) { + case TRANSPORT_ROAD: cost.AddCost((tiles + 2) * _price[PR_BUILD_ROAD] * 2); break; + case TRANSPORT_RAIL: cost.AddCost((tiles + 2) * RailBuildCost(railtype)); break; + default: break; + } + if (flags & DC_EXEC) { if (transport_type == TRANSPORT_RAIL) { MakeRailTunnel(start_tile, _current_company, direction, railtype);