(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)
This commit is contained in:
rubidium 2007-08-10 17:53:12 +00:00
parent dbaf192ba0
commit 3baf4aa4a2
8 changed files with 37 additions and 8 deletions

View File

@ -731,7 +731,6 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
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;

8
npf.c
View File

@ -868,7 +868,13 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir,
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;

View File

@ -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 @@ bool AfterLoadGame(void)
/* 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)) {

View File

@ -108,7 +108,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
/* Draw max speed */
{
SetDParam(0, v->max_speed / 2);
SetDParam(0, v->max_speed * 10 / 32);
DrawString(2, 25, STR_9813_MAX_SPEED, 0);
}

View File

@ -1154,10 +1154,17 @@ static const char* QZ_SetVideoWindowed(uint width, uint height)
/* 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 */

View File

@ -619,6 +619,9 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
#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) {

View File

@ -157,7 +157,7 @@ static int32 RemoveShiplift(TileIndex tile, uint32 flags)
{
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 @@ static int32 ClearTile_Water(TileIndex tile, byte flags)
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 @@ static void ChangeTileOwner_Water(TileIndex tile, PlayerID old_player, PlayerID
if (new_player != PLAYER_SPECTATOR) {
SetTileOwner(tile, new_player);
} else {
} else if (IsShipDepot(tile)) {
DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
} else {
SetTileOwner(tile, OWNER_NONE);
}
}

View File

@ -193,6 +193,7 @@ public:
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 @@ public:
// finish if we have reached the destination
if (target_seen) {
end_by_target_seen = true;
break;
}
@ -340,7 +342,7 @@ public:
}
// 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 @@ public:
// 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