From 2449b800106a3c2b7b08e28c832615f0e31c0260 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 21 Jan 2012 17:18:53 +0400 Subject: [PATCH 1/2] Update to match the data definitions. --- .../df/custom/coord2d_path.methods.inc | 20 +++++++++++++++++++ .../include/df/custom/coord_path.methods.inc | 16 ++++++++++++++- .../df/custom/inorganic_raw.methods.inc | 0 .../include/df/custom/material.methods.inc | 0 library/modules/Maps.cpp | 2 +- library/xml | 2 +- 6 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 library/include/df/custom/coord2d_path.methods.inc create mode 100644 library/include/df/custom/inorganic_raw.methods.inc create mode 100644 library/include/df/custom/material.methods.inc diff --git a/library/include/df/custom/coord2d_path.methods.inc b/library/include/df/custom/coord2d_path.methods.inc new file mode 100644 index 000000000..c36c5c0fa --- /dev/null +++ b/library/include/df/custom/coord2d_path.methods.inc @@ -0,0 +1,20 @@ +unsigned size() const { return x.size(); } + +coord2d operator[] (unsigned idx) const { + if (idx >= x.size()) + return coord2d(); + else + return coord2d(x[idx], y[idx]); +} + +void erase(unsigned idx) { + if (idx < x.size()) { + x.erase(x.begin()+idx); + y.erase(y.begin()+idx); + } +} + +void push_back(const coord2d &crd) { + x.push_back(crd.x); + y.push_back(crd.y); +} diff --git a/library/include/df/custom/coord_path.methods.inc b/library/include/df/custom/coord_path.methods.inc index d3c48de7f..9acebb82a 100644 --- a/library/include/df/custom/coord_path.methods.inc +++ b/library/include/df/custom/coord_path.methods.inc @@ -1,8 +1,22 @@ unsigned size() const { return x.size(); } coord operator[] (unsigned idx) const { - if (idx >= x.size() || idx >= y.size() || idx >= z.size()) + if (idx >= x.size()) return coord(); else return coord(x[idx], y[idx], z[idx]); } + +void erase(unsigned idx) { + if (idx < x.size()) { + x.erase(x.begin()+idx); + y.erase(y.begin()+idx); + z.erase(z.begin()+idx); + } +} + +void push_back(const coord &crd) { + x.push_back(crd.x); + y.push_back(crd.y); + z.push_back(crd.z); +} diff --git a/library/include/df/custom/inorganic_raw.methods.inc b/library/include/df/custom/inorganic_raw.methods.inc new file mode 100644 index 000000000..e69de29bb diff --git a/library/include/df/custom/material.methods.inc b/library/include/df/custom/material.methods.inc new file mode 100644 index 000000000..e69de29bb diff --git a/library/modules/Maps.cpp b/library/modules/Maps.cpp index ec70c8d0a..1b4661004 100644 --- a/library/modules/Maps.cpp +++ b/library/modules/Maps.cpp @@ -567,7 +567,7 @@ bool Maps::ReadGeology (vector < vector >& assign) if (bioRY >= world->world_data->world_height) bioRY = world->world_data->world_height - 1; // get index into geoblock vector - uint16_t geoindex = world->world_data->unk_1c0[bioRX][bioRY].geo_index; + uint16_t geoindex = world->world_data->region_map[bioRX][bioRY].geo_index; /// geology blocks have a vector of layer descriptors // get the vector with pointer to layers diff --git a/library/xml b/library/xml index 8f9f7cf3b..f6d09c951 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 8f9f7cf3bc4cff3dc721dc9e0ba51bc54b069587 +Subproject commit f6d09c95153150d7d1f00592336012af5e6e02ad From b0cda1526e8e447a60fe4507e8e5edfbe225e99e Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 21 Jan 2012 18:50:44 +0400 Subject: [PATCH 2/2] Adjust FOR_ENUM_ITEMS to account for ENUM_LAST_ITEM being inclusive now. --- library/include/DataDefs.h | 2 +- library/xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/include/DataDefs.h b/library/include/DataDefs.h index 80f722e05..1e72e9a1f 100644 --- a/library/include/DataDefs.h +++ b/library/include/DataDefs.h @@ -235,7 +235,7 @@ namespace df #define ENUM_NEXT_ITEM(enum,val) \ (DFHack::next_enum_item_(val)) #define FOR_ENUM_ITEMS(enum,iter) \ - for(df::enum iter = ENUM_FIRST_ITEM(enum); iter < ENUM_LAST_ITEM(enum); iter = df::enum(1+int(iter))) + for(df::enum iter = ENUM_FIRST_ITEM(enum); iter <= ENUM_LAST_ITEM(enum); iter = df::enum(1+int(iter))) namespace df { #define DF_KNOWN_GLOBALS \ diff --git a/library/xml b/library/xml index f6d09c951..0b23a6e28 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit f6d09c95153150d7d1f00592336012af5e6e02ad +Subproject commit 0b23a6e28b72f8383647b317635d9b75a69529e0