(svn r1435) Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode

This commit is contained in:
dominik 2005-01-08 20:55:21 +00:00
parent 4b6a846d9c
commit bfc670b4d9
5 changed files with 6 additions and 0 deletions

View File

@ -126,6 +126,7 @@ static const WindowDesc _air_toolbar_desc = {
void ShowBuildAirToolbar()
{
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
AllocateWindowDescFront(&_air_toolbar_desc, 0);
}

View File

@ -204,6 +204,7 @@ static const WindowDesc _build_docks_toolbar_desc = {
void ShowBuildDocksToolbar()
{
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
AllocateWindowDesc(&_build_docks_toolbar_desc);
}

View File

@ -803,6 +803,8 @@ void ShowBuildRailToolbar(int index, int button)
{
Window *w;
if (_current_player == OWNER_SPECTATOR) 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);

View File

@ -304,6 +304,7 @@ static const WindowDesc _build_road_desc = {
void ShowBuildRoadToolbar()
{
if (_current_player == OWNER_SPECTATOR) return;
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
AllocateWindowDesc(&_build_road_desc);
}

View File

@ -211,5 +211,6 @@ static const WindowDesc _terraform_desc = {
void ShowTerraformToolbar()
{
if (_current_player == OWNER_SPECTATOR) return;
AllocateWindowDescFront(&_terraform_desc, 0);
}