diff options
| author | Japa | 2011-02-25 04:04:22 +0000 |
|---|---|---|
| committer | Japa | 2011-02-25 04:04:22 +0000 |
| commit | a09db4ce3b65f033257ed8b2c819358d7e7f9e28 (patch) | |
| tree | 61831f82c8efec825291b3d3e1dbe71c5bfa90e1 /ContentBuildingReader.cpp | |
| parent | 82e9e689d9b205286b5088d2407a3a014e7aeb99 (diff) | |
| download | stonesense-a09db4ce3b65f033257ed8b2c819358d7e7f9e28.tar.gz stonesense-a09db4ce3b65f033257ed8b2c819358d7e7f9e28.tar.bz2 stonesense-a09db4ce3b65f033257ed8b2c819358d7e7f9e28.tar.xz | |
Got custom workshops to, well... work.
Diffstat (limited to 'ContentBuildingReader.cpp')
| -rw-r--r-- | ContentBuildingReader.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/ContentBuildingReader.cpp b/ContentBuildingReader.cpp index a69e19a..c89b6a1 100644 --- a/ContentBuildingReader.cpp +++ b/ContentBuildingReader.cpp @@ -251,7 +251,7 @@ bool parseSpriteNode(SpriteNode* node, TiXmlElement* elemParent) contentError("Empty SpriteNode Element",elemParent);
return false;
}
- if ( strcmp(strParent,"building") != 0 && strcmp(strParent,"rotate") != 0)
+ if ( strcmp(strParent,"building") != 0 && strcmp(strParent,"custom_workshop") != 0 && strcmp(strParent,"rotate") != 0)
{
//flag to allow else statements to be empty, rather than needing an "always" tag
bool allowBlank = (strcmp(strParent,"else") == 0 || elemParent->Attribute("else"));
@@ -302,6 +302,36 @@ bool addSingleBuildingConfig( TiXmlElement* elemRoot, vector<BuildingConfigurat return true;
}
+bool addSingleCustomBuildingConfig( TiXmlElement* elemRoot, vector<BuildingConfiguration>* knownBuildings ){
+ const char* strName = elemRoot->Attribute("name");
+ const char* strGameID = elemRoot->Attribute("gameID");
+
+ if (strName == NULL || strGameID == NULL || strName[0] == 0 || strGameID[0] == 0)
+ {
+ contentError("<building> node must have name and gameID attributes",elemRoot);
+ return false;
+ }
+
+ int gameID = TranslateBuildingName(strGameID, contentLoader.custom_workshop_types );
+
+ if (gameID == INVALID_INDEX) {
+ return false;
+ }
+
+ BuildingConfiguration building(strName, gameID );
+ RootBlock* spriteroot = new RootBlock();
+ building.sprites = spriteroot;
+ if (!parseSpriteNode(spriteroot,elemRoot))
+ {
+ delete(spriteroot);
+ return false;
+ }
+
+ //add a copy of 'building' to known buildings
+ knownBuildings->push_back( building );
+ return true;
+}
+
void flushBuildingConfig( vector<BuildingConfiguration>* knownBuildings )
{
// clean up building data trees before deleting them
|
