This commit is contained in:
Daveo 2001-05-23 16:03:10 +00:00
parent e7a4db50cc
commit e25fb0eee2
7 changed files with 123 additions and 7 deletions

View file

@ -75,13 +75,55 @@ void CMkLevelLayerThing::ProcessList(CMkLevel *Core)
{
int i,ListSize=ThingList.size();
CIni &Config=Core->GetConfig();
int KeyCount=Config.GetKeyCount(GetTypeName());
vector<int> Counts;
Counts.resize(KeyCount);
for (i=0;i<KeyCount;i++)
{
Counts[i]=0;
}
for (i=0; i<ListSize; i++)
{
sMkLevelLayerThing &ThisThing=ThingList[i];
bool Found=Config.GetInt(GetTypeName(),ThisThing.Name,ThisThing.Type);
Counts[ThisThing.Type]++;
if (!Found)
GObject::Error(ERR_FATAL,"%s not found in list\n",ThisThing.Name);
}
// Create Inf Data
for (i=0; i<KeyCount; i++)
{
GString OutName="TOTAL_";
char *Name=Config.GetKeyName(GetTypeName(),i);
OutName+=GetTypeName();
OutName+="_";
OutName+=Name;
Core->AddInfItem(OutName,Counts[i]);
}
}
/*****************************************************************************/
int CMkLevelLayerThing::CountThing(CMkLevel *Core,const char *Name)
{
int i,ListSize=ThingList.size();
int Count=0;
for (i=0; i<ListSize; i++)
{
sMkLevelLayerThing &ThisThing=ThingList[i];
if (ThisThing.Name=Name)
{
Count++;
}
}
return(Count);
}

View file

@ -32,6 +32,7 @@ virtual const char *GetTypeName()=0;
virtual void PreProcess(CMkLevel *Core)=0;
virtual void Process(CMkLevel *Core)=0;
virtual int Write(FILE *File,const char *LayerName,const char *MapName)=0;
int CountThing(CMkLevel *Core,const char *Name);
protected:
u8 *LoadThing(sMkLevelLayerThing &ThisThing,u8 *Ptr);