(svn r8922) [0.5] -Backport from trunk (r8907, r8919, r8920, r8921):

- [OSX] Reading from an unitialized variable (r8907)
 - [Win9x] FindFile with C:\\* doesn't work, don't append a slash doubly (r8919)
 - Do not require to press 'Apply changes' in the newgrf GUI if the changes in there are not activated (this happens in the title screen) (r8920)
 - Possible crashes, problems with aircraft and airport removal (r8921)
This commit is contained in:
Darkvater 2007-02-27 16:23:02 +00:00
parent cd6d6d32d3
commit 9321458918
4 changed files with 39 additions and 8 deletions

View File

@ -1212,14 +1212,39 @@ static void ProcessAircraftOrder(Vehicle *v)
order = GetVehicleOrder(v, v->cur_order_index);
if (order == NULL) {
v->current_order.type = OT_NOTHING;
v->current_order.flags = 0;
if (order == NULL|| (order->type == OT_DUMMY && !CheckForValidOrders(v))) {
/*
* We do not have an order. This can be divided into two cases:
* 1) we are heading to an invalid station. In this case we must
* find another airport to go to. If there is nowhere to go,
* we will destroy the aircraft as it otherwise will enter
* the holding pattern for the first airport, which can cause
* the plane to go into an undefined state when building an
* airport with the same StationID.
* 2) we are (still) heading to a (still) valid airport, then we
* can continue going there. This can happen when you are
* changing the aircraft's orders while in-flight or in for
* example a depot. However, when we have a current order to
* go to a depot, we have to keep that order so the aircraft
* actually stops.
*/
const Station *st = GetStation(v->u.air.targetairport);
if (!IsValidStation(st) || st->airport_tile == 0) {
int32 ret;
PlayerID old_player = _current_player;
_current_player = v->owner;
ret = DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
_current_player = old_player;
if (CmdFailed(ret)) CrashAirplane(v);
} else if (v->current_order.type != OT_GOTO_DEPOT) {
v->current_order.type = OT_NOTHING;
v->current_order.flags = 0;
}
return;
}
if (order->type == OT_DUMMY && !CheckForValidOrders(v)) CrashAirplane(v);
if (order->type == v->current_order.type &&
order->flags == v->current_order.flags &&
order->dest == v->current_order.dest)

View File

@ -465,6 +465,9 @@ static void NewGRFWndProc(Window *w, WindowEvent *e)
break;
case WE_DESTROY:
if (!WP(w, newgrf_d).execute) {
CopyGRFConfigList(WP(w, newgrf_d).orig_list, *WP(w, newgrf_d).list);
}
/* Remove the temporary copy of grf-list used in window */
ClearGRFConfigList(WP(w, newgrf_d).list);
break;

View File

@ -503,12 +503,12 @@ static bool QZ_PollEvent(void)
break;
case NSLeftMouseDown:
pt = QZ_GetMouseLocation(event);
if (!([ event modifierFlags ] & NSCommandKeyMask) ||
!QZ_MouseIsInsideView(&pt)) {
[NSApp sendEvent:event];
}
pt = QZ_GetMouseLocation(event);
if (!QZ_MouseIsInsideView(&pt)) {
QZ_ShowMouse();
break;

View File

@ -662,8 +662,11 @@ DIR *opendir(const wchar_t *path)
d = dir_calloc();
if (d != NULL) {
wchar_t search_path[MAX_PATH];
/* build search path for FindFirstFile */
_snwprintf(search_path, lengthof(search_path), L"%s\\*", path);
bool slash = path[wcslen(path) - 1] == L'\\';
/* build search path for FindFirstFile, try not to append additional slashes
* as it throws Win9x off its groove for root directories */
_snwprintf(search_path, lengthof(search_path), L"%s%s*", path, slash ? L"" : L"\\");
*lastof(search_path) = '\0';
d->hFind = FindFirstFileW(search_path, &d->fd);