(svn r3157) - Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars. If enabled, the terraform toolbar will open and close with those toolbars.

This commit is contained in:
peter1138 2005-11-09 07:25:55 +00:00
parent 5e278b7ec3
commit 350f0f2cdb
8 changed files with 25 additions and 0 deletions

View File

@ -107,6 +107,10 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
if (w != 0)
WP(w,def_d).close = true;
break;
case WE_DESTROY:
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
break;
}
}
@ -134,6 +138,7 @@ void ShowBuildAirToolbar(void)
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
AllocateWindowDescFront(&_air_toolbar_desc, 0);
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
}
static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)

View File

@ -180,6 +180,10 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
}
VpSetPresizeRange(tile_from, tile_to);
} break;
case WE_DESTROY:
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
break;
}
}
@ -213,6 +217,7 @@ void ShowBuildDocksToolbar(void)
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
AllocateWindowDesc(&_build_docks_toolbar_desc);
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
}
static void BuildDockStationWndProc(Window *w, WindowEvent *e)

View File

@ -997,6 +997,7 @@ STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Invisib
STR_CONFIG_PATCHES_SNOWLINE_HEIGHT :{LTBLUE}Snow line height: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_STATION_SPREAD :{LTBLUE}Max station spread: {ORANGE}{STRING1} {RED}Warning: High setting slows game
STR_CONFIG_PATCHES_SERVICEATHELIPAD :{LTBLUE}Service helicopters at helipads automatically: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR :{LTBLUE}Link landscape toolbar to rail/road/water/airport toolbars: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}Max trains per player: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_MAX_ROADVEH :{LTBLUE}Max road vehicles per player: {ORANGE}{STRING1}

View File

@ -480,6 +480,10 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
DoCommandByTile(tile, 0, 0, DC_AUTO, CMD_BUILD_TUNNEL);
VpSetPresizeRange(tile, _build_tunnel_endtile==0?tile:_build_tunnel_endtile);
} break;
case WE_DESTROY:
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
break;
}
}
@ -571,6 +575,7 @@ void ShowBuildRailToolbar(RailType railtype, int button)
_remove_button_clicked = false;
if (w != NULL && button >= 0) _build_railroad_button_proc[button](w);
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
}
/* TODO: For custom stations, respect their allowed platforms/lengths bitmasks!

View File

@ -281,6 +281,10 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e) {
VpSetPresizeRange(tile, _build_tunnel_endtile==0?tile:_build_tunnel_endtile);
break;
}
case WE_DESTROY:
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
break;
}
}
@ -315,6 +319,7 @@ void ShowBuildRoadToolbar(void)
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
AllocateWindowDesc(&_build_road_desc);
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
}
static const Widget _build_road_scen_widgets[] = {

View File

@ -853,6 +853,7 @@ static const SettingDesc patch_player_settings[] = {
{"autorenew_money", SDT_INT32, (void*)100000,&_patches.autorenew_money, NULL},
{"population_in_label", SDT_BOOL, (void*)true, &_patches.population_in_label, NULL},
{"link_terraform_toolbar", SDT_BOOL, (void*)false, &_patches.link_terraform_toolbar, NULL},
{NULL, 0, NULL, NULL, NULL}
};

View File

@ -679,6 +679,8 @@ static const PatchEntry _patches_ui[] = {
{PE_INT32, 0, STR_CONFIG_PATCHES_MAP_X, "map_x", &_patches.map_x, 6, 11, 1, NULL},
{PE_INT32, 0, STR_CONFIG_PATCHES_MAP_Y, "map_y", &_patches.map_y, 6, 11, 1, NULL},
{PE_BOOL, PF_PLAYERBASED, STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR, "link_terraform_toolbar", &_patches.link_terraform_toolbar, 0, 1, 1, NULL},
};
static const PatchEntry _patches_construction[] = {

View File

@ -119,6 +119,7 @@ typedef struct Patches {
bool forbid_90_deg; // forbid trains to make 90 deg turns
bool invisible_trees; // don't show trees when buildings are transparent
bool no_servicing_if_no_breakdowns; // dont send vehicles to depot when breakdowns are disabled
bool link_terraform_toolbar; // display terraform toolbar when displaying rail, road, water and airport toolbars
uint8 toolbar_pos; // position of toolbars, 0=left, 1=center, 2=right
uint8 window_snap_radius; // Windows snap at each other if closer than this