src/settings_gui.cpp
branchgamebalance
changeset 9912 1ac8aac92385
parent 9911 0b8b245a2391
child 9913 e79cd19772dd
equal deleted inserted replaced
9911:0b8b245a2391 9912:1ac8aac92385
    64 	while (--num>=0) *p++ = base++;
    64 	while (--num>=0) *p++ = base++;
    65 	*p = INVALID_STRING_ID;
    65 	*p = INVALID_STRING_ID;
    66 	return buf;
    66 	return buf;
    67 }
    67 }
    68 
    68 
       
    69 static StringID _town_names[SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 2] = {STR_NULL};
       
    70 
       
    71 void SortTownGeneratorNames()
       
    72 {
       
    73 	int nb_town_names = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1;
       
    74 	/* Init the strings */
       
    75 	if (_town_names[0] == STR_NULL) {
       
    76 		for (int i = 0; i < nb_town_names; i++) _town_names[i] = STR_TOWNNAME_ORIGINAL_ENGLISH + i;
       
    77 		_town_names[nb_town_names] = INVALID_STRING_ID;
       
    78 	}
       
    79 
       
    80 	/* Sort the strings */
       
    81 	qsort(&_town_names[0], nb_town_names, sizeof(StringID), &StringIDSorter);
       
    82 }
       
    83 
    69 static int GetCurRes()
    84 static int GetCurRes()
    70 {
    85 {
    71 	int i;
    86 	int i;
    72 
    87 
    73 	for (i = 0; i != _num_resolutions; i++) {
    88 	for (i = 0; i != _num_resolutions; i++) {
   134 				i = (-1) ^ (1 << _opt_ptr->road_side); // disable the other value
   149 				i = (-1) ^ (1 << _opt_ptr->road_side); // disable the other value
   135 
   150 
   136 			ShowDropDownMenu(w, _driveside_dropdown, _opt_ptr->road_side, 11, i, 0);
   151 			ShowDropDownMenu(w, _driveside_dropdown, _opt_ptr->road_side, 11, i, 0);
   137 		} return;
   152 		} return;
   138 		case 13: case 14: { /* Setup townname dropdown */
   153 		case 13: case 14: { /* Setup townname dropdown */
   139 			int i = _opt_ptr->town_name;
   154 			uint sel = 0;
   140 			ShowDropDownMenu(w, BuildDynamicDropdown(STR_TOWNNAME_ORIGINAL_ENGLISH, SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1), i, 14, (_game_mode == GM_MENU) ? 0 : (-1) ^ (1 << i), 0);
   155 			for (uint i = 0; i < lengthof(_town_names) - 1; i++) {
       
   156 				if (_town_names[i] == STR_TOWNNAME_ORIGINAL_ENGLISH + _opt_ptr->town_name) {
       
   157 					sel = i;
       
   158 					break;
       
   159 				}
       
   160 			}
       
   161 			ShowDropDownMenu(w, _town_names, sel, 14, (_game_mode == GM_MENU) ? 0 : (-1) ^ (1 << sel), 0);
   141 			return;
   162 			return;
   142 		}
   163 		}
   143 		case 16: case 17: /* Setup autosave dropdown */
   164 		case 16: case 17: /* Setup autosave dropdown */
   144 			ShowDropDownMenu(w, _autosave_dropdown, _opt_ptr->autosave, 17, 0, 0);
   165 			ShowDropDownMenu(w, _autosave_dropdown, _opt_ptr->autosave, 17, 0, 0);
   145 			return;
   166 			return;
   191 				MarkWholeScreenDirty();
   212 				MarkWholeScreenDirty();
   192 			}
   213 			}
   193 			break;
   214 			break;
   194 		case 14: /* Town names */
   215 		case 14: /* Town names */
   195 			if (_game_mode == GM_MENU) {
   216 			if (_game_mode == GM_MENU) {
   196 				_opt_ptr->town_name = e->we.dropdown.index;
   217 				_opt_ptr->town_name = _town_names[e->we.dropdown.index] - STR_TOWNNAME_ORIGINAL_ENGLISH;
   197 				InvalidateWindow(WC_GAME_OPTIONS, 0);
   218 				InvalidateWindow(WC_GAME_OPTIONS, 0);
   198 			}
   219 			}
   199 			break;
   220 			break;
   200 		case 17: /* Autosave options */
   221 		case 17: /* Autosave options */
   201 			_opt.autosave = _opt_newgame.autosave = e->we.dropdown.index;
   222 			_opt.autosave = _opt_newgame.autosave = e->we.dropdown.index;
   585 	"vehicle_speed",
   606 	"vehicle_speed",
   586 	"status_long_date",
   607 	"status_long_date",
   587 	"show_finances",
   608 	"show_finances",
   588 	"autoscroll",
   609 	"autoscroll",
   589 	"reverse_scroll",
   610 	"reverse_scroll",
       
   611 	"smooth_scroll",
   590 	"errmsg_duration",
   612 	"errmsg_duration",
   591 	"toolbar_pos",
   613 	"toolbar_pos",
   592 	"measure_tooltip",
   614 	"measure_tooltip",
   593 	"window_snap_radius",
   615 	"window_snap_radius",
   594 	"invisible_trees",
   616 	"invisible_trees",
   627 	"station_spread",
   649 	"station_spread",
   628 	"serviceathelipad",
   650 	"serviceathelipad",
   629 	"modified_catchment",
   651 	"modified_catchment",
   630 	"gradual_loading",
   652 	"gradual_loading",
   631 	"road_stop_on_town_road",
   653 	"road_stop_on_town_road",
       
   654 	"adjacent_stations",
   632 };
   655 };
   633 
   656 
   634 static const char *_patches_economy[] = {
   657 static const char *_patches_economy[] = {
   635 	"inflation",
   658 	"inflation",
   636 	"build_rawmaterial_ind",
   659 	"build_rawmaterial_ind",