1
0
Fork 0

(svn r19928) [1.0] -Backport from trunk:

- Feature: Translated desktop shortcut comments (r19884)
- Fix: Pay for the rail/road when constructing tunnels, bridges, depots and stations [FS#3859, FS#3827] (r19925, r19887, r19881)
- Fix: Closing chatbox could cause glitches when news message was shown [FS#3865] (r19921)
release/1.0
rubidium 2010-06-04 21:14:22 +00:00
parent 76f552f16d
commit 69aa1249fb
13 changed files with 75 additions and 16 deletions

View File

@ -88,7 +88,8 @@ endif
$(Q)cp "$(BIN_DIR)/scripts/"* "$(BUNDLE_DIR)/scripts/" $(Q)cp "$(BIN_DIR)/scripts/"* "$(BUNDLE_DIR)/scripts/"
ifdef MENU_DIR ifdef MENU_DIR
$(Q)cp "$(ROOT_DIR)/media/openttd.desktop" "$(BUNDLE_DIR)/media/" $(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 endif
ifeq ($(TTD), openttd.exe) 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" $(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/readme.txt" "$(BUNDLE_DIR)/COPYING" "$(BUNDLE_DIR)/changelog.txt" "$(BUNDLE_DIR)/known-bugs.txt"

View File

@ -43,6 +43,7 @@ OSXAPP = !!OSXAPP!!
LIPO = !!LIPO!! LIPO = !!LIPO!!
REVISION = !!REVISION!! REVISION = !!REVISION!!
AWK = !!AWK!! AWK = !!AWK!!
SORT = !!SORT!!
DISTCC = !!DISTCC!! DISTCC = !!DISTCC!!
RES := $(shell if [ ! -f $(CONFIG_CACHE_PWD) ] || [ "`pwd`" != "`cat $(CONFIG_CACHE_PWD)`" ]; then echo "`pwd`" > $(CONFIG_CACHE_PWD); fi ) RES := $(shell if [ ! -f $(CONFIG_CACHE_PWD) ] || [ "`pwd`" != "`cat $(CONFIG_CACHE_PWD)`" ]; then echo "`pwd`" > $(CONFIG_CACHE_PWD); fi )

View File

@ -7093,7 +7093,7 @@ ERROR: HasNext() is invalid as Begin() is never called
IsBuoyTile(): false IsBuoyTile(): false
IsLockTile(): false IsLockTile(): false
IsCanalTile(): false IsCanalTile(): false
GetBankBalance(): 480703 GetBankBalance(): 479851
BuildWaterDepot(): true BuildWaterDepot(): true
BuildDock(): true BuildDock(): true
BuildBuoy(): true BuildBuoy(): true
@ -7106,7 +7106,7 @@ ERROR: HasNext() is invalid as Begin() is never called
IsBuoyTile(): true IsBuoyTile(): true
IsLockTile(): true IsLockTile(): true
IsCanalTile(): true IsCanalTile(): true
GetBankBalance(): 451154 GetBankBalance(): 450302
--AIWaypointList(BUOY)-- --AIWaypointList(BUOY)--
Count(): 1 Count(): 1
@ -7125,7 +7125,7 @@ ERROR: HasNext() is invalid as Begin() is never called
IsBuoyTile(): false IsBuoyTile(): false
IsLockTile(): false IsLockTile(): false
IsCanalTile(): false IsCanalTile(): false
GetBankBalance(): 428509 GetBankBalance(): 427657
BuildWaterDepot(): true BuildWaterDepot(): true
BuildDock(): true BuildDock(): true

View File

@ -4,8 +4,8 @@
Type=Application Type=Application
Version=1.1 Version=1.1
Name=!!MENU_NAME!! Name=!!MENU_NAME!!
Comment=A clone of Transport Tycoon Deluxe
Icon=openttd Icon=openttd
Exec=!!TTD!! Exec=!!TTD!!
Terminal=false Terminal=false
Categories=!!MENU_GROUP!! Categories=!!MENU_GROUP!!
Comment=A clone of Transport Tycoon Deluxe

View File

@ -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 <http://www.gnu.org/licenses/>.
#
# 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}

View File

@ -86,7 +86,7 @@ public:
static int32 GetMaxSpeed(BridgeID bridge_id); 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 bridge_id The bridge to get the new cost of.
* @param length The length of the bridge. * @param length The length of the bridge.
* @pre IsValidBridge(bridge_id). * @pre IsValidBridge(bridge_id).

View File

@ -14,6 +14,11 @@
* functions may still be available if you return an older API version * functions may still be available if you return an older API version
* in GetAPIVersion() in info.nut. * 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 * \b 1.0.1
* *
* API additions: * API additions:

View File

@ -14,6 +14,7 @@
#include "command_func.h" #include "command_func.h"
#include "economy_func.h" #include "economy_func.h"
#include "bridge.h" #include "bridge.h"
#include "rail.h"
#include "strings_func.h" #include "strings_func.h"
#include "window_func.h" #include "window_func.h"
#include "sound_func.h" #include "sound_func.h"
@ -394,6 +395,13 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
bl = new GUIBridgeList(); 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 */ /* loop for all bridgetypes */
for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) { for (BridgeType brd_type = 0; brd_type != MAX_BRIDGES; brd_type++) {
if (CheckBridgeAvailability(brd_type, bridge_len).Succeeded()) { if (CheckBridgeAvailability(brd_type, bridge_len).Succeeded()) {
@ -403,7 +411,7 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transpo
item->spec = GetBridgeSpec(brd_type); item->spec = GetBridgeSpec(brd_type);
/* Add to terraforming & bulldozing costs the cost of the /* Add to terraforming & bulldozing costs the cost of the
* bridge itself (not computed with DC_QUERY_COST) */ * 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;
} }
} }
} }

