Fixed bug : No new construction options after upgrade (Patch from Russell Smith)

This commit is contained in:
jsalmon3 2002-11-26 22:18:48 +00:00
parent 097d972f81
commit 24633817d2
5 changed files with 29 additions and 15 deletions

View file

@ -989,6 +989,8 @@
<LI>Fixed bug #581489: GUI - Network refresh (from Jimmy Salmon).
<LI>Fixed bug #643281: Compile errors on Mac OS X 10.2.2 (from
Jimmy Salmon).
<LI>Fixed bug #600046: No new construction options after upgrade (from
Russell Smith).
<LI>+++
</UL>
</UL>

View file

@ -395,10 +395,10 @@ extern int ButtonCheckTrue(const Unit*,const ButtonAction*);
extern int ButtonCheckFalse(const Unit*,const ButtonAction*);
/// Check if allowed upgrade is ready
extern int ButtonCheckUpgrade(const Unit*,const ButtonAction*);
/// Check if allowed unit exists
extern int ButtonCheckUnit(const Unit*,const ButtonAction*);
/// Check if allowed units exists
extern int ButtonCheckUnits(const Unit*,const ButtonAction*);
extern int ButtonCheckUnitsOr(const Unit*,const ButtonAction*);
/// Check if allowed units exists
extern int ButtonCheckUnitsAnd(const Unit*,const ButtonAction*);
/// Check if have network play
extern int ButtonCheckNetwork(const Unit*,const ButtonAction*);
/// Check if unit isn't working (train,upgrade,research)

View file

@ -167,10 +167,10 @@ global void SaveButtons(FILE* file)
fprintf(file,"'check-false");
} else if( UnitButtonTable[i]->Allowed == ButtonCheckUpgrade ) {
fprintf(file,"'check-upgrade");
} else if( UnitButtonTable[i]->Allowed == ButtonCheckUnit ) {
fprintf(file,"'check-unit");
} else if( UnitButtonTable[i]->Allowed == ButtonCheckUnits ) {
fprintf(file,"'check-units");
} else if( UnitButtonTable[i]->Allowed == ButtonCheckUnitsOr ) {
fprintf(file,"'check-units-or");
} else if( UnitButtonTable[i]->Allowed == ButtonCheckUnitsAnd ) {
fprintf(file,"'check-units-and");
} else if( UnitButtonTable[i]->Allowed == ButtonCheckNetwork ) {
fprintf(file,"'check-network");
} else if( UnitButtonTable[i]->Allowed == ButtonCheckNoWork ) {

View file

@ -95,15 +95,27 @@ global int ButtonCheckUpgrade(const Unit* unit,const ButtonAction* button)
}
/**
** Check for button enabled, if unit is available.
** Check for button enabled, if any unit is available.
**
** @param unit Pointer to unit for button.
** @param button Pointer to button to check/enable.
** @return True if enabled.
*/
global int ButtonCheckUnit(const Unit* unit,const ButtonAction* button)
global int ButtonCheckUnitsOr(const Unit* unit,const ButtonAction* button)
{
return HaveUnitTypeByIdent(unit->Player,button->AllowStr);
char* buf;
const char* s;
Player* player;
player=unit->Player;
buf=alloca(strlen(button->AllowStr)+1);
strcpy(buf,button->AllowStr);
for( s=strtok(buf,","); s; s=strtok(NULL,",") ) {
if( HaveUnitTypeByIdent(player,s) ) {
return 1;
}
}
return 0;
}
/**
@ -113,7 +125,7 @@ global int ButtonCheckUnit(const Unit* unit,const ButtonAction* button)
** @param button Pointer to button to check/enable.
** @return True if enabled.
*/
global int ButtonCheckUnits(const Unit* unit,const ButtonAction* button)
global int ButtonCheckUnitsAnd(const Unit* unit,const ButtonAction* button)
{
char* buf;
const char* s;

View file

@ -2994,10 +2994,10 @@ local SCM CclDefineButton(SCM list)
ba.Allowed=ButtonCheckFalse;
} else if( gh_eq_p(value,gh_symbol2scm("check-upgrade")) ) {
ba.Allowed=ButtonCheckUpgrade;
} else if( gh_eq_p(value,gh_symbol2scm("check-unit")) ) {
ba.Allowed=ButtonCheckUnit;
} else if( gh_eq_p(value,gh_symbol2scm("check-units")) ) {
ba.Allowed=ButtonCheckUnits;
} else if( gh_eq_p(value,gh_symbol2scm("check-units-or")) ) {
ba.Allowed=ButtonCheckUnitsOr;
} else if( gh_eq_p(value,gh_symbol2scm("check-units-and")) ) {
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-work")) ) {