[Gcblue-commits] gcb_wx/src/sim tcStores.cpp,1.12,1.13
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-09-06 01:28:23
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14752/src/sim Modified Files: tcStores.cpp Log Message: Index: tcStores.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcStores.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcStores.cpp 5 Sep 2006 01:04:25 -0000 1.12 --- tcStores.cpp 6 Sep 2006 01:28:20 -0000 1.13 *************** *** 1225,1228 **** --- 1225,1230 ---- } + obj->SetLoadoutTag(type); + return true; } *************** *** 1285,1288 **** --- 1287,1292 ---- } + obj->SetLoadoutTag("Empty"); + return true; } *************** *** 1349,1352 **** --- 1353,1394 ---- } + /** + * @return bitwise OR of all target flags from weapons available in stores that + * are compatible with child's launchers + */ + int tcStores::GetAvailableTargetFlags(tcGameObject* child) + { + tcPlatformObject* obj = dynamic_cast<tcPlatformObject*>(GetChildOrParent(child)); + + // check that magazine is accessible (child hasn't taken off yet) + if (obj == 0) return 0; + + size_t nLaunchers = obj->GetLauncherCount(); + + int netTargetFlags = 0; + + for (size_t n=0; n<nLaunchers; n++) + { + tcLauncher* launcher = obj->GetLauncher(n); + + size_t nTypes = launcher->GetCompatibleCount(); + for (size_t k=0; k<nTypes; k++) + { + std::string type = launcher->GetCompatibleName(k); + size_t quantity = CurrentItemQuantity(type); + if (quantity > 0) + { + float range_km; + int targetFlags; + GetWeaponInfo(type, range_km, targetFlags); + + netTargetFlags |= targetFlags; + } + } + } + + return netTargetFlags; + } + /** |