MCPcopy Create free account
hub / github.com/Warzone2100/warzone2100 / getModuleStat

Function getModuleStat

src/structure.cpp:5456–5473  ·  view source on GitHub ↗

for a given structure, return a pointer to its module stat */

Source from the content-addressed store, hash-verified

5454
5455/*for a given structure, return a pointer to its module stat */
5456STRUCTURE_STATS *getModuleStat(const STRUCTURE *psStruct)
5457{
5458 ASSERT_OR_RETURN(nullptr, psStruct != nullptr, "Invalid structure pointer");
5459
5460 switch (psStruct->pStructureType->type)
5461 {
5462 case REF_POWER_GEN:
5463 return &asStructureStats[powerModuleStat];
5464 case REF_FACTORY:
5465 case REF_VTOL_FACTORY:
5466 return &asStructureStats[factoryModuleStat];
5467 case REF_RESEARCH:
5468 return &asStructureStats[researchModuleStat];
5469 default:
5470 //no other structures can have modules attached
5471 return nullptr;
5472 }
5473}
5474
5475/**
5476 * Count the artillery and VTOL droids assigned to a structure.

Callers 8

structureTotalReturnFunction · 0.85
structure.cppFile · 0.85
loadWzMapStructureFunction · 0.85
loadSaveStructure2Function · 0.85
orderDroidBaseFunction · 0.85
highestQueuedModuleFunction · 0.85
renderBuildOrderFunction · 0.85

Calls 1

ASSERT_OR_RETURNFunction · 0.85

Tested by

no test coverage detected