File diff r6955:42f59093f6f9 → r6956:6398843f1341
src/newgrf_gui.cpp
Show inline comments
 
@@ -304,18 +304,18 @@ static void NewGRFConfirmationCallback(W
 
{
 
	if (confirmed) {
 
		newgrf_d *nd = &WP(w, newgrf_d);
 
		GRFConfig *c;
 
		int i = 0;
 

	
 
		CopyGRFConfigList(nd->orig_list, *nd->list);
 
		CopyGRFConfigList(nd->orig_list, *nd->list, false);
 
		ReloadNewGRFData();
 

	
 
		/* Show new, updated list */
 
		for (c = *nd->list; c != NULL && c != nd->sel; c = c->next, i++);
 
		CopyGRFConfigList(nd->list, *nd->orig_list);
 
		CopyGRFConfigList(nd->list, *nd->orig_list, false);
 
		for (c = *nd->list; c != NULL && i > 0; c = c->next, i--);
 
		nd->sel = c;
 

	
 
		SetWindowDirty(w);
 
	}
 
}
 
@@ -466,13 +466,15 @@ static void NewGRFWndProc(Window *w, Win
 
							STR_POPUP_CAUTION_CAPTION,
 
							STR_NEWGRF_CONFIRMATION_TEXT,
 
							w,
 
							NewGRFConfirmationCallback
 
						);
 
					} else {
 
						CopyGRFConfigList(WP(w, newgrf_d).orig_list, *WP(w, newgrf_d).list);
 
						CopyGRFConfigList(WP(w, newgrf_d).orig_list, *WP(w, newgrf_d).list, true);
 
						ResetGRFConfig(false);
 
						ReloadNewGRFData();
 
					}
 
					break;
 

	
 
				case SNGRFS_SET_PARAMETERS: { // Edit parameters
 
					char buff[512];
 
					if (WP(w, newgrf_d).sel == NULL) break;
 
@@ -495,13 +497,15 @@ static void NewGRFWndProc(Window *w, Win
 
			}
 
			SetWindowDirty(w);
 
			break;
 

	
 
		case WE_DESTROY:
 
			if (!WP(w, newgrf_d).execute) {
 
				CopyGRFConfigList(WP(w, newgrf_d).orig_list, *WP(w, newgrf_d).list);
 
				CopyGRFConfigList(WP(w, newgrf_d).orig_list, *WP(w, newgrf_d).list, true);
 
				ResetGRFConfig(false);
 
				ReloadNewGRFData();
 
			}
 
			/* Remove the temporary copy of grf-list used in window */
 
			ClearGRFConfigList(WP(w, newgrf_d).list);
 
			break;
 

	
 
		case WE_RESIZE:
 
@@ -562,13 +566,13 @@ void ShowNewGRFSettings(bool editable, b
 

	
 
	DeleteWindowByClass(WC_GAME_OPTIONS);
 
	w = AllocateWindowDesc(&_newgrf_desc);
 
	if (w == NULL) return;
 

	
 
	w->resize.step_height = 14;
 
	CopyGRFConfigList(&local, *config);
 
	CopyGRFConfigList(&local, *config, false);
 

	
 
	/* Clear selections */
 
	WP(w, newgrf_d).sel         = NULL;
 
	WP(w, newgrf_d).list        = &local;
 
	WP(w, newgrf_d).orig_list   = config;
 
	WP(w, newgrf_d).editable    = editable;