diff --git a/src/droid.c b/src/droid.c index 301eaf85f..a1508bc8d 100644 --- a/src/droid.c +++ b/src/droid.c @@ -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; diff --git a/src/droid.h b/src/droid.h index 9d8306a3a..2666e46cd 100644 --- a/src/droid.h +++ b/src/droid.h @@ -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*/ diff --git a/src/order.c b/src/order.c index b3d2c4cf4..560a75ea4 100644 --- a/src/order.c +++ b/src/order.c @@ -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; }