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
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;
UDWORD i=0;
BOOL order = FALSE;
UDWORD i = 0;
// ASSERT( psDroid != NULL,
// "buildModule: Invalid droid pointer" );
ASSERT( psStruct != NULL,
"buildModule: Invalid structure pointer" );
order = FALSE;
switch (psStruct->pStructureType->type)
{
case REF_POWER_GEN:
//check room for one more!
if (psStruct->pFunctionality->powerGenerator.capacity < NUM_POWER_MODULES)
{
/*for (i = 0; (i < numStructureStats) && (asStructureStats[i].type !=
REF_POWER_MODULE);i++)
case REF_POWER_GEN:
//check room for one more!
if (psStruct->pFunctionality->powerGenerator.capacity < NUM_POWER_MODULES)
{
//keep looking for the Power Module stat...
}*/
i = powerModuleStat;
order = TRUE;
}
break;
case REF_FACTORY:
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++)
i = powerModuleStat;
order = TRUE;
}
break;
case REF_FACTORY:
case REF_VTOL_FACTORY:
//check room for one more!
if (psStruct->pFunctionality->factory.capacity < NUM_FACTORY_MODULES)
{
//keep looking for the Factory Module stat...
}*/
i = factoryModuleStat;
order = TRUE;
}
break;
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++)
i = factoryModuleStat;
order = TRUE;
}
break;
case REF_RESEARCH:
//check room for one more!
if (psStruct->pFunctionality->researchFacility.capacity < NUM_RESEARCH_MODULES)
{
//keep looking for the Research Module stat...
}*/
i = researchModuleStat;
order = TRUE;
}
break;
default:
//no other structures can have modules attached
break;
i = researchModuleStat;
order = TRUE;
}
break;
default:
//no other structures can have modules attached
break;
}
if (order)
{
//check availability of Module
// Check availability of Module
if (!((i < numStructureStats) &&
(apStructTypeLists[psDroid->player][i] == AVAILABLE)))
{
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;
@ -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)
{
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
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
- 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;
}
//check if can build a module
else if (buildModule(psDroid, psStruct,TRUE))
else if (buildModule(psStruct))
{
order = DORDER_BUILDMODULE;
}