(svn r11859) -Codechange: Update newgrf station class dropdown to use new method of generating list.

This commit is contained in:
peter1138
2008-01-15 10:36:51 +00:00
parent 327ea90331
commit b4d476b7d1
3 changed files with 14 additions and 21 deletions

View File

@@ -27,6 +27,7 @@
#include "sound_func.h"
#include "player_func.h"
#include "settings_type.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "bridge_map.h"
@@ -774,6 +775,18 @@ static void CheckSelectedSize(Window *w, const StationSpec *statspec)
}
}
static DropDownList *BuildStationClassDropDown()
{
DropDownList *list = new DropDownList();
for (uint i = 0; i < GetNumStationClasses(); i++) {
if (i == STAT_CLASS_WAYP) continue;
list->push_back(new DropDownListStringItem(GetStationClassName((StationClassID)i), i, false));
}
return list;
}
static void StationBuildWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
@@ -992,7 +1005,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
case BRSW_NEWST_DROPDOWN:
case BRSW_NEWST_DROPDOWN_TEXT:
ShowDropDownMenu(w, BuildStationClassDropdown(), _railstation.station_class, 23, 0, 1 << STAT_CLASS_WAYP);
ShowDropDownList(w, BuildStationClassDropDown(), _railstation.station_class, BRSW_NEWST_DROPDOWN_TEXT);
break;
case BRSW_NEWST_LIST: {