#include <src/Enum/Prerequisites.h>
List of all members.
Public Types |
typedef DynamicVectorClass
< BuildingTypeClass * > | BTypeList |
Static Public Member Functions |
static void | Parse (CCINIClass *pINI, const char *section, const char *key, DynamicVectorClass< int > *vec) |
static bool | HouseOwnsGeneric (HouseClass *pHouse, signed int Index) |
static bool | HouseOwnsSpecific (HouseClass *pHouse, signed int Index) |
static bool | HouseOwnsPrereq (HouseClass *pHouse, signed int Index) |
static bool | HouseOwnsAll (HouseClass *pHouse, DynamicVectorClass< int > *list) |
static bool | HouseOwnsAny (HouseClass *pHouse, DynamicVectorClass< int > *list) |
static bool | ListContainsGeneric (BTypeList *List, signed int Index) |
static bool | ListContainsSpecific (BTypeList *List, signed int Index) |
static bool | ListContainsPrereq (BTypeList *List, signed int Index) |
static bool | ListContainsAll (BTypeList *List, DynamicVectorClass< int > *Requirements) |
static bool | ListContainsAny (BTypeList *List, DynamicVectorClass< int > *Requirements) |
Member Typedef Documentation
Member Function Documentation
bool Prereqs::HouseOwnsAll |
( |
HouseClass * |
pHouse, |
|
|
DynamicVectorClass< int > * |
list |
|
) |
| [static] |
{
for(int i = 0; i < list->Count; ++i) {
if(!HouseOwnsPrereq(pHouse, list->GetItem(i))) {
return false;
}
}
return true;
}
bool Prereqs::HouseOwnsAny |
( |
HouseClass * |
pHouse, |
|
|
DynamicVectorClass< int > * |
list |
|
) |
| [static] |
{
for(int i = 0; i < list->Count; ++i) {
if(HouseOwnsPrereq(pHouse, list->GetItem(i))) {
return true;
}
}
return false;
}
bool Prereqs::HouseOwnsGeneric |
( |
HouseClass * |
pHouse, |
|
|
signed int |
Index |
|
) |
| [static] |
{
Index = - 1 - Index;
if(Index < GenericPrerequisite::Array.Count) {
DynamicVectorClass<int> *dvc = &GenericPrerequisite::Array.GetItem(Index)->Prereqs;
for(int i = 0; i < dvc->Count; ++i) {
if(HouseOwnsSpecific(pHouse, dvc->GetItem(i))) {
return true;
}
}
if(Index == 5) {
if(UnitTypeClass *ProcAlt = RulesClass::Instance->PrerequisiteProcAlternate) {
if(pHouse->OwnedUnitTypes.GetItemCount(ProcAlt->GetArrayIndex())) {
return true;
}
}
}
return false;
}
return false;
}
bool Prereqs::HouseOwnsPrereq |
( |
HouseClass * |
pHouse, |
|
|
signed int |
Index |
|
) |
| [static] |
bool Prereqs::HouseOwnsSpecific |
( |
HouseClass * |
pHouse, |
|
|
signed int |
Index |
|
) |
| [static] |
{
BuildingTypeClass *BType = BuildingTypeClass::Array->GetItem(Index);
char *powerup = BType->PowersUpBuilding;
if(*powerup) {
BuildingTypeClass *BCore = BuildingTypeClass::Find(powerup);
if(pHouse->OwnedBuildingTypes1.GetItemCount(BCore->GetArrayIndex()) < 1) {
return false;
}
for(int i = 0; i < pHouse->Buildings.Count; ++i) {
BuildingClass *Bld = pHouse->Buildings.GetItem(i);
if(Bld->Type != BCore) {
continue;
}
for(int j = 0; j < 3; ++j) {
BuildingTypeClass *Upgrade = Bld->Upgrades[j];
if(Upgrade == BType) {
return true;
}
}
}
return false;
} else {
return pHouse->OwnedBuildingTypes1.GetItemCount(Index) > 0;
}
}
bool Prereqs::ListContainsAll |
( |
BTypeList * |
List, |
|
|
DynamicVectorClass< int > * |
Requirements |
|
) |
| [static] |
{
for(int i = 0; i < Requirements->Count; ++i) {
if(!ListContainsPrereq(List, Requirements->GetItem(i))) {
return false;
}
}
return true;
}
bool Prereqs::ListContainsAny |
( |
BTypeList * |
List, |
|
|
DynamicVectorClass< int > * |
Requirements |
|
) |
| [static] |
{
for(int i = 0; i < Requirements->Count; ++i) {
if(ListContainsPrereq(List, Requirements->GetItem(i))) {
return true;
}
}
return false;
}
bool Prereqs::ListContainsGeneric |
( |
BTypeList * |
List, |
|
|
signed int |
Index |
|
) |
| [static] |
bool Prereqs::ListContainsPrereq |
( |
BTypeList * |
List, |
|
|
signed int |
Index |
|
) |
| [static] |
bool Prereqs::ListContainsSpecific |
( |
BTypeList * |
List, |
|
|
signed int |
Index |
|
) |
| [static] |
{
BuildingTypeClass * Target = BuildingTypeClass::Array->GetItem(Index);
return List->FindItemIndex(&Target) != -1;
}
void Prereqs::Parse |
( |
CCINIClass * |
pINI, |
|
|
const char * |
section, |
|
|
const char * |
key, |
|
|
DynamicVectorClass< int > * |
vec |
|
) |
| [static] |
{
if(pINI->ReadString(section, key, "", Ares::readBuffer, Ares::readLength)) {
vec->Clear();
for(char *cur = strtok(Ares::readBuffer, ","); cur; cur = strtok(NULL, ",")) {
int idx = BuildingTypeClass::FindIndex(cur);
if(idx > -1) {
vec->AddItem(idx);
} else {
idx = GenericPrerequisite::FindIndex(cur);
if(idx > -1) {
vec->AddItem(-1 - idx);
} else {
Debug::INIParseFailed(section, key, cur);
}
}
}
}
}
The documentation for this class was generated from the following files: