diff options
| author | Kris Parker | 2009-11-29 01:23:38 +0000 |
|---|---|---|
| committer | Kris Parker | 2009-11-29 01:23:38 +0000 |
| commit | 07b413e39ccc74e46742105953f150231ff438d5 (patch) | |
| tree | c33dfa4dbe6133f0cc56bcd7a5ecb3f8e3e7b0b9 /CreatureConfiguration.cpp | |
| parent | 29c40340cfa2e54d9e287cbafe91cc0e2771d72f (diff) | |
| download | stonesense-07b413e39ccc74e46742105953f150231ff438d5.tar.gz stonesense-07b413e39ccc74e46742105953f150231ff438d5.tar.bz2 stonesense-07b413e39ccc74e46742105953f150231ff438d5.tar.xz | |
Root element in creature config
Diffstat (limited to 'CreatureConfiguration.cpp')
| -rw-r--r-- | CreatureConfiguration.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/CreatureConfiguration.cpp b/CreatureConfiguration.cpp index d9041e7..6482397 100644 --- a/CreatureConfiguration.cpp +++ b/CreatureConfiguration.cpp @@ -88,12 +88,11 @@ void TranslateCreatureNames(vector<CreatureConfiguration>& configs, vector<t_mat }
-bool addSingleCreatureConfig( TiXmlElement* elemCreature, vector<CreatureConfiguration>* knownCreatures ){
-
+bool addSingleCreatureConfig( TiXmlElement* elemCreature, vector<CreatureConfiguration>* knownCreatures, int basefile ){
const char* name = elemCreature->Attribute("gameID");
const char* sheetIndexStr;
t_SpriteWithOffset sprite;
- sprite.fileIndex=-1;
+ sprite.fileIndex=basefile;
sprite.x=0;
sprite.y=0;
sprite.animFrames=ALL_FRAMES;
@@ -102,7 +101,6 @@ bool addSingleCreatureConfig( TiXmlElement* elemCreature, vector<CreatureConfigu {
sprite.fileIndex = loadImgFile((char*)filename);
}
-
TiXmlElement* elemProfession = elemCreature->FirstChildElement("Profession");
while( elemProfession ){
const char* professionstr = elemProfession->Attribute("name");
@@ -146,3 +144,24 @@ bool addSingleCreatureConfig( TiXmlElement* elemCreature, vector<CreatureConfigu }
return true;
}
+
+bool addCreaturesConfig( TiXmlElement* elemRoot, vector<CreatureConfiguration>* knownCreatures ){
+ int basefile = -1;
+ const char* filename = elemRoot->Attribute("file");
+ if (filename != NULL && filename[0] != 0)
+ {
+ basefile = loadImgFile((char*)filename);
+ }
+ TiXmlElement* elemCreature = elemRoot->FirstChildElement("creature");
+ if (elemCreature == NULL)
+ {
+ contentError("No creatures found",elemRoot);
+ return false;
+ }
+ while( elemCreature ){
+ addSingleCreatureConfig(elemCreature,knownCreatures,basefile );
+ elemCreature = elemCreature->NextSiblingElement("creature");
+ }
+ return true;
+}
+
\ No newline at end of file |