View File

@ -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_CHANGE_SIGN_NAME :{WHITE}Can't change sign name...
STR_ERROR_CAN_T_DELETE_SIGN :{WHITE}Can't delete sign... 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 ##id 0x2000
# Town building names # Town building names
STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1 :Tall office block STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1 :Tall office block

View File

@ -490,24 +490,35 @@ struct NewsWindow : Window {
virtual void OnInvalidateData(int data) virtual void OnInvalidateData(int data)
{ {
/* The chatbar has notified us that is was either created or closed */ /* 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->chat_height = data;
this->SetWindowTop(newtop);
} }
virtual void OnTick() virtual void OnTick()
{ {
/* Scroll up newsmessages from the bottom in steps of 4 pixels */ /* 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); int newtop = max(this->top - 4, _screen.height - this->height - this->status_height - this->chat_height);
if (y == this->top) return; this->SetWindowTop(newtop);
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);
} }
private: 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 StringID GetCompanyMessageString() const
{ {
switch (this->ni->subtype) { switch (this->ni->subtype) {

View File

@ -871,6 +871,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u
} }
cost.AddCost(_price[PR_BUILD_DEPOT_TRAIN]); cost.AddCost(_price[PR_BUILD_DEPOT_TRAIN]);
cost.AddCost(RailBuildCost(railtype));
return cost; return cost;
} }

View File

@ -1020,6 +1020,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
if (cost.Failed()) return cost; if (cost.Failed()) return cost;
/* Add construction expenses. */ /* Add construction expenses. */
cost.AddCost((numtracks * _price[PR_BUILD_STATION_RAIL] + _price[PR_BUILD_STATION_RAIL_LENGTH]) * plat_len); 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; Station *st = NULL;
CommandCost ret = FindJoiningStation(est, station_to_join, adjacent, new_location, &st); CommandCost ret = FindJoiningStation(est, station_to_join, adjacent, new_location, &st);

View File

@ -465,6 +465,12 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
if (!(flags & DC_QUERY_COST) || (c != NULL && c->is_ai)) { if (!(flags & DC_QUERY_COST) || (c != NULL && c->is_ai)) {
bridge_len += 2; // begin and end tiles/ramps 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); if (c != NULL) bridge_len = CalcBridgeLenCostFactor(bridge_len);
cost.AddCost((int64)bridge_len * _price[PR_BUILD_BRIDGE] * GetBridgeSpec(bridge_type)->price >> 8); 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(_price[PR_BUILD_TUNNEL]);
cost.AddCost(ret); 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 (flags & DC_EXEC) {
if (transport_type == TRANSPORT_RAIL) { if (transport_type == TRANSPORT_RAIL) {
MakeRailTunnel(start_tile, _current_company, direction, railtype); MakeRailTunnel(start_tile, _current_company, direction, railtype);