Merge git://github.com/peterix/dfhack

develop
Espen Wiborg 2012-01-27 10:59:57 +01:00
commit 018f4083a3
24 changed files with 470 additions and 403 deletions

@ -653,6 +653,7 @@ bool Console::init(bool sharing)
FD_SET(STDIN_FILENO, &d->descriptor_set);
FD_SET(d->exit_pipe[0], &d->descriptor_set);
inited = true;
return true;
}
bool Console::shutdown(void)

@ -30,45 +30,45 @@ namespace DFHack
{
const TileRow tileTypeTable[TILE_TYPE_ARRAY_LENGTH] =
{
// 0
// 0x000
{"void",tileshape_invalid, tilematerial_invalid, VAR_1},
{"ramp top",RAMP_TOP, AIR, VAR_1},
{"pool",POOL, SOIL, VAR_1},
{"murky pool",POOL, SOIL, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
// 10
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x010
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{0, tileshape_invalid, tilematerial_invalid, VAR_1},
{"driftwood stack",FLOOR, DRIFTWOOD, VAR_1},
// 20
{"driftwood",FLOOR, DRIFTWOOD, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"tree",TREE_OK, SOIL, VAR_1},
{"ice stair up/down",STAIR_UPDOWN, ICE, VAR_1},
{"ice stair down",STAIR_DOWN, ICE, VAR_1},
{"ice stair up",STAIR_UP, ICE, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 30
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x020
{"empty space",EMPTY, AIR, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"shrub",SHRUB_OK, SOIL, VAR_1},
@ -77,46 +77,44 @@ namespace DFHack
{"obsidian stair down",STAIR_DOWN, OBSIDIAN, VAR_1},
{"obsidian stair up",STAIR_UP, OBSIDIAN, VAR_1},
{"soil stair up/down",STAIR_UPDOWN, SOIL, VAR_1},
// 40
{"soil stair down",STAIR_DOWN, SOIL, VAR_1},
{"soil stair up",STAIR_UP, SOIL, VAR_1},
{"eerie pit",ENDLESS_PIT, HFS, VAR_1},
{"smooth stone floor",FLOOR, STONE, VAR_1 , TILE_SMOOTH },
{"smooth obsidian floor",FLOOR, OBSIDIAN, VAR_1 , TILE_SMOOTH },
{"smooth featstone? floor",FLOOR, FEATSTONE, VAR_1 , TILE_SMOOTH },
{"smooth featstone floor",FLOOR, FEATSTONE, VAR_1 , TILE_SMOOTH },
{"smooth vein floor",FLOOR, VEIN, VAR_1 , TILE_SMOOTH },
{"smooth ice floor",FLOOR, ICE, VAR_1 , TILE_SMOOTH },
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"grass stair up/down",STAIR_UPDOWN, GRASS, VAR_1},
// 50
{"grass stair down",STAIR_DOWN, GRASS, VAR_1},
{"grass stair up",STAIR_UP, GRASS, VAR_1},
{"grass2 stair up/down",STAIR_UPDOWN, GRASS2, VAR_1},
{"grass2 stair down",STAIR_DOWN, GRASS2, VAR_1},
{"grass2 stair up",STAIR_UP, GRASS2, VAR_1},
// 0x030
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"light grass stair up/down",STAIR_UPDOWN, GRASS, VAR_1},
{"light grass stair down",STAIR_DOWN, GRASS, VAR_1},
{"light grass stair up",STAIR_UP, GRASS, VAR_1},
{"dark grass stair up/down",STAIR_UPDOWN, GRASS2, VAR_1},
{"dark grass stair down",STAIR_DOWN, GRASS2, VAR_1},
{"dark grass stair up",STAIR_UP, GRASS2, VAR_1},
{"stone stair up/down",STAIR_UPDOWN, STONE, VAR_1},
{"stone stair down",STAIR_DOWN, STONE, VAR_1},
{"stone stair up",STAIR_UP, STONE, VAR_1},
{"vein stair up/down",STAIR_UPDOWN, VEIN, VAR_1},
{"vein stair down",STAIR_DOWN, VEIN, VAR_1},
// 60
{"vein stair up",STAIR_UP, VEIN, VAR_1},
{"featstone? stair up/down",STAIR_UPDOWN, FEATSTONE, VAR_1},
{"featstone? stair down",STAIR_DOWN, FEATSTONE, VAR_1},
{"featstone? stair up",STAIR_UP, FEATSTONE, VAR_1},
{"featstone stair up/down",STAIR_UPDOWN, FEATSTONE, VAR_1},
{"featstone stair down",STAIR_DOWN, FEATSTONE, VAR_1},
{"featstone stair up",STAIR_UP, FEATSTONE, VAR_1},
// 0x040
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"stone fortification",FORTIFICATION, STONE, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"campfire",FLOOR, CAMPFIRE, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 70
{"fire",FLOOR, FIRE, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -126,45 +124,45 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"stone pillar",PILLAR, STONE, VAR_1},
//80
// 0x050
{"obsidian pillar",PILLAR, OBSIDIAN, VAR_1,TILE_SMOOTH},
{"featstone? pillar",PILLAR, FEATSTONE, VAR_1,TILE_SMOOTH},
{"featstone pillar",PILLAR, FEATSTONE, VAR_1,TILE_SMOOTH},
{"vein pillar",PILLAR, VEIN, VAR_1,TILE_SMOOTH},
{"ice pillar",PILLAR, ICE, VAR_1,TILE_SMOOTH},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"waterfall landing",FLOOR, SOIL, VAR_1, TILE_WATERFALL }, // verify material
// 90
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"waterfall",FLOOR, SOIL, VAR_1, TILE_WATERFALL }, // verify material
{"river source",FLOOR, SOIL, VAR_1, TILE_RIVER_SOURCE }, // verify material
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x060
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 100
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 110
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x070
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -174,7 +172,6 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 120
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -183,36 +180,36 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x080
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 130
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 140
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x090
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 150
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -222,7 +219,7 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 160
// 0x0A0
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -231,36 +228,36 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 170
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x0B0
{"cracked stone wall" ,WALL, STONE, VAR_1, TILE_CRACKED },
{"damaged stone wall" ,WALL, STONE, VAR_1, TILE_DAMAGED },
{"worn stone wall" ,WALL, STONE, VAR_1, TILE_WORN },
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 180
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 190
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x0C0
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -270,7 +267,6 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 200
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -279,46 +275,46 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x0D0
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 210
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"stone wall" ,WALL, STONE, VAR_1},
// 220
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x0E0
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 230
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"sapling" ,SAPLING_OK, SOIL, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"dry grass ramp" ,RAMP, GRASS_DRY, VAR_1},
{"dead grass ramp" ,RAMP, GRASS_DEAD, VAR_1},
{"grass ramp" ,RAMP, GRASS, VAR_1},
{"grass ramp" ,RAMP, GRASS2, VAR_1},
{"light grass ramp" ,RAMP, GRASS, VAR_1},
{"dark grass ramp" ,RAMP, GRASS2, VAR_1},
{"stone ramp" ,RAMP, STONE, VAR_1},
{"obsidian ramp" ,RAMP, OBSIDIAN, VAR_1},
{"featstone? ramp" ,RAMP, FEATSTONE, VAR_1},
{"featstone ramp" ,RAMP, FEATSTONE, VAR_1},
// 240
// 0x0F0
{"vein ramp" ,RAMP, VEIN, VAR_1},
{"soil ramp" ,RAMP, SOIL, VAR_1},
{"ashes" ,FLOOR, ASHES, VAR_1},
@ -327,36 +323,36 @@ namespace DFHack
{"ice ramp" ,RAMP, ICE, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 250
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x100
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"ice floor" ,FLOOR, ICE, VAR_2},
{"ice floor" ,FLOOR, ICE, VAR_3},
// 260
{"ice floor" ,FLOOR, ICE, VAR_4},
{"furrowed soil" ,FLOOR, SOIL, VAR_1},
{"ice floor" ,FLOOR, ICE, VAR_1},
{"semi-molten rock" ,WALL, MAGMA, VAR_1},// unminable magma wall
{"magma" ,FLOOR, MAGMA, VAR_1},
{"magma flow" ,FLOOR, MAGMA, VAR_1},
{"soil wall" ,WALL, SOIL, VAR_1},
{"glowing barrier" ,WALL, CYAN_GLOW, VAR_1},
{"glowing floor" ,FLOOR, CYAN_GLOW, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"smooth obsidian wall RD2",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "--SS--E-" },
// 270
{"smooth obsidian wall R2D",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "--S---EE" },
{"smooth obsidian wall R2U",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "N-----EE" },
// 0x110
{"smooth obsidian wall RU2",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "NN----E-" },
{"smooth obsidian wall L2U",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "N---WW--" },
{"smooth obsidian wall LU2",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "NN--W---" },
@ -366,7 +362,6 @@ namespace DFHack
{"smooth obsidian wall RUD",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "N-S---E-" },
{"smooth obsidian wall LRD",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "--S-W-E-" },
// 280
{"smooth obsidian wall LRU",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "N---W-E-" },
{"smooth obsidian wall LUD",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "N-S-W---" },
{"smooth obsidian wall RD",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "--S---E-" },
@ -375,36 +370,36 @@ namespace DFHack
{"smooth obsidian wall LD",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "--S-W---" },
{"smooth obsidian wall UD",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "N-S-----" },
{"smooth obsidian wall LR",WALL,OBSIDIAN,VAR_1 , TILE_SMOOTH , "----W-E-" },
// 0x120
{"smooth featstone wall RD2",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "--SS--E-" },
{"smooth featstone wall R2D",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "--S---EE" },
// 290
{"smooth featstone wall R2U",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "N-----EE" },
{"smooth featstone wall RU2",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "NN----E-" },
{"smooth featstone wall L2U",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "N---WW--" },
{"smooth featstone wall LU2",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "NN--W---" },
{"smooth featstone wall L2D",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "--S-WW--" },
{"smooth featstone wall LD2",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "--SSW---" },
{"smooth featstone wall LRUD",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH ,"N-S-W-E-" },
{"smooth featstone wall RUD",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "N-S---E-" },
{"smooth featstone wall LRD",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "--S-W-E-" },
{"smooth featstone wall LRU",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "N---W-E-" },
//300
{"smooth featstone wall LUD",WALL,FEATSTONE,VAR_1, TILE_SMOOTH , "N-S-W---" },
{"smooth featstone wall RD",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "--S---E-" },
{"smooth featstone wall RU",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "N-----E-" },
{"smooth featstone wall LU",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "N---W---" },
// 0x130
{"smooth featstone wall LD",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "--S-W---" },
{"smooth featstone wall UD",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "N-S-----" },
{"smooth featstone wall LR",WALL,FEATSTONE,VAR_1 , TILE_SMOOTH , "----W-E-" },
{"smooth stone wall RD2",WALL,STONE,VAR_1 , TILE_SMOOTH , "--SS--E-" },
{"smooth stone wall R2D",WALL,STONE,VAR_1 , TILE_SMOOTH , "--S---EE" },
{"smooth stone wall R2U",WALL,STONE,VAR_1 , TILE_SMOOTH , "N-----EE" },
//310
{"smooth stone wall RU2",WALL,STONE,VAR_1 , TILE_SMOOTH , "NN----E-" },
{"smooth stone wall L2U",WALL,STONE,VAR_1 , TILE_SMOOTH , "N---WW--" },
{"smooth stone wall LU2",WALL,STONE,VAR_1 , TILE_SMOOTH , "NN--W---" },
{"smooth stone wall L2D",WALL,STONE,VAR_1 , TILE_SMOOTH , "--S-WW--" },
{"smooth stone wall LD2",WALL,STONE,VAR_1 , TILE_SMOOTH , "--SSW---" },
@ -414,7 +409,7 @@ namespace DFHack
{"smooth stone wall LRU",WALL,STONE,VAR_1 , TILE_SMOOTH , "N---W-E-" },
{"smooth stone wall LUD",WALL,STONE,VAR_1 , TILE_SMOOTH , "N-S-W---" },
//320
// 0x140
{"smooth stone wall RD",WALL,STONE,VAR_1 , TILE_SMOOTH , "--S---E-" },
{"smooth stone wall RU",WALL,STONE,VAR_1 , TILE_SMOOTH , "N-----E-" },
{"smooth stone wall LU",WALL,STONE,VAR_1 , TILE_SMOOTH , "N---W---" },
@ -422,47 +417,46 @@ namespace DFHack
{"smooth stone wall UD",WALL,STONE,VAR_1 , TILE_SMOOTH , "N-S-----" },
{"smooth stone wall LR",WALL,STONE,VAR_1 , TILE_SMOOTH , "----W-E-" },
{"obsidian fortification",FORTIFICATION,OBSIDIAN,VAR_1},
{"featstone? fortification",FORTIFICATION,FEATSTONE,VAR_1},
{"featstone fortification",FORTIFICATION,FEATSTONE,VAR_1},
{"cracked obsidian wall",WALL,OBSIDIAN,VAR_1, TILE_CRACKED },
{"damaged obsidian wall",WALL,OBSIDIAN,VAR_1, TILE_DAMAGED },
// 330
{"worn obsidian wall",WALL,OBSIDIAN,VAR_1, TILE_WORN},
{"obsidian wall",WALL,OBSIDIAN,VAR_1},
{"cracked featstone wall",WALL,FEATSTONE,VAR_1, TILE_CRACKED },
{"damaged featstone wall",WALL,FEATSTONE,VAR_1, TILE_DAMAGED },
{"worn featstone wall",WALL,FEATSTONE,VAR_1, TILE_WORN },
{"featstone wall",WALL,FEATSTONE,VAR_1},
{"stone floor",FLOOR,STONE,VAR_1},
{"stone floor",FLOOR,STONE,VAR_2},
{"stone floor",FLOOR,STONE,VAR_3},
{"stone floor",FLOOR,STONE,VAR_4},
// 340
{"obsidian floor",FLOOR,OBSIDIAN,VAR_1},
{"obsidian floor",FLOOR,OBSIDIAN,VAR_2},
{"obsidian floor",FLOOR,OBSIDIAN,VAR_3},
{"obsidian floor",FLOOR,OBSIDIAN,VAR_4},
// 0x150
{"stone floor 1",FLOOR,STONE,VAR_1},
{"stone floor 2",FLOOR,STONE,VAR_2},
{"stone floor 3",FLOOR,STONE,VAR_3},
{"stone floor 4",FLOOR,STONE,VAR_4},
{"obsidian floor 1",FLOOR,OBSIDIAN,VAR_1},
{"obsidian floor 2",FLOOR,OBSIDIAN,VAR_2},
{"obsidian floor 3",FLOOR,OBSIDIAN,VAR_3},
{"obsidian floor 4",FLOOR,OBSIDIAN,VAR_4},
{"featstone floor 1",FLOOR,FEATSTONE,VAR_1},
{"featstone floor 2",FLOOR,FEATSTONE,VAR_2},
{"featstone floor 3",FLOOR,FEATSTONE,VAR_3},
{"featstone floor 4",FLOOR,FEATSTONE,VAR_4},
{"grass 1",FLOOR,GRASS,VAR_1},
{"grass 2",FLOOR,GRASS,VAR_2},
// 350
{"grass 3",FLOOR,GRASS,VAR_3},
{"grass 4",FLOOR,GRASS,VAR_4},
{"soil floor",FLOOR,SOIL,VAR_1},
{"soil floor",FLOOR,SOIL,VAR_2},
{"soil floor",FLOOR,SOIL,VAR_3},
{"soil floor",FLOOR,SOIL,VAR_4},
{"wet soil floor",FLOOR,SOIL,VAR_1},
{"wet soil floor",FLOOR,SOIL,VAR_2},
{"wet soil floor",FLOOR,SOIL,VAR_3},
{"wet soil floor",FLOOR,SOIL,VAR_4},
// 360
{"dark grass 1",FLOOR,GRASS2,VAR_1},
{"dark grass 2",FLOOR,GRASS2,VAR_2},
{"dark grass 3",FLOOR,GRASS2,VAR_3},
{"dark grass 4",FLOOR,GRASS2,VAR_4},
// 0x160
{"soil floor 1",FLOOR,SOIL,VAR_1},
{"soil floor 2",FLOOR,SOIL,VAR_2},
{"soil floor 3",FLOOR,SOIL,VAR_3},
{"soil floor 4",FLOOR,SOIL,VAR_4},
{"wet soil floor 1",FLOOR,SOIL,VAR_1},
{"wet soil floor 2",FLOOR,SOIL,VAR_2},
{"wet soil floor 3",FLOOR,SOIL,VAR_3},
{"wet soil floor 4",FLOOR,SOIL,VAR_4},
{"ice fortification",FORTIFICATION,ICE,VAR_1},
{"cracked ice wall",WALL,ICE,VAR_1, TILE_CRACKED},
{"damaged ice wall",WALL,ICE,VAR_1, TILE_DAMAGED},
@ -471,84 +465,84 @@ namespace DFHack
{"river N",RIVER_BED,SOIL,VAR_1, TILE_NORMAL, "N" },
{"river S",RIVER_BED,SOIL,VAR_1, TILE_NORMAL, "S" },
{"river E",RIVER_BED,SOIL,VAR_1, TILE_NORMAL, "E" },
// 0x170
{"river W",RIVER_BED,SOIL,VAR_1, TILE_NORMAL, "W" },
{"river NW",RIVER_BED,SOIL,VAR_1,TILE_NORMAL, "NW"},
//370
{"river NE",RIVER_BED,SOIL,VAR_1, TILE_NORMAL , "NE" },
{"river SW",RIVER_BED,SOIL,VAR_1, TILE_NORMAL , "SW" },
{"river SE",RIVER_BED,SOIL,VAR_1, TILE_NORMAL , "SE" },
{"brook bed N",BROOK_BED,SOIL,VAR_1, TILE_NORMAL , "N" },
{"brook bed S",BROOK_BED,SOIL,VAR_1, TILE_NORMAL , "S" },
{"brook bed E",BROOK_BED,SOIL,VAR_1, TILE_NORMAL , "E" },
{"brook bed W",BROOK_BED,SOIL,VAR_1, TILE_NORMAL , "W" },
{"brook bed NW",BROOK_BED,SOIL,VAR_1, TILE_NORMAL, "NW" },
{"brook bed NE",BROOK_BED,SOIL,VAR_1, TILE_NORMAL, "NE" },
{"brook bed SW",BROOK_BED,SOIL,VAR_1, TILE_NORMAL, "SW" },
// 380
{"brook bed SE",BROOK_BED,SOIL,VAR_1, TILE_NORMAL, "SE" },
{"brook top",BROOK_TOP,SOIL,VAR_1 },
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 0x180
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"dry grass 1",FLOOR,GRASS_DRY,VAR_1},
{"dry grass 2",FLOOR,GRASS_DRY,VAR_2},
{"dry grass 3",FLOOR,GRASS_DRY,VAR_3},
// 390
{"dry grass 4",FLOOR,GRASS_DRY,VAR_4},
{"dead tree",TREE_DEAD,SOIL,VAR_1},
{"dead sapling",SAPLING_DEAD,SOIL,VAR_1},
{"dead shrub",SHRUB_DEAD,SOIL,VAR_1},
{"dead grass 1",FLOOR,GRASS_DEAD,VAR_1},
{"dead grass 2",FLOOR,GRASS_DEAD,VAR_2},
{"dead grass 3",FLOOR,GRASS_DEAD,VAR_3},
{"dead grass 4",FLOOR,GRASS_DEAD,VAR_4},
{"grass B1",FLOOR,GRASS2,VAR_1},
{"grass B2",FLOOR,GRASS2,VAR_2},
{"light grass 1",FLOOR,GRASS,VAR_1},
{"light grass 2",FLOOR,GRASS,VAR_2},
// 400
{"grass B3",FLOOR,GRASS2,VAR_3},
{"grass B4",FLOOR,GRASS2,VAR_4},
// 0x190
{"light grass 3",FLOOR,GRASS,VAR_3},
{"light grass 4",FLOOR,GRASS,VAR_4},
{"boulder",BOULDER,STONE,VAR_1},
{"obsidian boulder",BOULDER,OBSIDIAN,VAR_1},
{"featstone? boulder",BOULDER,FEATSTONE,VAR_1},
{"pebbles 1",PEBBLES,STONE,VAR_1},
{"pebbles 2",PEBBLES,STONE,VAR_2},
{"pebbles 3",PEBBLES,STONE,VAR_3},
{"pebbles 4",PEBBLES,STONE,VAR_4},
{"obsidian shards",PEBBLES,OBSIDIAN,VAR_1},
// 410
{"obsidian shards",PEBBLES,OBSIDIAN,VAR_2},
{"obsidian shards",PEBBLES,OBSIDIAN,VAR_3},
{"obsidian shards",PEBBLES,OBSIDIAN,VAR_4},
{"featstone? pebbles",PEBBLES,FEATSTONE,VAR_1},
{"featstone? pebbles",PEBBLES,FEATSTONE,VAR_2},
{"featstone? pebbles",PEBBLES,FEATSTONE,VAR_3},
{"featstone? pebbles",PEBBLES,FEATSTONE,VAR_4},
{"featstone boulder",BOULDER,FEATSTONE,VAR_1},
{"stone pebbles 1",PEBBLES,STONE,VAR_1},
{"stone pebbles 2",PEBBLES,STONE,VAR_2},
{"stone pebbles 3",PEBBLES,STONE,VAR_3},
{"stone pebbles 4",PEBBLES,STONE,VAR_4},
{"obsidian pebbles 1",PEBBLES,OBSIDIAN,VAR_1},
{"obsidian pebbles 2",PEBBLES,OBSIDIAN,VAR_2},
{"obsidian pebbles 3",PEBBLES,OBSIDIAN,VAR_3},
{"obsidian pebbles 4",PEBBLES,OBSIDIAN,VAR_4},
{"featstone pebbles 1",PEBBLES,FEATSTONE,VAR_1},
{"featstone pebbles 2",PEBBLES,FEATSTONE,VAR_2},
{"featstone pebbles 3",PEBBLES,FEATSTONE,VAR_3},
// 0x1A0
{"featstone pebbles 4",PEBBLES,FEATSTONE,VAR_4},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "--SS--E-"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "--S---EE"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N-----EE" },
// 420
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "NN----E-"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N---WW--"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "NN--W---"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "--S-WW--" },
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "--SSW---"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N-S-W-E-"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N-S---E-"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "--S-W-E-"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N---W-E-"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N-S-W---"},
// 430
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "--S---E-"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N-----E-"},
// 0x1B0
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N---W---"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "--S-W---"},
{"smooth vein wall",WALL,VEIN,VAR_1 , TILE_SMOOTH , "N-S-----"},
@ -558,45 +552,44 @@ namespace DFHack
{"damaged vein wall",WALL,VEIN,VAR_1, TILE_DAMAGED },
{"worn vein wall",WALL,VEIN,VAR_1 , TILE_WORN },
// 440
{"vein wall",WALL,VEIN,VAR_1},
{"vein floor",FLOOR,VEIN,VAR_1},
{"vein floor",FLOOR,VEIN,VAR_2},
{"vein floor",FLOOR,VEIN,VAR_3},
{"vein floor",FLOOR,VEIN,VAR_4},
{"vein floor 1",FLOOR,VEIN,VAR_1},
{"vein floor 2",FLOOR,VEIN,VAR_2},
{"vein floor 3",FLOOR,VEIN,VAR_3},
{"vein floor 4",FLOOR,VEIN,VAR_4},
{"vein boulder",BOULDER,VEIN,VAR_1},
{"vein pebbles",PEBBLES,VEIN,VAR_1},
{"vein pebbles",PEBBLES,VEIN,VAR_2},
{"vein pebbles",PEBBLES,VEIN,VAR_3},
{"vein pebbles",PEBBLES,VEIN,VAR_4},
{"vein pebbles 1",PEBBLES,VEIN,VAR_1},
{"vein pebbles 2",PEBBLES,VEIN,VAR_2},
// 450
// 0x1C0
{"vein pebbles 3",PEBBLES,VEIN,VAR_3},
{"vein pebbles 4",PEBBLES,VEIN,VAR_4},
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "--SS--E-"},
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "--S---EE" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N-----EE" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "NN----E-"},
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N---WW--" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "NN--W---" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "--S-WW--" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "--SSW---" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N-S-W-E-"},
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N-S---E-" },
// 460
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "--S-W-E-" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N---W-E-" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N-S-W---"},
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "--S---E-"},
// 0x1D0
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N-----E-" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N---W---" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "--S-W---" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "N-S-----" },
{"smooth ice wall",WALL,ICE,VAR_1 , TILE_SMOOTH , "----W-E-"},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 470
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -606,7 +599,7 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 480
// 0x1E0
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
@ -615,36 +608,36 @@ namespace DFHack
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
// 490
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1},
{"constructed floor",FLOOR,CONSTRUCTED, VAR_1},
{"constructed fortification",FORTIFICATION,CONSTRUCTED, VAR_1},
{"constructed pillar",PILLAR,CONSTRUCTED, VAR_1},
// 0x1F0
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "--SS--E-" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "--S---EE" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N-----EE" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "NN----E-" },
// 500
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N---WW--" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "NN--W---" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "--S-WW--" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "--SSW---" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N-S-W-E-" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N-S---E-" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "--S-W-E-" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N---W-E-" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N-S-W---" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "--S---E-" },
// 510
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N-----E-" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N---W---" },
// 0x200
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "--S-W---" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "N-S-----" },
{"constructed wall",WALL,CONSTRUCTED, VAR_1 ,TILE_NORMAL, "----W-E-" },
@ -652,7 +645,9 @@ namespace DFHack
{"constructed stair down",STAIR_DOWN,CONSTRUCTED, VAR_1},
{"constructed stair up",STAIR_UP,CONSTRUCTED, VAR_1},
{"constructed ramp",RAMP,CONSTRUCTED, VAR_1},
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1} // end
// end
{0 ,tileshape_invalid, tilematerial_invalid, VAR_1}
};
//set tile class string lookup table (e.g. for printing to user)
@ -679,9 +674,9 @@ namespace DFHack
};
#undef X
int32_t findSimilarTileType( const int32_t sourceTileType, const TileShape tshape )
int16_t findSimilarTileType( const int16_t sourceTileType, const TileShape tshape )
{
int32_t match=0;
int16_t match=0;
int value=0, matchv=0;
const TileRow *source = &tileTypeTable[sourceTileType];
@ -716,7 +711,7 @@ namespace DFHack
}
//Run through until perfect match found or hit end.
for(int32_t tt=0;tt<TILE_TYPE_ARRAY_LENGTH && value<(8|4|1); ++tt)
for(int16_t tt=0;tt<TILE_TYPE_ARRAY_LENGTH && value<(8|4|1); ++tt)
{
if( tshape == tileTypeTable[tt].shape )
{

@ -48,7 +48,7 @@ namespace DFHack
X(RAMP_TOP, "used for pathing?" ) \
X(FLOOR, "") \
X(BROOK_TOP, "water-passable floor on top of BROOK_BED tiles") \
X(RIVER_BED, "It's a riverbed. Basically a floor.'") \
X(RIVER_BED, "It's a riverbed. Basically a floor that doesn't get muddy.") \
X(POOL, "A pool. Gathers water while it's raining.'") \
X(TREE_DEAD, "") \
X(TREE_OK, "") \
@ -77,14 +77,14 @@ namespace DFHack
X(SOIL, "ordinary soil. material depends on geology" ) \
X(STONE, "ordinary layer stone. material depends on geology" ) \
X(FEATSTONE, "map special stone. used for things like hell, the hell temple or adamantine tubes. material depends on local/global special" ) \
X(OBSIDIAN, "cast obsidian" ) \
X(OBSIDIAN, "lava stone created by mixing magma and water" ) \
X(VEIN, "vein stone. material depends on mineral veins present" ) \
X(ICE, "frozen water... not much to say. you can determine what was on the tile before it froze by looking into the 'ice vein' objects" ) \
X(GRASS, "grass (has 4 variants)" ) \
X(GRASS2, "grass (has 4 variants)" ) \
X(GRASS, "light grass (has 4 variants)" ) \
X(GRASS2, "dark grass (has 4 variants)" ) \
X(GRASS_DEAD, "dead grass (has 4 variants)" ) \
X(GRASS_DRY, "dry grass (has 4 variants)" ) \
X(DRIFTWOOD, "non-specified wood - normally on top of the local layer stone/soil." ) \
X(DRIFTWOOD, "driftwood. normally shows up on beaches" ) \
X(HFS, "the stuff demon pits are made of - this makes them different from ordinary pits." ) \
X(MAGMA, "material for semi-molten rock and 'magma flow' tiles" ) \
X(CAMPFIRE, "human armies make them when they siege. The original tile may be lost?" ) \
@ -111,11 +111,11 @@ namespace DFHack
// When the TileType class gets created, everything should be re-thought.
#define TILESPECIAL_MACRO \
X(NORMAL, "Default for all type, nothing present" ) \
X(RIVER_SOURCE, "Rivers Source, when it exists on a map" ) \
X(WATERFALL, "Special case for Waterfall Landing. How's this used?" ) \
X(CRACKED, "Walls being dug" ) \
X(DAMAGED, "Walls being dug" ) \
X(WORN, "Walls being dug ??" ) \
X(RIVER_SOURCE, "River Source, when it exists on a map" ) \
X(WATERFALL, "Waterfall from Nowhere, used by cave rivers back in 40d" ) \
X(CRACKED, "Partially (75%) mined walls" ) \
X(DAMAGED, "Partially (50%) mined walls" ) \
X(WORN, "Partially (25%) mined walls" ) \
X(SMOOTH, "Walls and floors." )
//end TILESPECIAL_MACRO
@ -255,7 +255,7 @@ namespace DFHack
// tile is missing a floor
inline
bool LowPassable(uint16_t tiletype)
bool LowPassable(int16_t tiletype)
{
switch(DFHack::tileTypeTable[tiletype].shape)
{
@ -271,7 +271,7 @@ namespace DFHack
// tile is missing a roof
inline
bool HighPassable(uint16_t tiletype)
bool HighPassable(int16_t tiletype)
{
switch(DFHack::tileTypeTable[tiletype].shape)
{
@ -299,81 +299,81 @@ namespace DFHack
};
inline
bool FlowPassable(uint16_t tiletype)
bool FlowPassable(int16_t tiletype)
{
TileShape tc = tileTypeTable[tiletype].shape;
return tc != WALL && tc != PILLAR && tc != TREE_DEAD && tc != TREE_OK;
};
inline
bool isWallTerrain(int tiletype)
bool isWallTerrain(int16_t tiletype)
{
return tileTypeTable[tiletype].shape >= WALL && tileTypeTable[tiletype].shape <= FORTIFICATION ;
}
inline
bool isFloorTerrain(int tiletype)
bool isFloorTerrain(int16_t tiletype)
{
return tileTypeTable[tiletype].shape >= FLOOR && tileTypeTable[tiletype].shape <= PEBBLES;
}
inline
bool isRampTerrain(int tiletype)
bool isRampTerrain(int16_t tiletype)
{
return tileTypeTable[tiletype].shape == RAMP;
}
inline
bool isStairTerrain(int tiletype)
bool isStairTerrain(int16_t tiletype)
{
return tileTypeTable[tiletype].shape >= STAIR_UP && tileTypeTable[tiletype].shape <= STAIR_UPDOWN;
}
inline
bool isOpenTerrain(int tiletype)
bool isOpenTerrain(int16_t tiletype)
{
return tileTypeTable[tiletype].shape == EMPTY;
}
inline
const char * tileName(int tiletype)
const char * tileName(int16_t tiletype)
{
return tileTypeTable[tiletype].name;
}
inline
TileShape tileShape(int tiletype)
TileShape tileShape(int16_t tiletype)
{
return tileTypeTable[tiletype].shape;
}
inline
TileSpecial tileSpecial(int tiletype)
TileSpecial tileSpecial(int16_t tiletype)
{
return tileTypeTable[tiletype].special;
}
inline
TileVariant tileVariant(int tiletype)
TileVariant tileVariant(int16_t tiletype)
{
return tileTypeTable[tiletype].variant;
}
inline
TileMaterial tileMaterial(int tiletype)
TileMaterial tileMaterial(int16_t tiletype)
{
return tileTypeTable[tiletype].material;
}
inline
TileDirection tileDirection(int tiletype)
TileDirection tileDirection(int16_t tiletype)
{
return tileTypeTable[tiletype].direction;
}
/// Safely access the tile type array.
inline const
TileRow * getTileRow(int tiletype)
TileRow * getTileRow(int16_t tiletype)
{
if( tiletype<0 || tiletype>=TILE_TYPE_ARRAY_LENGTH ) return 0;
return ( const TileRow * ) &tileTypeTable[tiletype];
@ -387,9 +387,9 @@ namespace DFHack
* @return matching index in tileTypeTable, or -1 if none found.
*/
inline
int32_t findTileType( const TileShape tshape, const TileMaterial tmat, const TileVariant tvar, const TileSpecial tspecial, const TileDirection tdir )
int16_t findTileType( const TileShape tshape, const TileMaterial tmat, const TileVariant tvar, const TileSpecial tspecial, const TileDirection tdir )
{
int32_t tt;
int16_t tt;
for(tt=0;tt<TILE_TYPE_ARRAY_LENGTH; ++tt)
{
if( tshape>-1 && tshape != tileTypeTable[tt].shape ) continue;
@ -410,7 +410,7 @@ namespace DFHack
*
* @todo Definitely needs improvement for wall directions, etc.
*/
DFHACK_EXPORT int32_t findSimilarTileType( const int32_t sourceTileType, const TileShape tshape );
DFHACK_EXPORT int16_t findSimilarTileType( const int16_t sourceTileType, const TileShape tshape );
}

@ -42,9 +42,23 @@ namespace Simple
{
namespace Constructions
{
// "Simplified" copy of construction
struct t_construction {
df::coord pos;
df::item_type item_type;
int16_t unk;
int16_t mat_type;
int32_t mat_index;
df::construction_flags flags;
int16_t original_tile;
// Pointer to original object, in case you want to modify it
df::construction *origin;
};
DFHACK_EXPORT bool isValid();
DFHACK_EXPORT uint32_t getCount();
DFHACK_EXPORT df::construction *getConstruction (const int32_t index);
DFHACK_EXPORT bool copyConstruction (const int32_t index, t_construction &out);
DFHACK_EXPORT df::construction * getConstruction (const int32_t index);
}
}
}

@ -41,9 +41,25 @@ namespace Simple
{
namespace Engravings
{
// "Simplified" copy of engraving
struct t_engraving {
int32_t artist;
int32_t masterpiece_event;
int32_t skill_rating;
df::coord pos;
df::engraving_flags flags;
int8_t tile;
int32_t type;
int16_t subtype;
df::item_quality quality;
// Pointer to original object, in case you want to modify it
df::engraving *origin;
};
DFHACK_EXPORT bool isValid();
DFHACK_EXPORT uint32_t getCount();
DFHACK_EXPORT df::engraving *getEngraving (const int32_t index);
DFHACK_EXPORT bool copyEngraving (const int32_t index, t_engraving &out);
DFHACK_EXPORT df::engraving * getEngraving (const int32_t index);
}
}
}

@ -145,11 +145,13 @@ typedef int16_t t_blockmaterials [16][16];
* \ingroup grp_maps
*/
typedef df::tile_designation designations40d [16][16];
typedef df::tile_designation t_designation;
/**
* 16x16 array of occupancy flags
* \ingroup grp_maps
*/
typedef df::tile_occupancy occupancies40d [16][16];
typedef df::tile_occupancy t_occupancy;
/**
* array of 16 biome indexes valid for the block
* \ingroup grp_maps

@ -169,6 +169,7 @@ DFHACK_EXPORT bool isValid();
/* Read Functions */
// Read creatures in a box, starting with index. Returns -1 if no more creatures
// found. Call repeatedly do get all creatures in a specified box (uses tile coords)
DFHACK_EXPORT int32_t getNumCreatures();
DFHACK_EXPORT int32_t GetCreatureInBox(const int32_t index, df::unit ** furball,
const uint16_t x1, const uint16_t y1,const uint16_t z1,
const uint16_t x2, const uint16_t y2,const uint16_t z2);

@ -42,9 +42,31 @@ namespace Vegetation
{
const uint32_t sapling_to_tree_threshold = 120 * 28 * 12 * 3; // 3 years
// "Simplified" copy of plant
struct t_plant {
df::language_name name;
df::plant_flags flags;
int16_t material;
df::coord pos;
int32_t grow_counter;
uint16_t temperature_1;
uint16_t temperature_2;
int32_t is_burning;
int32_t hitpoints;
int16_t update_order;
//std::vector<void *> unk1;
//int32_t unk2;
//uint16_t temperature_3;
//uint16_t temperature_4;
//uint16_t temperature_5;
// Pointer to original object, in case you want to modify it
df::plant *origin;
};
DFHACK_EXPORT bool isValid();
DFHACK_EXPORT uint32_t getCount();
DFHACK_EXPORT df::plant *getPlant (const int32_t index);
DFHACK_EXPORT df::plant * getPlant(const int32_t index);
DFHACK_EXPORT bool copyPlant (const int32_t index, t_plant &out);
}
}
}

@ -43,7 +43,7 @@ using df::global::world;
bool Constructions::isValid()
{
return (world->constructions.size() > 0);
return (world != NULL);
}
uint32_t Constructions::getCount()
@ -51,9 +51,26 @@ uint32_t Constructions::getCount()
return world->constructions.size();
}
df::construction *Constructions::getConstruction(const int32_t index)
df::construction * Constructions::getConstruction(const int32_t index)
{
if (index < 0 || index >= getCount())
return NULL;
return world->constructions[index];
}
bool Constructions::copyConstruction(const int32_t index, t_construction &out)
{
if (index < 0 || index >= getCount())
return false;
out.origin = world->constructions[index];
out.pos = out.origin->pos;
out.item_type = out.origin->item_type;
out.unk = out.origin->anon_1;
out.mat_type = out.origin->mat_type;
out.mat_index = out.origin->mat_index;
out.flags = out.origin->flags;
out.original_tile = out.origin->original_tile;
return true;
}

@ -44,7 +44,7 @@ using df::global::world;
bool Engravings::isValid()
{
return (world->engravings.size() > 0);
return (world != NULL);
}
uint32_t Engravings::getCount()
@ -52,9 +52,28 @@ uint32_t Engravings::getCount()
return world->engravings.size();
}
df::engraving *Engravings::getEngraving(const int32_t index)
df::engraving * Engravings::getEngraving(int index)
{
if (index < 0 || index >= getCount())
return NULL;
return world->engravings[index];
}
bool Engravings::copyEngraving(const int32_t index, t_engraving &out)
{
if (index < 0 || index >= getCount())
return false;
out.origin = world->engravings[index];
out.artist = out.origin->artist;
out.masterpiece_event = out.origin->masterpiece_event;
out.skill_rating = out.origin->skill_rating;
out.pos = out.origin->pos;
out.flags = out.origin->flags;
out.tile = out.origin->tile;
out.type = out.origin->type;
out.subtype = out.origin->subtype;
out.quality = out.origin->quality;
return true;
}

@ -62,6 +62,7 @@ using namespace std;
#include "df/physical_attribute_type.h"
#include "df/mental_attribute_type.h"
#include <df/color_modifier_raw.h>
using namespace DFHack;
using namespace df::enums;
@ -746,32 +747,32 @@ bool Materials::ReadCreatureTypesEx (void)
caste.singular = ca->caste_name[0];
caste.plural = ca->caste_name[1];
caste.adjective = ca->caste_name[2];
/*
// color mod reading
// Caste + offset > color mod vector
vector <char *> & p_colormod = *(vector<char*> *) (world->raws.creatures.all[i]->caste + caste_colormod_offset);
uint32_t sizecolormod = p_colormod.size();
auto & colorings = ca->color_modifiers;
uint32_t sizecolormod = colorings.size();
caste.ColorModifier.resize(sizecolormod);
for(uint32_t k = 0; k < sizecolormod;k++)
{
// color mod [0] -> color list
vector <uint32_t> & p_colorlist = *(vector<uint32_t> *) (p_colormod[k]);
uint32_t sizecolorlist = p_colorlist.size();
auto & indexes = colorings[k]->color_indexes;
uint32_t sizecolorlist = indexes.size();
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
for(uint32_t l = 0; l < sizecolorlist; l++)
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
caste.ColorModifier[k].colorlist[l] = indexes[l];
// color mod [color_modifier_part_offset] = string part
caste.ColorModifier[k].part = p->readSTLString( p_colormod[k] + color_modifier_part_offset);
caste.ColorModifier[k].startdate = p->readDWord( p_colormod[k] + color_modifier_startdate_offset );
caste.ColorModifier[k].enddate = p->readDWord( p_colormod[k] + color_modifier_enddate_offset );
caste.ColorModifier[k].part = colorings[k]->part;
caste.ColorModifier[k].startdate = colorings[k]->start_date;
caste.ColorModifier[k].enddate = colorings[k]->end_date;
}
*/
// body parts
caste.bodypart.empty();
uint32_t sizebp = ca->body_parts.size();
uint32_t sizebp = ca->unknown1.body_parts.size();
for (uint32_t k = 0; k < sizebp; k++)
{
df::body_part_raw *bp = ca->body_parts[k];
df::body_part_raw *bp = ca->unknown1.body_parts[k];
t_bodypart part;
part.id = bp->part_code;
part.category = bp->part_name;

@ -59,6 +59,11 @@ bool Units::isValid()
return (world->units.all.size() > 0);
}
int32_t Units::getNumCreatures()
{
return world->units.all.size();
}
df::unit * Units::GetCreature (const int32_t index)
{
if (!isValid()) return NULL;

@ -45,7 +45,7 @@ using df::global::world;
bool Vegetation::isValid()
{
return (world->plants.all.size() > 0);
return (world != NULL);
}
uint32_t Vegetation::getCount()
@ -53,9 +53,34 @@ uint32_t Vegetation::getCount()
return world->plants.all.size();
}
df::plant *Vegetation::getPlant(const int32_t index)
df::plant * Vegetation::getPlant(const int32_t index)
{
if (index < 0 || index >= getCount())
return NULL;
return world->plants.all[index];
}
bool Vegetation::copyPlant(const int32_t index, t_plant &out)
{
if (index < 0 || index >= getCount())
return false;
out.origin = world->plants.all[index];
out.name = out.origin->name;
out.flags = out.origin->flags;
out.material = out.origin->material;
out.pos = out.origin->pos;
out.grow_counter = out.origin->grow_counter;
out.temperature_1 = out.origin->temperature_1;
out.temperature_2 = out.origin->temperature_2;
out.is_burning = out.origin->is_burning;
out.hitpoints = out.origin->hitpoints;
out.update_order = out.origin->update_order;
//out.unk1 = out.origin->anon_1;
//out.unk2 = out.origin->anon_2;
//out.temperature_3 = out.origin->temperature_3;
//out.temperature_4 = out.origin->temperature_4;
//out.temperature_5 = out.origin->temperature_5;
return true;
}

@ -1 +1 @@
Subproject commit 7082ed13d10fb7934486362390ae1959410ca696
Subproject commit 6359571fd7d0a846b87709b55343a1a1d72f02fe

@ -70,6 +70,7 @@ DFHACK_PLUGIN(jobutils jobutils.cpp)
DFHACK_PLUGIN(regrass regrass.cpp)
DFHACK_PLUGIN(workflow workflow.cpp)
DFHACK_PLUGIN(showmood showmood.cpp)
DFHACK_PLUGIN(fixveins fixveins.cpp)
#DFHACK_PLUGIN(versionosd versionosd.cpp)
# this is the skeleton plugin. If you want to make your own, make a copy and then change it

@ -43,10 +43,9 @@ DFhackCExport DFHack::command_result readFlag (Core * c, vector <string> & param
{
c->Suspend();
DFHack::Maps * Maps = c->getMaps();
DFHack::Gui * Gui = c->getGui();
// init the map
if(!Maps->Start())
if(!Maps::IsValid())
{
c->con.printerr("Can't init map. Make sure you have a map loaded in DF.\n");
c->Resume();
@ -64,7 +63,7 @@ DFhackCExport DFHack::command_result readFlag (Core * c, vector <string> & param
DFHack::DFCoord cursor = DFHack::DFCoord(cx,cy,cz);
MapExtras::MapCache * MCache = new MapExtras::MapCache(Maps);
MapExtras::MapCache * MCache = new MapExtras::MapCache();
DFHack::t_occupancy oc = MCache->occupancyAt(cursor);
c->con.print("Current Value: %d\n", oc.bits.building);
@ -111,10 +110,9 @@ DFhackCExport DFHack::command_result writeFlag (Core * c, vector <string> & para
c->Suspend();
DFHack::Maps * Maps = c->getMaps();
DFHack::Gui * Gui = c->getGui();
// init the map
if(!Maps->Start())
if(!Maps::IsValid())
{
c->con.printerr("Can't init map. Make sure you have a map loaded in DF.\n");
c->Resume();
@ -132,7 +130,7 @@ DFhackCExport DFHack::command_result writeFlag (Core * c, vector <string> & para
DFHack::DFCoord cursor = DFHack::DFCoord(cx,cy,cz);
MapExtras::MapCache * MCache = new MapExtras::MapCache(Maps);
MapExtras::MapCache * MCache = new MapExtras::MapCache();
DFHack::t_occupancy oc = MCache->occupancyAt(cursor);
oc.bits.building = value;

@ -15,11 +15,11 @@ using namespace DFHack;
//////////////////////
// START item choosers
//////////////////////
/*
class item_chooser
{
public:
item_chooser(Core* _c, DFHack::Items* _Items) : c(_c), Items(_Items)
item_chooser(Core* _c) : c(_c)
{
}
@ -31,13 +31,12 @@ public:
protected:
Core *c;
DFHack::Items *Items;
};
class choose_all : public item_chooser
{
public:
choose_all(Core* _c, ::Items* _Items) : item_chooser(_c, _Items)
choose_all(Core* _c) : item_chooser(_c)
{
}
@ -51,7 +50,7 @@ public:
class choose_unknown : public item_chooser
{
public:
choose_unknown(Core* _c, ::Items* _Items) : item_chooser(_c, _Items)
choose_unknown(Core* _c) : item_chooser(_c)
{
}
@ -66,9 +65,8 @@ public:
t_itemflags &f = itm->origin->flags;
return (f.unk1 || f.unk2 || f.unk3 || f.unk4 || /*f.unk5 ||*/
return (f.unk1 || f.unk2 || f.unk3 || f.unk4 ||
f.unk6 || f.unk7 ||
// f.unk8 || f.unk9 || /* Too common */
f.unk10 || f.unk11);
}
@ -263,6 +261,7 @@ DFhackCExport command_result df_dumpitems (Core * c, vector <string> & parameter
}
}
*/
/*
}
c->Resume();
@ -271,3 +270,4 @@ DFhackCExport command_result df_dumpitems (Core * c, vector <string> & parameter
return CR_OK;
}
*/

@ -9,10 +9,13 @@
#include "modules/Items.h"
#include <modules/Gui.h>
#include <llimits.h>
#include <df/caste_raw.h>
#include <df/creature_raw.h>
using std::vector;
using std::string;
using namespace DFHack;
using namespace DFHack::Simple;
//FIXME: possible race conditions with calling kittens from the IO thread and shutdown from Core.
bool shutdown_flag = false;
bool final_flag = true;
@ -26,12 +29,9 @@ uint64_t timeLast = 0;
DFhackCExport command_result kittens (Core * c, vector <string> & parameters);
DFhackCExport command_result ktimer (Core * c, vector <string> & parameters);
DFhackCExport command_result bflags (Core * c, vector <string> & parameters);
DFhackCExport command_result trackmenu (Core * c, vector <string> & parameters);
DFhackCExport command_result trackpos (Core * c, vector <string> & parameters);
DFhackCExport command_result mapitems (Core * c, vector <string> & parameters);
DFhackCExport command_result test_creature_offsets (Core * c, vector <string> & parameters);
DFhackCExport command_result creat_job (Core * c, vector <string> & parameters);
DFhackCExport command_result colormods (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
@ -43,12 +43,9 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand>
commands.clear();
commands.push_back(PluginCommand("nyan","NYAN CAT INVASION!",kittens, true));
commands.push_back(PluginCommand("ktimer","Measure time between game updates and console lag (toggle).",ktimer));
commands.push_back(PluginCommand("blockflags","Look up block flags",bflags));
commands.push_back(PluginCommand("trackmenu","Track menu ID changes (toggle).",trackmenu));
commands.push_back(PluginCommand("trackpos","Track mouse and designation coords (toggle).",trackpos));
commands.push_back(PluginCommand("mapitems","Check item ids under cursor against item ids in map block.",mapitems));
commands.push_back(PluginCommand("test_creature_offsets","Bleh.",test_creature_offsets));
commands.push_back(PluginCommand("creat_job","Bleh.",creat_job));
commands.push_back(PluginCommand("colormods","Dump colormod vectors.",colormods));
return CR_OK;
}
@ -107,59 +104,6 @@ DFhackCExport command_result plugin_onupdate ( Core * c )
return CR_OK;
}
DFhackCExport command_result mapitems (Core * c, vector <string> & parameters)
{
c->Suspend();
vector <df_item *> vec_items;
Gui * g = c-> getGui();
Maps* m = c->getMaps();
Items* it = c->getItems();
if(!m->Start())
{
c->con.printerr("No map to probe\n");
return CR_FAILURE;
}
if(!it->Start() || !it->readItemVector(vec_items))
{
c->con.printerr("Failed to get items\n");
return CR_FAILURE;
}
int32_t cx,cy,cz;
g->getCursorCoords(cx,cy,cz);
if(cx != -30000)
{
df_block * b = m->getBlock(cx/16,cy/16,cz);
if(b)
{
c->con.print("Item IDs present in block:\n");
auto iter_b = b->items.begin();
while (iter_b != b->items.end())
{
df_item * itmz = it->findItemByID(*iter_b);
string s;
itmz->getItemDescription(&s);
c->con.print("%d = %s\n",*iter_b, s.c_str());
iter_b++;
}
c->con.print("Items under cursor:\n");
auto iter_it = vec_items.begin();
while (iter_it != vec_items.end())
{
df_item * itm = *iter_it;
if(itm->x == cx && itm->y == cy && itm->z == cz)
{
string s;
itm->getItemDescription(&s,0);
c->con.print("%d = %s\n",itm->id, s.c_str());
}
iter_it ++;
}
}
}
c->Resume();
return CR_OK;
}
DFhackCExport command_result trackmenu (Core * c, vector <string> & parameters)
{
if(trackmenu_flg)
@ -189,53 +133,19 @@ DFhackCExport command_result trackpos (Core * c, vector <string> & parameters)
trackpos_flg = !trackpos_flg;
return CR_OK;
}
DFhackCExport command_result bflags (Core * c, vector <string> & parameters)
DFhackCExport command_result colormods (Core * c, vector <string> & parameters)
{
c->Suspend();
Gui * g = c-> getGui();
Maps* m = c->getMaps();
if(!m->Start())
{
c->con.printerr("No map to probe\n");
return CR_FAILURE;
}
int32_t cx,cy,cz;
g->getCursorCoords(cx,cy,cz);
if(cx == -30000)
auto & vec = df::global::world->raws.creatures.alphabetic;
for(int i = 0; i < vec.size();i++)
{
// get map size in blocks
uint32_t sx,sy,sz;
m->getSize(sx,sy,sz);
std::map <uint8_t, df_block *> counts;
// for each block
for(size_t x = 0; x < sx; x++)
for(size_t y = 0; y < sx; y++)
for(size_t z = 0; z < sx; z++)
{
df_block * b = m->getBlock(x,y,z);
if(!b) continue;
auto iter = counts.find(b->flags.size);
if(iter == counts.end())
{
counts[b->flags.bits[0]] = b;
}
}
for(auto iter = counts.begin(); iter != counts.end(); iter++)
df::creature_raw* rawlion = vec[i];
df::caste_raw * caste = rawlion->caste[0];
c->con.print("%s\nCaste addr 0x%x\n",rawlion->creature_id.c_str(), &caste->color_modifiers);
for(int j = 0; j < caste->color_modifiers.size();j++)
{
c->con.print("%2x : 0x%x\n",iter->first, iter->second);
}
}
else
{
df_block * b = m->getBlock(cx/16,cy/16,cz);
if(b)
{
c->con << "Block flags:" << b->flags << std::endl;
}
else
{
c->con.printerr("No block here\n");
return CR_FAILURE;
c->con.print("mod %d: 0x%x\n", j, caste->color_modifiers[j]);
}
}
c->Resume();
@ -328,71 +238,3 @@ DFhackCExport command_result kittens (Core * c, vector <string> & parameters)
color = Console::COLOR_BLUE;
}
}
#include "modules/Units.h"
#include "VersionInfo.h"
#include <stddef.h>
command_result test_creature_offsets(Core* c, vector< string >& parameters)
{
uint32_t off_vinfo = c->vinfo->getGroup("Creatures")->getGroup("creature")->/*getGroup("advanced")->*/getOffset("custom_profession");
uint32_t off_struct = offsetof(df_unit,custom_profession);
c->con.print("Struct 0x%x, vinfo 0x%x\n", off_struct, off_vinfo);
return CR_OK;
};
command_result creat_job (Core * c, vector< string >& parameters)
{
c->Suspend();
Units * cr = c->getUnits();
Gui * g = c-> getGui();
uint32_t num_cr = 0;
int32_t cx,cy,cz;
g->getCursorCoords(cx,cy,cz);
if(cx == -30000)
{
c->con.printerr("No cursor.\n");
c->Resume();
return CR_FAILURE;
}
if(!cr->Start(num_cr) || num_cr == 0)
{
c->con.printerr("No creatures.\n");
c->Resume();
return CR_FAILURE;
}
auto iter = cr->creatures->begin();
while (iter != cr->creatures->end())
{
df_unit * unit = *iter;
if(cx == unit->x && cy == unit->y && cz == unit->z)
{
c->con.print("%d:%s - address 0x%x - job 0x%x\n"
"Soul: 0x%x, likes: 0x%x\n",
unit->id,
unit->name.first_name.c_str(),
unit,
uint32_t(unit) + offsetof(df_unit,current_job),
uint32_t(unit) + offsetof(df_unit,current_soul),
uint32_t(unit->current_soul) + offsetof(df_soul,likes)
);
df_soul * s = unit->current_soul;
if(s)
{
c->con.print("LIKES:\n");
int idx = 1;
auto iter = s->likes.begin();
while(iter != s->likes.end())
{
df_like * l = *iter;
c->con.print("%3d: %f\n", idx, float(l->mystery));
iter++;
idx++;
}
}
}
iter++;
}
c->Resume();
return CR_OK;
};

@ -6,7 +6,7 @@
#include <string>
#include <modules/Materials.h>
#include <stdlib.h>
/*
using std::vector;
using std::string;
using namespace DFHack;
@ -136,4 +136,4 @@ DFhackCExport command_result rawdump_p (Core * c, vector <string> & parameters)
c->Resume();
return CR_OK;
}
*/

@ -1 +1 @@
Subproject commit c114ec5f995aec69631187212254309464f82775
Subproject commit 23fbb78edaff35a62887803e178a24f9148ffc84

@ -0,0 +1,107 @@
// Building and removing construction on a mineral floor will destroy the mineral, changing it to the layer stone
// Farm plots or paved roads do the same thing periodically (once every 500 ticks or so)
// This tool changes said tiles back into the mineral type they originally had
// It also fixes tiles marked as "mineral inclusion" where no inclusion is present,
// which generally happen as a result of improper use of the tiletypes plugin
#include "Core.h"
#include "Console.h"
#include "Export.h"
#include "PluginManager.h"
#include "DataDefs.h"
#include "modules/Maps.h"
#include "TileTypes.h"
using std::vector;
using std::string;
using namespace DFHack;
using namespace DFHack::Simple;
using namespace df::enums;
using df::global::world;
DFhackCExport command_result df_fixveins (Core * c, vector <string> & parameters)
{
if (parameters.size())
return CR_WRONG_USAGE;
CoreSuspender suspend(c);
if (!Maps::IsValid())
{
c->con.printerr("Map is not available!\n");
return CR_FAILURE;
}
int removed = 0;
int added = 0;
int num_blocks = 0, blocks_total = world->map.map_blocks.size();
for (int i = 0; i < blocks_total; i++)
{
df::map_block *block = world->map.map_blocks[i];
uint16_t has_mineral[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
for (int j = 0; j < block->block_events.size(); j++)
{
df::block_square_event *evt = block->block_events[j];
if (evt->getType() != block_square_event_type::mineral)
continue;
df::block_square_event_mineralst *mineral = (df::block_square_event_mineralst *)evt;
for (int k = 0; k < 16; k++)
has_mineral[k] |= mineral->tile_bitmask[k];
}
for (int x = 0; x < 16; x++)
{
for (int y = 0; y < 16; y++)
{
int16_t oldT = block->tiletype[x][y];
int16_t newT = oldT;
TileMaterial mat = tileMaterial(oldT);
if ((mat == VEIN) && !(has_mineral[y] & (1 << x)))
{
newT = findTileType(tileShape(oldT), STONE, tileVariant(oldT), tileSpecial(oldT), tileDirection(oldT));
if ((newT != -1) && (newT != oldT))
{
block->tiletype[x][y] = newT;
removed++;
}
}
if ((mat == STONE) && (has_mineral[y] & (1 << x)))
{
newT = findTileType(tileShape(oldT), VEIN, tileVariant(oldT), tileSpecial(oldT), tileDirection(oldT));
if ((newT != -1) && (newT != oldT))
{
block->tiletype[x][y] = newT;
added++;
}
}
}
}
}
if (removed)
c->con.print("Removed %i invalid references to mineral inclusions.\n", removed);
if (added)
c->con.print("Restored %i missing references to mineral inclusions.\n", added);
return CR_OK;
}
DFhackCExport const char * plugin_name ( void )
{
return "fixveins";
}
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("fixveins",
"Remove invalid references to mineral inclusions and restore missing ones.",
df_fixveins));
return CR_OK;
}
DFhackCExport command_result plugin_shutdown ( Core * c )
{
return CR_OK;
}

@ -39,7 +39,7 @@ LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS})
#Generate sources from our proto files and store them in the source tree
ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS}
COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto ${PROJECT_PROTOS}
COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${PROJECT_PROTOS}
DEPENDS protoc-bin ${PROJECT_PROTOS}
)

@ -12,6 +12,8 @@ using namespace DFHack;
#include "proto/Map.pb.h"
using namespace DFHack::Simple;
DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & parameters);
DFhackCExport const char * plugin_name ( void )
@ -41,7 +43,7 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
{
c->con.print("Exports the currently visible map to a file.\n"
"Usage: mapexport <filename>\n"
);
);
return CR_OK;
}
}
@ -67,8 +69,7 @@ DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & pa
MapExtras::MapCache map;
DFHack::Materials *mats = c->getMaterials();
DFHack::Vegetation *veg = c->getVegetation();
if (veg->Start())
if (!Vegetation::isValid())
{
c->con.printerr("Unable to read vegetation; plants won't be listed!\n" );
}

@ -1 +1 @@
Subproject commit 92627e39cb3502812cd5a131716d3d1da8ef625a
Subproject commit 66115070844f3bc1ae3f9142e43f7c110aa18159