Added check-no-network

This commit is contained in:
jsalmon3 2003-02-17 19:53:12 +00:00
parent 1b5072c8c3
commit 77285c84d7
3 changed files with 21 additions and 3 deletions

View file

@ -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

View file

@ -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.

View file

@ -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")) ) {