(svn r10841) [0.5] -Backport from trunk (r10835, r10593, r10500, r10497, r10410, r10357, r10199):
- Fix: [Windows] Do not try to minimise or restore the window when closing OpenTTD [FS#998] (r10835)
- Fix: One could not remove locks that were build in a (very) old version of OpenTTD [FS#1038] (r10593)
- Fix: One cannot navigate using arrow keys in the game name text box [FS#1038] (r10500)
- Fix: Ship's maximum speed wrongly shown [FS#1013] (r10497)
- Fix: [OSX] Of the resolution is changed to something that is too high for the monitor, then it is reduced to fit the monitor size, solving several crashes and graphical glitches [FS#458] (r10410)
- Fix: NPF was leaking memory each time it got initialized, except for the first time (r10357)
- Fix: [YAPF] 'target_seen' flag that is set prematurely in some cases (1 tile long cached segment followed by target station) which caused asserts to trigger [FS#884] (r10199)
--- a/network_gui.c Fri Aug 10 17:49:29 2007 +0000
+++ b/network_gui.c Fri Aug 10 17:53:12 2007 +0000
@@ -731,7 +731,6 @@
if (HandleEditBoxKey(w, &WP(w, network_ql_d).q, 3, e) == 1) break; // enter pressed
ttd_strlcpy(_network_server_name, WP(w, network_ql_d).q.text.buf, sizeof(_network_server_name));
- UpdateTextBufferSize(&WP(w, network_ql_d).q.text);
}
break;
--- a/npf.c Fri Aug 10 17:49:29 2007 +0000
+++ b/npf.c Fri Aug 10 17:53:12 2007 +0000
@@ -868,7 +868,13 @@
void InitializeNPF(void)
{
- init_AyStar(&_npf_aystar, NPFHash, NPF_HASH_SIZE);
+ static bool first_init = true;
+ if (first_init) {
+ first_init = false;
+ init_AyStar(&_npf_aystar, NPFHash, NPF_HASH_SIZE);
+ } else {
+ AyStarMain_Clear(&_npf_aystar);
+ }
_npf_aystar.loops_per_tick = 0;
_npf_aystar.max_path_cost = 0;
//_npf_aystar.max_search_nodes = 0;
--- a/openttd.c Fri Aug 10 17:49:29 2007 +0000
+++ b/openttd.c Fri Aug 10 17:53:12 2007 +0000
@@ -25,6 +25,7 @@
#include "station_map.h"
#include "town_map.h"
#include "tunnel_map.h"
+#include "water_map.h"
#include "vehicle.h"
#include "viewport.h"
#include "window.h"
@@ -1615,10 +1616,19 @@
/* Buoys do now store the owner of the previous water tile, which can never
* be OWNER_NONE. So replace OWNER_NONE with OWNER_WATER. */
if (CheckSavegameVersion(46)) {
+ TileIndex t;
Station *st;
FOR_ALL_STATIONS(st) {
if (IsBuoy(st) && IsTileOwner(st->xy, OWNER_NONE)) SetTileOwner(st->xy, OWNER_WATER);
}
+
+ /* Locks/shiplifts in very old savegames had OWNER_WATER as owner */
+ for (t = 0; t < MapSize(); t++) {
+ if (IsTileType(t, MP_WATER) && GetWaterTileType(t) == WATER_LOCK &&
+ GetTileOwner(t) == OWNER_WATER) {
+ SetTileOwner(t, OWNER_NONE);
+ }
+ }
}
if (CheckSavegameVersion(7)) {
--- a/ship_gui.c Fri Aug 10 17:49:29 2007 +0000
+++ b/ship_gui.c Fri Aug 10 17:53:12 2007 +0000
@@ -108,7 +108,7 @@
/* Draw max speed */
{
- SetDParam(0, v->max_speed / 2);
+ SetDParam(0, v->max_speed * 10 / 32);
DrawString(2, 25, STR_9813_MAX_SPEED, 0);
}
--- a/video/cocoa_v.m Fri Aug 10 17:49:29 2007 +0000
+++ b/video/cocoa_v.m Fri Aug 10 17:53:12 2007 +0000
@@ -1154,10 +1154,17 @@
/* We already have a window, just change its size */
if (!isCustom) {
[ _cocoa_video_data.window setContentSize:contentRect.size ];
+ // Ensure frame height - title bar height >= view height
+ contentRect.size.height = clamp(height, 0, [ _cocoa_video_data.window frame ].size.height - 22 /* 22 is the height of title bar of window*/);
+ height = contentRect.size.height;
[ _cocoa_video_data.qdview setFrameSize:contentRect.size ];
}
}
+ // Update again
+ _cocoa_video_data.width = width;
+ _cocoa_video_data.height = height;
+
[ _cocoa_video_data.window center ];
/* Only recreate the view if it doesn't already exist */
--- a/video/win32_v.c Fri Aug 10 17:49:29 2007 +0000
+++ b/video/win32_v.c Fri Aug 10 17:53:12 2007 +0000
@@ -619,6 +619,9 @@
#if !defined(WINCE)
case WM_ACTIVATE: {
+ /* Don't do anything if we are closing openttd */
+ if (_exit_game) break;
+
bool active = (LOWORD(wParam) != WA_INACTIVE);
bool minimized = (HIWORD(wParam) != 0);
if (_wnd.fullscreen) {
--- a/water_cmd.c Fri Aug 10 17:49:29 2007 +0000
+++ b/water_cmd.c Fri Aug 10 17:53:12 2007 +0000
@@ -157,7 +157,7 @@
{
TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile));
- if (!CheckTileOwnership(tile)) return CMD_ERROR;
+ if (!CheckTileOwnership(tile) && GetTileOwner(tile) != OWNER_NONE) return CMD_ERROR;
// make sure no vehicle is on the tile.
if (!EnsureNoVehicle(tile) || !EnsureNoVehicle(tile + delta) || !EnsureNoVehicle(tile - delta))
@@ -303,7 +303,7 @@
return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
}
- if (GetTileOwner(tile) != OWNER_WATER && !CheckTileOwnership(tile)) return CMD_ERROR;
+ if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE && !CheckTileOwnership(tile)) return CMD_ERROR;
if (flags & DC_EXEC) DoClearSquare(tile);
return _price.clear_water;
@@ -810,8 +810,10 @@
if (new_player != PLAYER_SPECTATOR) {
SetTileOwner(tile, new_player);
+ } else if (IsShipDepot(tile)) {
+ DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
} else {
- DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
+ SetTileOwner(tile, OWNER_NONE);
}
}
--- a/yapf/yapf_costrail.hpp Fri Aug 10 17:49:29 2007 +0000
+++ b/yapf/yapf_costrail.hpp Fri Aug 10 17:53:12 2007 +0000
@@ -193,6 +193,7 @@
RailType rail_type = GetTileRailType(tile, trackdir);
bool target_seen = Yapf().PfDetectDestination(tile, trackdir);
+ bool end_by_target_seen = false;
if (tf.m_is_station) {
// station tiles have an extra penalty
@@ -210,6 +211,7 @@
// finish if we have reached the destination
if (target_seen) {
+ end_by_target_seen = true;
break;
}
@@ -340,7 +342,7 @@
}
// special costs for the case we have reached our target
- if (target_seen) {
+ if (end_by_target_seen) {
n.flags_u.flags_s.m_targed_seen = true;
if (n.flags_u.flags_s.m_last_signal_was_red) {
if (n.m_last_red_signal_type == SIGTYPE_EXIT) {
@@ -356,7 +358,7 @@
// total node cost
n.m_cost = parent_cost + first_tile_cost + segment_cost + extra_cost;
- return !n.m_segment->flags_u.flags_s.m_end_of_line;
+ return !n.m_segment->flags_u.flags_s.m_end_of_line || end_by_target_seen;
}
FORCEINLINE bool CanUseGlobalCache(Node& n) const