summaryrefslogtreecommitdiff
path: root/library/include
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-09-06 22:45:19 +0400
committerAlexander Gavrilov2012-09-06 22:45:19 +0400
commitc971a819def1c5cc29dc926f62456c336a1dfa17 (patch)
treea03b4fd14884603b15a5e96609408603c6566b12 /library/include
parentd0e630d4c35717bad682894e33e7dd57f86ac126 (diff)
downloaddfhack-c971a819def1c5cc29dc926f62456c336a1dfa17.tar.gz
dfhack-c971a819def1c5cc29dc926f62456c336a1dfa17.tar.bz2
dfhack-c971a819def1c5cc29dc926f62456c336a1dfa17.tar.xz
Experimental creation of map blocks in gui/liquids script.
Diffstat (limited to 'library/include')
-rw-r--r--library/include/modules/MapCache.h10
-rw-r--r--library/include/modules/Maps.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/library/include/modules/MapCache.h b/library/include/modules/MapCache.h
index 109a20a4..262e70bb 100644
--- a/library/include/modules/MapCache.h
+++ b/library/include/modules/MapCache.h
@@ -253,6 +253,8 @@ public:
bool is_valid() { return valid; }
df::map_block *getRaw() { return block; }
+ bool Allocate();
+
MapCache *getParent() { return parent; }
private:
@@ -262,6 +264,8 @@ private:
MapCache *parent;
df::map_block *block;
+ void init();
+
int biomeIndexAt(df::coord2d p);
bool valid;
@@ -347,6 +351,12 @@ class DFHACK_EXPORT MapCache
return BlockAt(df::coord(coord.x>>4,coord.y>>4,coord.z));
}
+ bool ensureBlockAt(df::coord coord)
+ {
+ Block *b = BlockAtTile(coord);
+ return b ? b->Allocate() : false;
+ }
+
df::tiletype baseTiletypeAt (DFCoord tilecoord)
{
Block *b = BlockAtTile(tilecoord);
diff --git a/library/include/modules/Maps.h b/library/include/modules/Maps.h
index 984cf16c..869b2158 100644
--- a/library/include/modules/Maps.h
+++ b/library/include/modules/Maps.h
@@ -241,9 +241,11 @@ inline bool isValidTilePos(df::coord pos) { return isValidTilePos(pos.x, pos.y,
*/
extern DFHACK_EXPORT df::map_block * getBlock (int32_t blockx, int32_t blocky, int32_t blockz);
extern DFHACK_EXPORT df::map_block * getTileBlock (int32_t x, int32_t y, int32_t z);
+extern DFHACK_EXPORT df::map_block * ensureTileBlock (int32_t x, int32_t y, int32_t z);
inline df::map_block * getBlock (df::coord pos) { return getBlock(pos.x, pos.y, pos.z); }
inline df::map_block * getTileBlock (df::coord pos) { return getTileBlock(pos.x, pos.y, pos.z); }
+inline df::map_block * ensureTileBlock (df::coord pos) { return ensureTileBlock(pos.x, pos.y, pos.z); }
extern DFHACK_EXPORT df::tiletype *getTileType(int32_t x, int32_t y, int32_t z);
extern DFHACK_EXPORT df::tile_designation *getTileDesignation(int32_t x, int32_t y, int32_t z);