Merge branch 'master' into jgrpp

# Conflicts:
#	src/fios_gui.cpp
#	src/lang/english.txt
#	src/lang/german.txt
This commit is contained in:
Jonathan G Rennison
2019-02-02 01:27:56 +00:00
103 changed files with 957 additions and 491 deletions

View File

@@ -727,7 +727,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
GRFConfig *d = new GRFConfig(*a);
d->next = (*c)->next;
d->CopyParams(**c);
if (this->active_sel == *c) this->active_sel = NULL;
if (this->active_sel == *c) {
DeleteWindowByClass(WC_GRF_PARAMETERS);
DeleteWindowByClass(WC_TEXTFILE);
this->active_sel = NULL;
}
delete *c;
*c = d;
iter->second = d;
@@ -1024,7 +1028,10 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
GRFConfig *c;
for (c = this->actives; c != NULL && i > 0; c = c->next, i--) {}
if (this->active_sel != c) DeleteWindowByClass(WC_GRF_PARAMETERS);
if (this->active_sel != c) {
DeleteWindowByClass(WC_GRF_PARAMETERS);
DeleteWindowByClass(WC_TEXTFILE);
}
this->active_sel = c;
this->avail_sel = NULL;
this->avail_pos = -1;
@@ -1041,6 +1048,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
case WID_NS_REMOVE: { // Remove GRF
if (this->active_sel == NULL || !this->editable) break;
DeleteWindowByClass(WC_GRF_PARAMETERS);
DeleteWindowByClass(WC_TEXTFILE);
/* Choose the next GRF file to be the selected file. */
GRFConfig *newsel = this->active_sel->next;
@@ -1082,6 +1090,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
this->active_sel = NULL;
DeleteWindowByClass(WC_GRF_PARAMETERS);
if (i < this->avails.Length()) {
if (this->avail_sel != this->avails[i]) DeleteWindowByClass(WC_TEXTFILE);
this->avail_sel = this->avails[i];
this->avail_pos = i;
}
@@ -1155,11 +1164,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
virtual void OnNewGRFsScanned()
{
if (this->active_sel == NULL) DeleteWindowByClass(WC_TEXTFILE);
this->avail_sel = NULL;
this->avail_pos = -1;
this->avails.ForceRebuild();
this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
this->DeleteChildWindows(WC_TEXTFILE); // Remove the view textfile window
}
virtual void OnDropdownSelect(int widget, int index)
@@ -1176,6 +1185,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
ResetObjectToPlace();
DeleteWindowByClass(WC_GRF_PARAMETERS);
DeleteWindowByClass(WC_TEXTFILE);
this->active_sel = NULL;
this->InvalidateData(GOID_NEWGRF_PRESET_LOADED);
}
@@ -1224,7 +1234,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
*l = new GRFConfig(*f);
(*l)->next = c->next;
if (active_sel == c) active_sel = *l;
if (this->active_sel == c) this->active_sel = *l;
delete c;
}
@@ -1350,6 +1360,9 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
if (this->avails.Length() == 0) this->avail_pos = -1;
if (this->avail_pos >= 0) {
this->active_sel = NULL;
DeleteWindowByClass(WC_GRF_PARAMETERS);
if (this->avail_sel != this->avails[this->avail_pos]) DeleteWindowByClass(WC_TEXTFILE);
this->avail_sel = this->avails[this->avail_pos];
this->vscroll2->ScrollTowards(this->avail_pos);
this->InvalidateData(0);
@@ -1512,6 +1525,8 @@ private:
{
if (this->avail_sel == NULL || !this->editable || HasBit(this->avail_sel->flags, GCF_INVALID)) return false;
DeleteWindowByClass(WC_TEXTFILE);
uint count = 0;
GRFConfig **entry = NULL;
GRFConfig **list;
@@ -1971,6 +1986,7 @@ static void NewGRFConfirmationCallback(Window *w, bool confirmed)
{
if (confirmed) {
DeleteWindowByClass(WC_GRF_PARAMETERS);
DeleteWindowByClass(WC_TEXTFILE);
NewGRFWindow *nw = dynamic_cast<NewGRFWindow*>(w);
GamelogStartAction(GLAT_GRF);