Changeset - r9080:069681a7c2ba
[Not reviewed]
master
0 5 0
rubidium - 16 years ago 2008-05-04 09:39:16
rubidium@openttd.org
(svn r12939) -Codechange: do not use the window proc to determine whether a toolbar is a rail toolbar, but use the window number.
5 files changed with 17 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -136,14 +136,14 @@ static const WindowDesc _air_toolbar_des
 
};
 

	
 
void ShowBuildAirToolbar()
 
{
 
	if (!IsValidPlayer(_current_player)) return;
 

	
 
	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
 
	Window *w = AllocateWindowDescFront(&_air_toolbar_desc, 0);
 
	DeleteWindowByClass(WC_BUILD_TOOLBAR);
 
	Window *w = AllocateWindowDescFront(&_air_toolbar_desc, TRANSPORT_AIR);
 
	if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
 
}
 

	
 
enum {
 
	BAW_BOTTOMPANEL = 10,
 
	BAW_SMALL_AIRPORT,
src/dock_gui.cpp
Show inline comments
 
@@ -229,14 +229,14 @@ static const WindowDesc _build_docks_too
 
};
 

	
 
void ShowBuildDocksToolbar()
 
{
 
	if (!IsValidPlayer(_current_player)) return;
 

	
 
	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
 
	Window *w = AllocateWindowDesc(&_build_docks_toolbar_desc);
 
	DeleteWindowByClass(WC_BUILD_TOOLBAR);
 
	Window *w = AllocateWindowDescFront(&_build_docks_toolbar_desc, TRANSPORT_WATER);
 
	if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
 
}
 

	
 
static void BuildDockStationWndProc(Window *w, WindowEvent *e)
 
{
 
	switch (e->event) {
src/openttd.h
Show inline comments
 
@@ -53,15 +53,16 @@ enum TransportType {
 
	 * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
 
	 * In an ideal world, these constants would be used everywhere when
 
	 * accessing tunnels and bridges. For now, you should just not change
 
	 * the values for road and rail.
 
	 */
 
	TRANSPORT_BEGIN = 0,
 
	TRANSPORT_RAIL = 0,
 
	TRANSPORT_ROAD = 1,
 
	TRANSPORT_WATER, // = 2
 
	TRANSPORT_RAIL = TRANSPORT_BEGIN,
 
	TRANSPORT_ROAD,
 
	TRANSPORT_WATER,
 
	TRANSPORT_AIR,
 
	TRANSPORT_END,
 
	INVALID_TRANSPORT = 0xff,
 
};
 

	
 
/* Display Options */
 
enum {
src/rail_gui.cpp
Show inline comments
 
@@ -745,16 +745,16 @@ void ShowBuildRailToolbar(RailType railt
 
	Window *w;
 

	
 
	if (!IsValidPlayer(_current_player)) return;
 
	if (!ValParamRailtype(railtype)) return;
 

	
 
	// don't recreate the window if we're clicking on a button and the window exists.
 
	if (button < 0 || !(w = FindWindowById(WC_BUILD_TOOLBAR, 0)) || w->wndproc != BuildRailToolbWndProc) {
 
		DeleteWindowById(WC_BUILD_TOOLBAR, 0);
 
	if (button < 0 || !(w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL))) {
 
		DeleteWindowByClass(WC_BUILD_TOOLBAR);
 
		_cur_railtype = railtype;
 
		w = AllocateWindowDesc(&_build_rail_desc);
 
		w = AllocateWindowDescFront(&_build_rail_desc, TRANSPORT_RAIL);
 
		SetupRailToolbar(railtype, w);
 
	}
 

	
 
	_remove_button_clicked = false;
 
	if (w != NULL && button >= RTW_CLOSEBOX) {
 
		_build_railroad_button_proc[button](w);
 
@@ -1594,14 +1594,14 @@ void InitializeRailGui()
 
void ReinitGuiAfterToggleElrail(bool disable)
 
{
 
	extern RailType _last_built_railtype;
 
	if (disable && _last_built_railtype == RAILTYPE_ELECTRIC) {
 
		Window *w;
 
		_last_built_railtype = _cur_railtype = RAILTYPE_RAIL;
 
		w = FindWindowById(WC_BUILD_TOOLBAR, 0);
 
		if (w != NULL && w->wndproc == BuildRailToolbWndProc) {
 
		w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL);
 
		if (w != NULL) {
 
			SetupRailToolbar(_cur_railtype, w);
 
			SetWindowDirty(w);
 
		}
 
	}
 
	MarkWholeScreenDirty();
 
}
 
@@ -1645,14 +1645,14 @@ static void SetDefaultRailGui()
 
			default:
 
				break;
 
		}
 
	}
 

	
 
	_last_built_railtype = _cur_railtype = rt;
 
	Window *w = FindWindowById(WC_BUILD_TOOLBAR, 0);
 
	if (w != NULL && w->wndproc == BuildRailToolbWndProc) {
 
	Window *w = FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL);
 
	if (w != NULL) {
 
		SetupRailToolbar(_cur_railtype, w);
 
		SetWindowDirty(w);
 
	}
 
}
 

	
 
/**
src/road_gui.cpp
Show inline comments
 
@@ -679,14 +679,14 @@ static const WindowDesc _build_tramway_d
 

	
 
void ShowBuildRoadToolbar(RoadType roadtype)
 
{
 
	if (!IsValidPlayer(_current_player)) return;
 
	_cur_roadtype = roadtype;
 

	
 
	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
 
	Window *w = AllocateWindowDesc(roadtype == ROADTYPE_ROAD ? &_build_road_desc : &_build_tramway_desc);
 
	DeleteWindowByClass(WC_BUILD_TOOLBAR);
 
	Window *w = AllocateWindowDescFront(roadtype == ROADTYPE_ROAD ? &_build_road_desc : &_build_tramway_desc, TRANSPORT_ROAD);
 
	if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w);
 
}
 

	
 
/** Widget definition of the build road toolbar in the scenario editor */
 
static const Widget _build_road_scen_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,     7,     0,    10,     0,    13, STR_00C5,                   STR_018B_CLOSE_WINDOW},            // RTW_CLOSEBOX
0 comments (0 inline, 0 general)