summaryrefslogtreecommitdiff
path: root/rail_gui.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-12 00:19:34 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-12 00:19:34 +0000
commitff8223150aa28b1dfec8d1697d27d6aa96c18f93 (patch)
treee5f727d749b6f788bedbdaeef17fab347dbfefbb /rail_gui.c
parentb1075ca7a43ea39cddf4ec4406f99bb5aa37a113 (diff)
downloadopenttd-ff8223150aa28b1dfec8d1697d27d6aa96c18f93.tar.xz
(svn r3167) - NewGRF: Start moving custom station code to separate files.
Rewrite handling of station classes. Allow for more than 8 station tile layouts. Start of code to unload custom stations.
Diffstat (limited to 'rail_gui.c')
-rw-r--r--rail_gui.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/rail_gui.c b/rail_gui.c
index 8fee0cfbd..668e797ff 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -127,7 +127,7 @@ static void PlaceRail_Depot(TileIndex tile)
static void PlaceRail_Waypoint(TileIndex tile)
{
if (!_remove_button_clicked) {
- DoCommandP(tile, (_waypoint_count > 0) ? (0x100 + _cur_waypoint_type) : 0, 0, CcPlaySound1E, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT));
+ DoCommandP(tile, _cur_waypoint_type, 0, CcPlaySound1E, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT));
} else {
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT));
}
@@ -257,9 +257,9 @@ static void BuildRailClick_Depot(Window *w)
static void BuildRailClick_Waypoint(Window *w)
{
- _waypoint_count = GetCustomStationsCount(STAT_CLASS_WAYP);
+ _waypoint_count = GetNumCustomStations(STAT_CLASS_WAYP);
if (HandlePlacePushButton(w, 11, SPR_CURSOR_WAYPOINT, 1, PlaceRail_Waypoint)
- && _waypoint_count > 0)
+ && _waypoint_count > 1)
ShowBuildWaypointPicker();
}
@@ -829,14 +829,14 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
case WE_PAINT: {
+ int i;
w->click_state = (1 << 3) << (_cur_waypoint_type - w->hscroll.pos);
DrawWindowWidgets(w);
- if(w->hscroll.pos + 0 <= _waypoint_count) DrawWaypointSprite(2, 25, w->hscroll.pos + 0, _cur_railtype);
- if(w->hscroll.pos + 1 <= _waypoint_count) DrawWaypointSprite(70, 25, w->hscroll.pos + 1, _cur_railtype);
- if(w->hscroll.pos + 2 <= _waypoint_count) DrawWaypointSprite(138, 25, w->hscroll.pos + 2, _cur_railtype);
- if(w->hscroll.pos + 3 <= _waypoint_count) DrawWaypointSprite(206, 25, w->hscroll.pos + 3, _cur_railtype);
- if(w->hscroll.pos + 4 <= _waypoint_count) DrawWaypointSprite(274, 25, w->hscroll.pos + 4, _cur_railtype);
+ for (i = 0; i < 5; i++)
+ if(w->hscroll.pos + i < _waypoint_count)
+ DrawWaypointSprite(2 + i * 68, 25, w->hscroll.pos + i, _cur_railtype);
+
break;
}
case WE_CLICK: {
@@ -889,7 +889,7 @@ static void ShowBuildWaypointPicker(void)
{
Window *w = AllocateWindowDesc(&_build_waypoint_desc);
w->hscroll.cap = 5;
- w->hscroll.count = _waypoint_count + 1;
+ w->hscroll.count = _waypoint_count;
}