Cleanup the buildModule function in droid.c. There should be no functional changes.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4078 4a71c877-e1ca-e34f-864e-861f7616d084
master
Freddie Witherden 2008-03-15 18:27:59 +00:00
parent a80115b63e
commit c473294251
3 changed files with 31 additions and 63 deletions

View File

@ -4496,85 +4496,56 @@ BOOL checkDroidsDemolishing(STRUCTURE *psStructure)
/* checks the structure for type and capacity and **NOT orders the droid*** to build /* checks the structure for type and capacity and **NOT orders the droid*** to build
a module if it can - returns TRUE if order is set */ a module if it can - returns TRUE if order is set */
BOOL buildModule(DROID *psDroid, STRUCTURE *psStruct,BOOL bCheckPower) BOOL buildModule(STRUCTURE *psStruct)
{ {
BOOL order; BOOL order = FALSE;
UDWORD i=0; UDWORD i = 0;
// ASSERT( psDroid != NULL, // ASSERT( psDroid != NULL,
// "buildModule: Invalid droid pointer" ); // "buildModule: Invalid droid pointer" );
ASSERT( psStruct != NULL, ASSERT( psStruct != NULL,
"buildModule: Invalid structure pointer" ); "buildModule: Invalid structure pointer" );
order = FALSE;
switch (psStruct->pStructureType->type) switch (psStruct->pStructureType->type)
{ {
case REF_POWER_GEN: case REF_POWER_GEN:
//check room for one more! //check room for one more!
if (psStruct->pFunctionality->powerGenerator.capacity < NUM_POWER_MODULES) if (psStruct->pFunctionality->powerGenerator.capacity < NUM_POWER_MODULES)
{
/*for (i = 0; (i < numStructureStats) && (asStructureStats[i].type !=
REF_POWER_MODULE);i++)
{ {
//keep looking for the Power Module stat... i = powerModuleStat;
}*/ order = TRUE;
i = powerModuleStat; }
break;
order = TRUE; case REF_FACTORY:
} case REF_VTOL_FACTORY:
break; //check room for one more!
case REF_FACTORY: if (psStruct->pFunctionality->factory.capacity < NUM_FACTORY_MODULES)
case REF_VTOL_FACTORY:
//check room for one more!
if (psStruct->pFunctionality->factory.capacity < NUM_FACTORY_MODULES)
{
/*for (i = 0; (i < numStructureStats) && (asStructureStats[i].type !=
REF_FACTORY_MODULE);i++)
{ {
//keep looking for the Factory Module stat... i = factoryModuleStat;
}*/ order = TRUE;
i = factoryModuleStat; }
break;
order = TRUE; case REF_RESEARCH:
} //check room for one more!
break; if (psStruct->pFunctionality->researchFacility.capacity < NUM_RESEARCH_MODULES)
case REF_RESEARCH:
//check room for one more!
if (psStruct->pFunctionality->researchFacility.capacity < NUM_RESEARCH_MODULES)
{
/*for (i = 0; (i < numStructureStats) && (asStructureStats[i].type !=
REF_RESEARCH_MODULE);i++)
{ {
//keep looking for the Research Module stat... i = researchModuleStat;
}*/ order = TRUE;
i = researchModuleStat; }
break;
order = TRUE; default:
} //no other structures can have modules attached
break; break;
default:
//no other structures can have modules attached
break;
} }
if (order) if (order)
{ {
//check availability of Module // Check availability of Module
if (!((i < numStructureStats) && if (!((i < numStructureStats) &&
(apStructTypeLists[psDroid->player][i] == AVAILABLE))) (apStructTypeLists[psDroid->player][i] == AVAILABLE)))
{ {
order = FALSE; order = FALSE;
} }
//Power is obtained gradually now, so allow order
/*if(bCheckPower)
{
// check enough power to build
if (!checkPower(selectedPlayer, asStructureStats[i].powerToBuild, TRUE))
{
order = FALSE;
}
}*/
} }
return order; return order;
@ -4637,9 +4608,6 @@ void setUpBuildModule(DROID *psDroid)
} }
} }
// We just need 1 buffer for the current displayed droid (or template) name
#define MAXCONNAME WIDG_MAXSTR //(32)
char *getDroidName(DROID *psDroid) char *getDroidName(DROID *psDroid)
{ {
DROID_TEMPLATE sTemplate; DROID_TEMPLATE sTemplate;

View File

@ -289,7 +289,7 @@ extern BOOL checkDroidsDemolishing(STRUCTURE *psStructure);
/* checks the structure for type and capacity and orders the droid to build /* checks the structure for type and capacity and orders the droid to build
a module if it can - returns TRUE if order is set */ a module if it can - returns TRUE if order is set */
extern BOOL buildModule(DROID *psDroid, STRUCTURE *psStruct,BOOL bCheckPower); extern BOOL buildModule(STRUCTURE *psStruct);
/*Deals with building a module - checking if any droid is currently doing this /*Deals with building a module - checking if any droid is currently doing this
- if so, helping to build the current one*/ - if so, helping to build the current one*/

View File

@ -3011,7 +3011,7 @@ DROID_ORDER chooseOrderObj(DROID *psDroid, BASE_OBJECT *psObj)
order = DORDER_REPAIR; order = DORDER_REPAIR;
} }
//check if can build a module //check if can build a module
else if (buildModule(psDroid, psStruct,TRUE)) else if (buildModule(psStruct))
{ {
order = DORDER_BUILDMODULE; order = DORDER_BUILDMODULE;
} }