void InitClassMap(FClassMap &themap, SpawnMap &thedata) { themap.Clear(); SpawnMap::Iterator it(thedata); SpawnMap::Pair *pair; int error = 0; while (it.NextPair(pair)) { PClassActor *cls = NULL; if (pair->Value.classname != NAME_None) { cls = PClass::FindActor(pair->Value.classname); if (cls == NULL) { Printf(TEXTCOLOR_RED "Script error, \"%s\" line %d:\nUnknown actor class %s\n", pair->Value.filename.GetChars(), pair->Value.linenum, pair->Value.classname.GetChars()); error++; } themap.Insert(pair->Key, cls); } else { themap.Remove(pair->Key); } } if (error > 0) { I_Error("%d unknown actor classes found", error); } thedata.Clear(); // we do not need this any longer }
PClassActor *P_GetSpawnableType(int spawnnum) { if (spawnnum < 0) { // A named arg from a UDMF map FName spawnname = FName(ENamedName(-spawnnum)); if (spawnname.IsValidName()) { return PClass::FindActor(spawnname); } } else { // A numbered arg from a Hexen or UDMF map PClassActor **type = SpawnableThings.CheckKey(spawnnum); if (type != NULL) { return *type; } } return NULL; }
static void DumpClassMap(FClassMap &themap) { FClassMap::Iterator it(themap); FClassMap::Pair *pair, **allpairs; int i = 0; // Sort into numerical order, since their arrangement in the map can // be in an unspecified order. allpairs = new FClassMap::Pair *[themap.CountUsed()]; while (it.NextPair(pair)) { allpairs[i++] = pair; } qsort(allpairs, i, sizeof(*allpairs), SpawnableSort); for (int j = 0; j < i; ++j) { pair = allpairs[j]; Printf ("%d %s\n", pair->Key, pair->Value->TypeName.GetChars()); } delete[] allpairs; }
const PClass *GetStrifeType (int typenum) { const PClass **ptype = StrifeTypes.CheckKey(typenum); if (ptype == NULL) return NULL; else return *ptype; }
void ClearStrifeTypes() { StrifeTypes.Clear(); }
PClassActor *GetStrifeType (int typenum) { PClassActor **ptype = StrifeTypes.CheckKey(typenum); if (ptype == NULL) return NULL; else return *ptype; }