(svn r17988) [0.7] -Backport from trunk:

- Feature: Port OpenTTD to GNU/Hurd
- Fix: When you start giving money (input window for amount), then get moved to spectators and you click 'Ok' a crash would occur (r17953)
- Fix: Crash when closing NewGRF parameter window with no NewGRF selected [FS#3291] (r17922)
- Fix: Uninitialised values in some paths of loading TTO savegames [FS#3288] (r17908)
- Fix: Make the plane speed setting unchangeable in network games because it can be read by NewGRFs on game load and thus if it changes cause desyncs (r17902)
This commit is contained in:
rubidium 2009-11-06 22:58:54 +00:00
parent 072270f9b9
commit 7b6e449f15
7 changed files with 21 additions and 13 deletions

View File

@ -1799,6 +1799,7 @@ detect_os() {
/cygwin/ { print "CYGWIN"; exit} /cygwin/ { print "CYGWIN"; exit}
/mingw/ { print "MINGW"; exit} /mingw/ { print "MINGW"; exit}
/os\/2/ { print "OS2"; exit} /os\/2/ { print "OS2"; exit}
/gnu/ { print "UNIX"; exit}
'` '`
fi fi

View File

@ -61,6 +61,7 @@ void HandleOnEditText(const char *str)
switch (_rename_what) { switch (_rename_what) {
#ifdef ENABLE_NETWORK #ifdef ENABLE_NETWORK
case 3: { // Give money, you can only give money in excess of loan case 3: { // Give money, you can only give money in excess of loan
if (!IsValidCompanyID(_local_company)) break;
const Company *c = GetCompany(_local_company); const Company *c = GetCompany(_local_company);
Money money = min(c->money - c->current_loan, (Money)(atoi(str) / _currency->rate)); Money money = min(c->money - c->current_loan, (Money)(atoi(str) / _currency->rate));

View File

@ -516,6 +516,7 @@ struct NewGRFWindow : public Window {
this->preset = -1; this->preset = -1;
this->SetupNewGRFWindow(); this->SetupNewGRFWindow();
this->SetDirty(); this->SetDirty();
this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
break; break;
} }
@ -558,6 +559,8 @@ struct NewGRFWindow : public Window {
uint i = (pt.y - this->widget[SNGRFS_FILE_LIST].top) / 14 + this->vscroll.pos; uint i = (pt.y - this->widget[SNGRFS_FILE_LIST].top) / 14 + this->vscroll.pos;
for (c = this->list; c != NULL && i > 0; c = c->next, i--) {} for (c = this->list; c != NULL && i > 0; c = c->next, i--) {}
if (this->sel != c) this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
this->sel = c; this->sel = c;
this->SetDirty(); this->SetDirty();

View File

@ -417,12 +417,12 @@ static bool FixTTOEngines()
} }
} }
e->info.climates = 1;
}
e->preview_company_rank = 0; e->preview_company_rank = 0;
e->preview_wait = 0; e->preview_wait = 0;
e->name = NULL; e->name = NULL;
e->info.climates = 1;
}
} }
return true; return true;

View File

@ -1379,7 +1379,7 @@ const SettingDesc _settings[] = {
SDT_CONDBOOL(GameSettings, vehicle.disable_elrails, 38, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_SETTING_DISABLE_ELRAILS, SettingsDisableElrail), SDT_CONDBOOL(GameSettings, vehicle.disable_elrails, 38, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_SETTING_DISABLE_ELRAILS, SettingsDisableElrail),
SDT_CONDVAR(GameSettings, vehicle.freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0,NN, 1, 1, 255, 1, STR_CONFIG_SETTING_FREIGHT_TRAINS, NULL), SDT_CONDVAR(GameSettings, vehicle.freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0,NN, 1, 1, 255, 1, STR_CONFIG_SETTING_FREIGHT_TRAINS, NULL),
SDT_CONDBOOL(GameSettings, order.timetabling, 67, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_SETTING_TIMETABLE_ALLOW, NULL), SDT_CONDBOOL(GameSettings, order.timetabling, 67, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_SETTING_TIMETABLE_ALLOW, NULL),
SDT_CONDVAR(GameSettings, vehicle.plane_speed, SLE_UINT8, 90, SL_MAX_VERSION, 0, 0, 4, 1, 4, 0, STR_CONFIG_SETTING_PLANE_SPEED, NULL), SDT_CONDVAR(GameSettings, vehicle.plane_speed, SLE_UINT8, 90, SL_MAX_VERSION, 0,NN, 4, 1, 4, 0, STR_CONFIG_SETTING_PLANE_SPEED, NULL),
SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines, 95, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_SETTING_DYNAMIC_ENGINES, ChangeDynamicEngines), SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines, 95, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_SETTING_DYNAMIC_ENGINES, ChangeDynamicEngines),
SDT_BOOL(GameSettings, station.join_stations, 0, 0, true, STR_CONFIG_SETTING_JOINSTATIONS, NULL), SDT_BOOL(GameSettings, station.join_stations, 0, 0, true, STR_CONFIG_SETTING_JOINSTATIONS, NULL),

View File

@ -509,12 +509,14 @@ void SetWindowDirty(const Window *w)
/** Find the Window whose parent pointer points to this window /** Find the Window whose parent pointer points to this window
* @param w parent Window to find child of * @param w parent Window to find child of
* @return a Window pointer that is the child of w, or NULL otherwise */ * @param wc Window class of the window to remove; WC_INVALID if class does not matter
static Window *FindChildWindow(const Window *w) * @return a Window pointer that is the child of w, or NULL otherwise
*/
static Window *FindChildWindow(const Window *w, WindowClass wc)
{ {
Window *v; Window *v;
FOR_ALL_WINDOWS_FROM_BACK(v) { FOR_ALL_WINDOWS_FROM_BACK(v) {
if (v->parent == w) return v; if ((wc == WC_INVALID || wc == v->window_class) && v->parent == w) return v;
} }
return NULL; return NULL;
@ -522,13 +524,14 @@ static Window *FindChildWindow(const Window *w)
/** /**
* Delete all children a window might have in a head-recursive manner * Delete all children a window might have in a head-recursive manner
* @param wc Window class of the window to remove; WC_INVALID if class does not matter
*/ */
void Window::DeleteChildWindows() const void Window::DeleteChildWindows(WindowClass wc) const
{ {
Window *child = FindChildWindow(this); Window *child = FindChildWindow(this, wc);
while (child != NULL) { while (child != NULL) {
delete child; delete child;
child = FindChildWindow(this); child = FindChildWindow(this, wc);
} }
} }

View File

@ -380,7 +380,7 @@ public:
void DrawViewport() const; void DrawViewport() const;
void DrawSortButtonState(int widget, SortButtonState state) const; void DrawSortButtonState(int widget, SortButtonState state) const;
void DeleteChildWindows() const; void DeleteChildWindows(WindowClass wc = WC_INVALID) const;
void SetDirty() const; void SetDirty() const;