openttd updated to 1.5.0-beta2
--HG-- branch : openttd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: road_gui.cpp 25854 2013-10-12 22:45:19Z zuu $ */
|
||||
/* $Id: road_gui.cpp 27163 2015-02-22 15:26:27Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -28,11 +28,14 @@
|
||||
#include "company_base.h"
|
||||
#include "hotkeys.h"
|
||||
#include "road_gui.h"
|
||||
#include "zoom_func.h"
|
||||
|
||||
#include "widgets/road_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
static void ShowRVStationPicker(Window *parent, RoadStopType rs);
|
||||
static void ShowRoadDepotPicker(Window *parent);
|
||||
|
||||
@@ -63,7 +66,7 @@ static DiagDirection _road_station_picker_orientation;
|
||||
|
||||
void CcPlaySound1D(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile);
|
||||
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +96,7 @@ static void PlaceRoad_Bridge(TileIndex tile, Window *w)
|
||||
void CcBuildRoadTunnel(const CommandCost &result, TileIndex start_tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (result.Succeeded()) {
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_SPLAT_2, start_tile);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, start_tile);
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
|
||||
DiagDirection start_direction = ReverseDiagDir(GetTunnelBridgeDirection(start_tile));
|
||||
@@ -174,7 +177,7 @@ void CcRoadDepot(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2
|
||||
if (result.Failed()) return;
|
||||
|
||||
DiagDirection dir = (DiagDirection)GB(p1, 0, 2);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
ConnectRoadToStructure(tile, dir);
|
||||
}
|
||||
@@ -198,7 +201,7 @@ void CcRoadStop(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
|
||||
if (result.Failed()) return;
|
||||
|
||||
DiagDirection dir = (DiagDirection)GB(p2, 6, 2);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
TileArea roadstop_area(tile, GB(p1, 0, 8), GB(p1, 8, 8));
|
||||
TILE_AREA_LOOP(cur_tile, roadstop_area) {
|
||||
@@ -335,11 +338,18 @@ struct BuildRoadToolbarWindow : Window {
|
||||
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_ROAD),
|
||||
|
||||
bool can_build = CanBuildVehicleInfrastructure(VEH_ROAD);
|
||||
this->SetWidgetsDisabledState(!can_build,
|
||||
WID_ROT_DEPOT,
|
||||
WID_ROT_BUS_STATION,
|
||||
WID_ROT_TRUCK_STATION,
|
||||
WIDGET_LIST_END);
|
||||
if (!can_build) {
|
||||
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
|
||||
DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
|
||||
DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -838,7 +848,7 @@ static WindowDesc _build_road_scen_desc(
|
||||
|
||||
/**
|
||||
* Show the road building toolbar in the scenario editor.
|
||||
* @return The just opened toolbar.
|
||||
* @return The just opened toolbar, or \c NULL if the toolbar was already open.
|
||||
*/
|
||||
Window *ShowBuildRoadScenToolbar()
|
||||
{
|
||||
@@ -860,11 +870,19 @@ struct BuildRoadDepotWindow : public PickerWindowBase {
|
||||
this->FinishInitNested(TRANSPORT_ROAD);
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BROD_DEPOT_NE, WID_BROD_DEPOT_NW + 1)) return;
|
||||
|
||||
size->width = ScaleGUITrad(64) + 2;
|
||||
size->height = ScaleGUITrad(48) + 2;
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BROD_DEPOT_NE, WID_BROD_DEPOT_NW + 1)) return;
|
||||
|
||||
DrawRoadDepotSprite(r.left - 1, r.top, (DiagDirection)(widget - WID_BROD_DEPOT_NE + DIAGDIR_NE), _cur_roadtype);
|
||||
DrawRoadDepotSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), (DiagDirection)(widget - WID_BROD_DEPOT_NE + DIAGDIR_NE), _cur_roadtype);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
@@ -988,12 +1006,20 @@ struct BuildRoadStationWindow : public PickerWindowBase {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return;
|
||||
|
||||
size->width = ScaleGUITrad(64) + 2;
|
||||
size->height = ScaleGUITrad(48) + 2;
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
{
|
||||
if (!IsInsideMM(widget, WID_BROS_STATION_NE, WID_BROS_STATION_Y + 1)) return;
|
||||
|
||||
StationType st = (this->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK;
|
||||
StationPickerDrawSprite(r.left + TILE_PIXELS, r.bottom - TILE_PIXELS, st, INVALID_RAILTYPE, widget < WID_BROS_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - WID_BROS_STATION_NE);
|
||||
StationPickerDrawSprite(r.left + 1 + ScaleGUITrad(31), r.bottom - ScaleGUITrad(31), st, INVALID_RAILTYPE, widget < WID_BROS_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - WID_BROS_STATION_NE);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
|
||||
Reference in New Issue
Block a user