File diff r2624:1fa34b183518 → r2625:27ad3b929a5b
rail_gui.c
Show inline comments
 
@@ -124,13 +124,13 @@ static void PlaceRail_Depot(TileIndex ti
 
		CMD_BUILD_TRAIN_DEPOT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_100E_CAN_T_BUILD_TRAIN_DEPOT));
 
}
 

	
 
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));
 
	}
 
}
 

	
 
void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
@@ -254,15 +254,15 @@ static void BuildRailClick_Depot(Window 
 
		ShowBuildTrainDepotPicker();
 
	}
 
}
 

	
 
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();
 
}
 

	
 
static void BuildRailClick_Station(Window *w)
 
{
 
	if (HandlePlacePushButton(w, 12, SPR_CURSOR_RAIL_STATION, 1, PlaceRail_Station)) ShowStationBuilder();
 
@@ -826,20 +826,20 @@ static void ShowBuildTrainDepotPicker(vo
 

	
 

	
 
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: {
 
		switch (e->click.widget) {
 
		case 3: case 4: case 5: case 6: case 7:
 
			_cur_waypoint_type = e->click.widget - 3 + w->hscroll.pos;
 
@@ -886,13 +886,13 @@ static const WindowDesc _build_waypoint_
 
};
 

	
 
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;
 
}
 

	
 

	
 
void InitializeRailGui(void)
 
{
 
	_build_depot_direction = 3;