src/settings_gui.cpp
changeset 10407 419a41009c38
parent 10358 e18487e907f4
equal deleted inserted replaced
10406:a929a9e55ce9 10407:419a41009c38
   132 	/* Add and sort newgrf townnames generators */
   132 	/* Add and sort newgrf townnames generators */
   133 	for (int i = 0; i < _nb_grf_names; i++) townnames[_grf_names[i]] = _nb_orig_names + i;
   133 	for (int i = 0; i < _nb_grf_names; i++) townnames[_grf_names[i]] = _nb_orig_names + i;
   134 
   134 
   135 	DropDownList *list = new DropDownList();
   135 	DropDownList *list = new DropDownList();
   136 	for (TownList::iterator it = townnames.begin(); it != townnames.end(); it++) {
   136 	for (TownList::iterator it = townnames.begin(); it != townnames.end(); it++) {
   137 		list->push_back(new DropDownListStringItem((*it).first, (*it).second, !(_game_mode == GM_MENU || (*it).second == sel)));
   137 		list->push_back(new DropDownListStringItem((*it).first, (*it).second, !(_game_mode == GM_MENU || GetNumTowns() == 0 || (*it).second == sel)));
   138 	}
   138 	}
   139 
   139 
   140 	ShowDropDownList(w, list, sel, GAMEOPT_TOWNNAME_BTN);
   140 	ShowDropDownList(w, list, sel, GAMEOPT_TOWNNAME_BTN);
   141 }
   141 }
   142 
   142 
   281 					MarkWholeScreenDirty();
   281 					MarkWholeScreenDirty();
   282 				}
   282 				}
   283 				break;
   283 				break;
   284 
   284 
   285 			case GAMEOPT_TOWNNAME_BTN: // Town names
   285 			case GAMEOPT_TOWNNAME_BTN: // Town names
   286 				if (_game_mode == GM_MENU) {
   286 				if (_game_mode == GM_MENU || GetNumTowns() == 0) {
   287 					this->opt->game_creation.town_name = index;
   287 					this->opt->game_creation.town_name = index;
   288 					InvalidateWindow(WC_GAME_OPTIONS, 0);
   288 					InvalidateWindow(WC_GAME_OPTIONS, 0);
   289 				}
   289 				}
   290 				break;
   290 				break;
   291 
   291