From 5c7788981bc0887b6c1fdeacc3c1af68278e87da Mon Sep 17 00:00:00 2001 From: johns <> Date: Thu, 11 May 2000 07:16:11 +0000 Subject: [PATCH] Building of walls only in network game allowed. --- doc/ChangeLog.html | 1 + src/ui/button_table.cpp | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html index 64b398424..e374113d3 100644 --- a/doc/ChangeLog.html +++ b/doc/ChangeLog.html @@ -490,6 +490,7 @@ <LI>Fixed bug: cancel button, of set pending command didn't work. <LI>Made fancy building configurable. <LI>Fixed bug: New network code, did not call win32 init. + <LI>Building of walls only in network game allowed. <LI>+++ </UL> diff --git a/src/ui/button_table.cpp b/src/ui/button_table.cpp index 9760e4822..4a30cc6de 100644 --- a/src/ui/button_table.cpp +++ b/src/ui/button_table.cpp @@ -28,6 +28,7 @@ #include "upgrade.h" #include "depend.h" #include "interface.h" +#include "network.h" /*---------------------------------------------------------------------------- -- Defines @@ -187,6 +188,17 @@ local int CheckNeedStronghold(const Unit* unit,const ButtonAction* button) || HaveUnitTypeByIdent(unit->Player,"unit-fortress") > 0; } +/** +** Check if network play is enabled. +** Needed for walls, which could only be build in network play. +** +** NOTE: this check could also be moved into intialisation. +*/ +local int CheckNetwork(const Unit* unit,const ButtonAction* button) +{ + return NetworkFildes!=-1; +} + global int bc_NoWork(const Unit* unit,const ButtonAction* button ) { return ( unit->Type && unit->Type->Building @@ -469,10 +481,9 @@ global ButtonAction AllButtons[] = { 't', "BUILD ~!TOWER", WORKERS_H }, -// FIXME: wall only in multiplayer! { 8, 1, { "icon-human-wall" }, B_Build, 0, "unit-human-wall", - NULL, NULL, + CheckNetwork, NULL, 'w', "BUILD ~!WALL", WORKERS_H }, @@ -1214,10 +1225,9 @@ global ButtonAction AllButtons[] = { 't', "BUILD ~!TOWER", WORKERS_O }, -// FIXME: wall only in multiplayer! { 8, 1, { "icon-orc-wall" }, B_Build, 0, "unit-orc-wall", - NULL, NULL, + CheckNetwork, NULL, 'w', "BUILD ~!WALL", WORKERS_O }, @@ -1248,13 +1258,15 @@ global ButtonAction AllButtons[] = { }, { 4, 2, { "icon-goblin-alchemist" }, B_Build, 0, "unit-goblin-alchemist", - CheckNeedStronghold, NULL, + // FIXME: CheckNeedStronghold, NULL, + NULL, NULL, 'a', "BUILD GOBLIN ~!ALCHEMIST", WORKERS_O }, { 5, 2, { "icon-ogre-mound" }, B_Build, 0, "unit-ogre-mound", - CheckNeedStronghold, NULL, + // FIXME: CheckNeedStronghold, NULL, + NULL, NULL, 'o', "BUILD ~!OGRE MOUND", WORKERS_O },