summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJapa Illo2012-03-26 23:19:43 +0200
committerJapa Illo2012-03-26 23:19:43 +0200
commit07ddc8c13e0bb38cde77937803e9320e2b26f2d9 (patch)
treecd2af61c7780ce69ae20c62112e28808384a053f
parent4d146bbbba642b08465d8ee275612f29bfbbe7ed (diff)
parentf854810fb76a6c83a9ccd3a50f526963b5c85b90 (diff)
downloadstonesense-07ddc8c13e0bb38cde77937803e9320e2b26f2d9.tar.gz
stonesense-07ddc8c13e0bb38cde77937803e9320e2b26f2d9.tar.bz2
stonesense-07ddc8c13e0bb38cde77937803e9320e2b26f2d9.tar.xz
Merge branch 'master' of git://github.com/peterix/stonesense
-rw-r--r--BlockCondition.cpp12
-rw-r--r--ContentLoader.cpp10
-rw-r--r--MapLoading.cpp13
-rw-r--r--SpriteObjects.cpp7
4 files changed, 19 insertions, 23 deletions
diff --git a/BlockCondition.cpp b/BlockCondition.cpp
index 918108f..4d45845 100644
--- a/BlockCondition.cpp
+++ b/BlockCondition.cpp
@@ -32,14 +32,10 @@ int getDirectionFromString(const char* strDir)
int getBuildingFromString(const char* strType)
{
- FOR_ENUM_ITEMS(building_type,i)
- {
- if (strcmp(strType,ENUM_KEY_STR(building_type,i).c_str()) == 0)
- {
- return i;
- }
- }
- return INVALID_INDEX;
+ df::building_type item;
+ if (find_enum_item(&item, strType))
+ return (int)item;
+ return INVALID_INDEX;
}
NeighbourWallCondition::NeighbourWallCondition(const char* strDir)
diff --git a/ContentLoader.cpp b/ContentLoader.cpp
index 6a57118..9d4197e 100644
--- a/ContentLoader.cpp
+++ b/ContentLoader.cpp
@@ -503,15 +503,15 @@ const char *lookupBuildingSubtype(int main_type, int i)
switch (main_type)
{
case building_type::Furnace:
- return ENUM_KEY_STR(furnace_type,(furnace_type::furnace_type)i).c_str();
+ return enum_item_key_str((df::furnace_type)i);
case building_type::Construction:
- return ENUM_KEY_STR(construction_type,(construction_type::construction_type)i).c_str();
+ return enum_item_key_str((df::construction_type)i);
case building_type::SiegeEngine:
- return ENUM_KEY_STR(siegeengine_type,(siegeengine_type::siegeengine_type)i).c_str();
+ return enum_item_key_str((df::siegeengine_type)i);
case building_type::Shop:
- return ENUM_KEY_STR(shop_type,(shop_type::shop_type)i).c_str();
+ return enum_item_key_str((df::shop_type)i);
case building_type::Workshop:
- return ENUM_KEY_STR(workshop_type,(workshop_type::workshop_type)i).c_str();
+ return enum_item_key_str((df::workshop_type)i);
default:
return "NA";
}
diff --git a/MapLoading.cpp b/MapLoading.cpp
index 1581d6a..19ab329 100644
--- a/MapLoading.cpp
+++ b/MapLoading.cpp
@@ -351,13 +351,12 @@ void ReadCellToSegment(DFHack::Core& DF, WorldSegment& segment, int CellX, int C
b->water.index = trueBlock->designation[lx][ly].bits.flow_size;
}
- //read tiletype
- b->tileType = trueBlock->tiletype[lx][ly];
- b->tileShape = ENUM_ATTR(tiletype, shape, b->tileType);//tiletype::get_shape(b->tileType);
- b->tileShapeBasic = ENUM_ATTR(tiletype_shape, basic_shape, b->tileShape);
- b->tileSpecial = ENUM_ATTR(tiletype, special, b->tileType);
- b->tileMaterial = ENUM_ATTR(tiletype, material, b->tileType);
-
+ //read tiletype
+ b->tileType = trueBlock->tiletype[lx][ly];
+ b->tileShape = tileShape(b->tileType);
+ b->tileShapeBasic = tileShapeBasic(b->tileShape);
+ b->tileSpecial = tileSpecial(b->tileType);
+ b->tileMaterial = tileMaterial(b->tileType);
//142,136,15
//if(b->x == 142 && b->y == 136 && b->z == 15)
diff --git a/SpriteObjects.cpp b/SpriteObjects.cpp
index ff5af5e..794ab1b 100644
--- a/SpriteObjects.cpp
+++ b/SpriteObjects.cpp
@@ -494,10 +494,11 @@ void c_sprite::set_by_xml(TiXmlElement *elemSprite)
{
itemtype = INVALID_INDEX;
}
- else for(int index=ENUM_FIRST_ITEM(item_type); index <= ENUM_LAST_ITEM(item_type); index++)
+ else
{
- if(strcmp(equiptypestr, ENUM_KEY_STR(item_type, (item_type::item_type)index).c_str()) == 0)
- itemtype = index;
+ df::item_type index;
+ if (find_enum_item(&index, equiptypestr))
+ itemtype = (int)index;
}
const char* equipsindexstr = elemSprite->Attribute("equipment_name");