diff options
author | frosch <frosch@openttd.org> | 2010-06-13 14:58:14 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-06-13 14:58:14 +0000 |
commit | 717d13494788840791e37a4ea9e39bd1ab39e84f (patch) | |
tree | f73baa8143fb7460807c0bc62a89c4d3d675b802 /src | |
parent | 58f2a1d014066ab0746ee0d384ada406d2ddbb6d (diff) | |
download | openttd-717d13494788840791e37a4ea9e39bd1ab39e84f.tar.xz |
(svn r19986) -Fix (r19841): One could add and remove Grfs from the list via doubleclicking even if editing the list is not allowed.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_gui.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index a3e6b5261..20c07bddf 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -444,7 +444,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { break; case SNGRFS_MOVE_UP: { // Move GRF up - if (this->active_sel == NULL) break; + if (this->active_sel == NULL || !this->editable) break; int pos = 0; for (GRFConfig **pc = &this->actives; *pc != NULL; pc = &(*pc)->next, pos++) { @@ -463,7 +463,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { } case SNGRFS_MOVE_DOWN: { // Move GRF down - if (this->active_sel == NULL) break; + if (this->active_sel == NULL || !this->editable) break; int pos = 1; // Start at 1 as we swap the selected newgrf with the next one for (GRFConfig **pc = &this->actives; *pc != NULL; pc = &(*pc)->next, pos++) { @@ -498,7 +498,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { } /* Fall through with double click. */ case SNGRFS_REMOVE: { // Remove GRF - if (this->active_sel == NULL) break; + if (this->active_sel == NULL || !this->editable) break; /* Choose the next GRF file to be the selected file. */ GRFConfig *newsel = this->active_sel->next; @@ -539,7 +539,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { } /* Fall through with double click. */ case SNGRFS_ADD: { - if (this->avail_sel == NULL) break; + if (this->avail_sel == NULL || !this->editable) break; GRFConfig **list; /* Find last entry in the list, checking for duplicate grfid on the way */ @@ -566,6 +566,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { } case SNGRFS_APPLY_CHANGES: // Apply changes made to GRF list + if (!this->editable) break; if (this->execute) { ShowQuery( STR_NEWGRF_POPUP_CAUTION_CAPTION, @@ -582,7 +583,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { break; case SNGRFS_SET_PARAMETERS: { // Edit parameters - if (this->active_sel == NULL) break; + if (this->active_sel == NULL || !this->editable || !this->show_params) break; this->query_widget = widget; static char buff[512]; @@ -593,7 +594,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { } case SNGRFS_TOGGLE_PALETTE: - if (this->active_sel != NULL) { + if (this->active_sel != NULL || !this->editable) { this->active_sel->windows_paletted ^= true; this->SetDirty(); } @@ -637,6 +638,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { virtual void OnDropdownSelect(int widget, int index) { + if (!this->editable) return; if (index == -1) { ClearGRFConfigList(&this->actives); this->preset = -1; @@ -677,7 +679,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { break; case SNGRFS_SET_PARAMETERS: { - if (this->active_sel == NULL) return; + if (this->active_sel == NULL || !this->editable || !this->show_params) return; /* Parse our new "int list" */ GRFConfig *c = this->active_sel; |