diff --git a/src/include/interface.h b/src/include/interface.h index e2d36896b..2e19f0246 100644 --- a/src/include/interface.h +++ b/src/include/interface.h @@ -10,7 +10,7 @@ // /**@name interface.h - The user interface header file. */ // -// (c) Copyright 1998-2002 by Lutz Sammer +// (c) Copyright 1998-2003 by Lutz Sammer // // FreeCraft is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -403,6 +403,8 @@ extern int ButtonCheckUnitsOr(const Unit*,const ButtonAction*); extern int ButtonCheckUnitsAnd(const Unit*,const ButtonAction*); /// Check if have network play extern int ButtonCheckNetwork(const Unit*,const ButtonAction*); + /// Check if don't have network play +extern int ButtonCheckNoNetwork(const Unit*,const ButtonAction*); /// Check if unit isn't working (train,upgrade,research) extern int ButtonCheckNoWork(const Unit*,const ButtonAction*); /// Check if unit isn't researching or upgrading diff --git a/src/ui/button_checks.cpp b/src/ui/button_checks.cpp index 459f78f64..8867f4d27 100644 --- a/src/ui/button_checks.cpp +++ b/src/ui/button_checks.cpp @@ -10,7 +10,7 @@ // /**@name button_checks.c - The button checks. */ // -// (c) Copyright 1999-2001 by Lutz Sammer, Vladi Belperchinov-Shabanski +// (c) Copyright 1999-2003 by Lutz Sammer, Vladi Belperchinov-Shabanski // // FreeCraft is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -156,6 +156,20 @@ global int ButtonCheckNetwork(const Unit* unit __attribute__((unused)),const But return NetworkFildes!=-1; } +/** +** Check if network play is disabled. +** +** @param unit Pointer to unit for button. +** @param button Pointer to button to check/enable. +** @return True if disabled. +** +** NOTE: this check could also be moved into intialisation. +*/ +global int ButtonCheckNoNetwork(const Unit* unit __attribute__((unused)),const ButtonAction* button __attribute__((unused))) +{ + return NetworkFildes==-1; +} + /** ** Check for button enabled, if the unit isn't working. ** Working is training, upgrading, researching. diff --git a/src/ui/script_ui.cpp b/src/ui/script_ui.cpp index 8bdf3f110..2f2dd41a5 100644 --- a/src/ui/script_ui.cpp +++ b/src/ui/script_ui.cpp @@ -10,7 +10,7 @@ // /**@name ccl_ui.c - The ui ccl functions. */ // -// (c) Copyright 1999-2002 by Lutz Sammer +// (c) Copyright 1999-2003 by Lutz Sammer // // FreeCraft is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published @@ -3160,6 +3160,8 @@ local SCM CclDefineButton(SCM list) ba.Allowed=ButtonCheckUnitsAnd; } else if( gh_eq_p(value,gh_symbol2scm("check-network")) ) { ba.Allowed=ButtonCheckNetwork; + } else if( gh_eq_p(value,gh_symbol2scm("check-no-network")) ) { + ba.Allowed=ButtonCheckNoNetwork; } else if( gh_eq_p(value,gh_symbol2scm("check-no-work")) ) { ba.Allowed=ButtonCheckNoWork; } else if( gh_eq_p(value,gh_symbol2scm("check-no-research")) ) {