mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-31 03:12:41 +00:00
(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:
parent
072270f9b9
commit
7b6e449f15
@ -1799,6 +1799,7 @@ detect_os() {
|
||||
/cygwin/ { print "CYGWIN"; exit}
|
||||
/mingw/ { print "MINGW"; exit}
|
||||
/os\/2/ { print "OS2"; exit}
|
||||
/gnu/ { print "UNIX"; exit}
|
||||
'`
|
||||
fi
|
||||
|
||||
|
@ -61,6 +61,7 @@ void HandleOnEditText(const char *str)
|
||||
switch (_rename_what) {
|
||||
#ifdef ENABLE_NETWORK
|
||||
case 3: { // Give money, you can only give money in excess of loan
|
||||
if (!IsValidCompanyID(_local_company)) break;
|
||||
const Company *c = GetCompany(_local_company);
|
||||
Money money = min(c->money - c->current_loan, (Money)(atoi(str) / _currency->rate));
|
||||
|
||||
|
@ -516,6 +516,7 @@ struct NewGRFWindow : public Window {
|
||||
this->preset = -1;
|
||||
this->SetupNewGRFWindow();
|
||||
this->SetDirty();
|
||||
this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
break;
|
||||
}
|
||||
|
||||
@ -558,6 +559,8 @@ struct NewGRFWindow : public Window {
|
||||
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--) {}
|
||||
|
||||
if (this->sel != c) this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
|
||||
this->sel = c;
|
||||
|
||||
this->SetDirty();
|
||||
|
@ -336,7 +336,7 @@ static bool FixTTOEngines()
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 44, 45, 46, 255, 255, 255, 255, 47, 48, 255, 49, 50,
|
||||
255, 255, 255, 255, 51, 52, 255, 53, 54, 255, 55, 56, 255, 57, 58, 255,
|
||||
59, 60, 255,61, 62, 255, 63, 64, 255, 65, 66, 255, 255, 255, 255, 255,
|
||||
59, 60, 255, 61, 62, 255, 63, 64, 255, 65, 66, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 67, 68, 69, 70,
|
||||
@ -417,12 +417,12 @@ static bool FixTTOEngines()
|
||||
}
|
||||
}
|
||||
|
||||
e->preview_company_rank = 0;
|
||||
e->preview_wait = 0;
|
||||
e->name = NULL;
|
||||
|
||||
e->info.climates = 1;
|
||||
}
|
||||
|
||||
e->preview_company_rank = 0;
|
||||
e->preview_wait = 0;
|
||||
e->name = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -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_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_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_BOOL(GameSettings, station.join_stations, 0, 0, true, STR_CONFIG_SETTING_JOINSTATIONS, NULL),
|
||||
|
@ -509,12 +509,14 @@ void SetWindowDirty(const Window *w)
|
||||
|
||||
/** Find the Window whose parent pointer points to this window
|
||||
* @param w parent Window to find child of
|
||||
* @return a Window pointer that is the child of w, or NULL otherwise */
|
||||
static Window *FindChildWindow(const Window *w)
|
||||
* @param wc Window class of the window to remove; WC_INVALID if class does not matter
|
||||
* @return a Window pointer that is the child of w, or NULL otherwise
|
||||
*/
|
||||
static Window *FindChildWindow(const Window *w, WindowClass wc)
|
||||
{
|
||||
Window *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;
|
||||
@ -522,13 +524,14 @@ static Window *FindChildWindow(const Window *w)
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
delete child;
|
||||
child = FindChildWindow(this);
|
||||
child = FindChildWindow(this, wc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ public:
|
||||
void DrawViewport() const;
|
||||
void DrawSortButtonState(int widget, SortButtonState state) const;
|
||||
|
||||
void DeleteChildWindows() const;
|
||||
void DeleteChildWindows(WindowClass wc = WC_INVALID) const;
|
||||
|
||||
void SetDirty() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user