|
|
@ -243,11 +243,11 @@ namespace DFHack
|
|
|
|
struct TileRow
|
|
|
|
struct TileRow
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const char * name;
|
|
|
|
const char * name;
|
|
|
|
TileClass c;
|
|
|
|
TileClass shape;
|
|
|
|
TileMaterial m;
|
|
|
|
TileMaterial material;
|
|
|
|
TileVariant v;
|
|
|
|
TileVariant variant;
|
|
|
|
TileSpecial s;
|
|
|
|
TileSpecial special;
|
|
|
|
TileDirection d;
|
|
|
|
TileDirection direction;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define TILE_TYPE_ARRAY_LENGTH 520
|
|
|
|
#define TILE_TYPE_ARRAY_LENGTH 520
|
|
|
@ -886,7 +886,7 @@ namespace DFHack
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
bool LowPassable(uint16_t tiletype)
|
|
|
|
bool LowPassable(uint16_t tiletype)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch(DFHack::tileTypeTable[tiletype].c)
|
|
|
|
switch(DFHack::tileTypeTable[tiletype].shape)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case DFHack::EMPTY:
|
|
|
|
case DFHack::EMPTY:
|
|
|
|
case DFHack::STAIR_DOWN:
|
|
|
|
case DFHack::STAIR_DOWN:
|
|
|
@ -902,7 +902,7 @@ namespace DFHack
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
bool HighPassable(uint16_t tiletype)
|
|
|
|
bool HighPassable(uint16_t tiletype)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch(DFHack::tileTypeTable[tiletype].c)
|
|
|
|
switch(DFHack::tileTypeTable[tiletype].shape)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case DFHack::EMPTY:
|
|
|
|
case DFHack::EMPTY:
|
|
|
|
case DFHack::STAIR_DOWN:
|
|
|
|
case DFHack::STAIR_DOWN:
|
|
|
@ -926,44 +926,44 @@ namespace DFHack
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
bool FlowPassable(uint16_t tiletype)
|
|
|
|
bool FlowPassable(uint16_t tiletype)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TileClass tc = tileTypeTable[tiletype].c;
|
|
|
|
TileClass tc = tileTypeTable[tiletype].shape;
|
|
|
|
return tc != WALL && tc != PILLAR && tc != TREE_DEAD && tc != TREE_OK;
|
|
|
|
return tc != WALL && tc != PILLAR && tc != TREE_DEAD && tc != TREE_OK;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
bool isWallTerrain(int in)
|
|
|
|
bool isWallTerrain(int in)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return tileTypeTable[in].c >= WALL && tileTypeTable[in].c <= FORTIFICATION ;
|
|
|
|
return tileTypeTable[in].shape >= WALL && tileTypeTable[in].shape <= FORTIFICATION ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
bool isFloorTerrain(int in)
|
|
|
|
bool isFloorTerrain(int in)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return tileTypeTable[in].c >= FLOOR && tileTypeTable[in].c <= PEBBLES;
|
|
|
|
return tileTypeTable[in].shape >= FLOOR && tileTypeTable[in].shape <= PEBBLES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
bool isRampTerrain(int in)
|
|
|
|
bool isRampTerrain(int in)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return tileTypeTable[in].c == RAMP;
|
|
|
|
return tileTypeTable[in].shape == RAMP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
bool isStairTerrain(int in)
|
|
|
|
bool isStairTerrain(int in)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return tileTypeTable[in].c >= STAIR_UP && tileTypeTable[in].c <= STAIR_UPDOWN;
|
|
|
|
return tileTypeTable[in].shape >= STAIR_UP && tileTypeTable[in].shape <= STAIR_UPDOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
bool isOpenTerrain(int in)
|
|
|
|
bool isOpenTerrain(int in)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return tileTypeTable[in].c == EMPTY;
|
|
|
|
return tileTypeTable[in].shape == EMPTY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
inline
|
|
|
|
int getVegetationType(int in)
|
|
|
|
int getVegetationType(int in)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return tileTypeTable[in].c;
|
|
|
|
return tileTypeTable[in].shape;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//zilpin: for convenience, when you'll be using the tile information a lot.
|
|
|
|
//zilpin: for convenience, when you'll be using the tile information a lot.
|
|
|
@ -984,11 +984,11 @@ namespace DFHack
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int32_t tt;
|
|
|
|
int32_t tt;
|
|
|
|
for(tt=0;tt<TILE_TYPE_ARRAY_LENGTH; ++tt){
|
|
|
|
for(tt=0;tt<TILE_TYPE_ARRAY_LENGTH; ++tt){
|
|
|
|
if( tclass>-1 ) if( tclass != tileTypeTable[tt].c ) continue;
|
|
|
|
if( tclass>-1 ) if( tclass != tileTypeTable[tt].shape ) continue;
|
|
|
|
if( tmat>-1 ) if( tmat != tileTypeTable[tt].m ) continue;
|
|
|
|
if( tmat>-1 ) if( tmat != tileTypeTable[tt].material ) continue;
|
|
|
|
if( tvar>-1 ) if( tvar != tileTypeTable[tt].v ) continue;
|
|
|
|
if( tvar>-1 ) if( tvar != tileTypeTable[tt].variant ) continue;
|
|
|
|
if( tspecial>-1 ) if( tspecial != tileTypeTable[tt].s ) continue;
|
|
|
|
if( tspecial>-1 ) if( tspecial != tileTypeTable[tt].special ) continue;
|
|
|
|
if( tdir.whole ) if( tdir.whole != tileTypeTable[tt].d.whole ) continue;
|
|
|
|
if( tdir.whole ) if( tdir.whole != tileTypeTable[tt].direction.whole ) continue;
|
|
|
|
//Match!
|
|
|
|
//Match!
|
|
|
|
return tt;
|
|
|
|
return tt;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1023,20 +1023,20 @@ namespace DFHack
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
for(tt=0;tt<TILE_TYPE_ARRAY_LENGTH; ++tt){
|
|
|
|
for(tt=0;tt<TILE_TYPE_ARRAY_LENGTH; ++tt){
|
|
|
|
if( tclass == tileTypeTable[tt].c ){
|
|
|
|
if( tclass == tileTypeTable[tt].shape ){
|
|
|
|
//shortcut null entries
|
|
|
|
//shortcut null entries
|
|
|
|
if(!tileTypeTable[tt].name) continue;
|
|
|
|
if(!tileTypeTable[tt].name) continue;
|
|
|
|
|
|
|
|
|
|
|
|
//Special flag match is absolutely mandatory!
|
|
|
|
//Special flag match is absolutely mandatory!
|
|
|
|
if( source->s != tileTypeTable[tt].s ) continue;
|
|
|
|
if( source->special != tileTypeTable[tt].special ) continue;
|
|
|
|
|
|
|
|
|
|
|
|
maybe=tt; value=0;
|
|
|
|
maybe=tt; value=0;
|
|
|
|
//Material is high-value match
|
|
|
|
//Material is high-value match
|
|
|
|
if( tileTypeTable[tt].m == source->m ) value|=8;
|
|
|
|
if( tileTypeTable[tt].material == source->material ) value|=8;
|
|
|
|
//Direction is medium value match
|
|
|
|
//Direction is medium value match
|
|
|
|
if( tileTypeTable[tt].d.whole == source->d.whole ) value|=4;
|
|
|
|
if( tileTypeTable[tt].direction.whole == source->direction.whole ) value|=4;
|
|
|
|
//Variant is low-value match
|
|
|
|
//Variant is low-value match
|
|
|
|
if( tileTypeTable[tt].v == source->v ) value|=1;
|
|
|
|
if( tileTypeTable[tt].variant == source->variant ) value|=1;
|
|
|
|
|
|
|
|
|
|
|
|
//Check value against last match
|
|
|
|
//Check value against last match
|
|
|
|
if( value>matchv ){
|
|
|
|
if( value>matchv ){
|
|
|
|