Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Get rid of Simple namespace, Gui module is now a namespace.

  • Loading branch information...
commit 34183f96b86394895975fb59ae3c4673cd78f502 1 parent 58147c3
@peterix peterix authored
View
4 Block.h
@@ -66,7 +66,7 @@ class Block
DFHack::t_designation designation;
DFHack::t_occupancy occ;
- DFHack::Simple::Units::t_unit * creature;
+ DFHack::Units::t_unit * creature;
DFHack::t_matglossPair tree;
int mudlevel;
@@ -110,7 +110,7 @@ class Block
Effect Eff_OceanWave;
Effect Eff_SeaFoam;
struct {
- DFHack::Simple::Buildings::t_building info;
+ DFHack::Buildings::t_building info;
std::vector<c_sprite> sprites;
uint32_t index;
Block * parent;
View
2  BlockTree.cpp
@@ -23,7 +23,7 @@ void insert_sprite(WorldSegment *w, int x, int y, int z, Block * parent, c_sprit
w->addBlock(b_orig);
}
b_orig->building.sprites.push_back(sprite);
- if(b_orig->building.info.type == BUILDINGTYPE_NA)
+ if(b_orig->building.info.type == (building_type::building_type) BUILDINGTYPE_NA)
b_orig->building.info.type = (building_type::building_type) BUILDINGTYPE_TREE;
b_orig->building.parent = parent;
}
View
20 Creatures.cpp
@@ -322,7 +322,7 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
int z2 = segment->z + segment->sizez;
uint32_t numcreatures;
- numcreatures = DFHack::Simple::Units::getNumCreatures();
+ numcreatures = DFHack::Units::getNumCreatures();
if(!numcreatures) return;
if(x1<0) x1=0;
if(y1<0) y1=0;
@@ -334,14 +334,14 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
t_unit *tempcreature = new t_unit();
df::unit *unit_ptr = 0;
uint32_t index = 0;
- while((index = DFHack::Simple::Units::GetCreatureInBox( index, &unit_ptr, x1,y1,z1,x2,y2,z2)) != -1 )
+ while((index = DFHack::Units::GetCreatureInBox( index, &unit_ptr, x1,y1,z1,x2,y2,z2)) != -1 )
{
index++;
// if the creature isn't visible, we need not process it further.
if( !IsCreatureVisible( unit_ptr ) )
continue;
// make a copy of some creature data
- DFHack::Simple::Units::CopyCreature(unit_ptr,*tempcreature);
+ DFHack::Units::CopyCreature(unit_ptr,*tempcreature);
// Acquire a cube element thingie!
Block* b = segment->getBlock (tempcreature->x, tempcreature->y, tempcreature->z );
// If we failed at that, make a new one out of fairy dust and makebelieve ;)
@@ -367,16 +367,16 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
// add shadow to nearest floor block
for (int bz = tempcreature->z;bz>=z1;bz--)
{
- b = segment->getBlock (tempcreature->x, tempcreature->y, bz );
- if (!b) continue;
- if (b->tileShapeBasic==tiletype_shape_basic::Floor ||
- b->tileShapeBasic==tiletype_shape_basic::Wall ||
- b->tileShapeBasic==tiletype_shape_basic::Ramp)
+ Block * floor_tile = segment->getBlock (tempcreature->x, tempcreature->y, bz );
+ if (!floor_tile) continue;
+ if (floor_tile->tileShapeBasic==tiletype_shape_basic::Floor ||
+ floor_tile->tileShapeBasic==tiletype_shape_basic::Wall ||
+ floor_tile->tileShapeBasic==tiletype_shape_basic::Ramp)
{
// todo figure out appropriate shadow size
int tempShadow = GetCreatureShadowMap( tempcreature );
- if (b->shadow < tempShadow)
- b->shadow=tempShadow;
+ if (floor_tile->shadow < tempShadow)
+ floor_tile->shadow=tempShadow;
break;
}
}
View
2  Creatures.h
@@ -7,7 +7,7 @@
class Block;
-using DFHack::Simple::Units::t_unit;
+using DFHack::Units::t_unit;
void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment);
View
140 MapLoading.cpp
@@ -19,7 +19,6 @@ bool connected = 0;
bool threadrunnng = 0;
segParams parms;
-using namespace DFHack::Simple;
inline bool IDisWall(int in){
//if not a custom type, do a lookup in dfHack's interface
@@ -622,8 +621,6 @@ WorldSegment* ReadMapSegment(DFHack::Core &DF, int x, int y, int z, int sizex, i
clock_t start_time = clock();
DFHack::Materials *Mats = DF.getMaterials();
- DFHack::Gui *Pos = DF.getGui();
-
DFHack::World *Wold = 0;
if(!config.skipWorld)
{
@@ -711,7 +708,7 @@ WorldSegment* ReadMapSegment(DFHack::Core &DF, int x, int y, int z, int sizex, i
}
//read cursor
- Pos->getCursorCoords(config.dfCursorX, config.dfCursorY, config.dfCursorZ);
+ Gui::getCursorCoords(config.dfCursorX, config.dfCursorY, config.dfCursorZ);
// read constructions
vector<df::construction> allConstructions;
@@ -1001,96 +998,59 @@ void beautify_Segment(WorldSegment * segment)
void FollowCurrentDFWindow()
{
- int32_t newviewx;
- int32_t newviewy;
- int32_t viewsizex;
- int32_t viewsizey;
- int32_t newviewz;
- int32_t mapx, mapy, mapz;
- DFHack::Gui *Pos =pDFApiHandle->getGui();
- try
- {
- if (Pos)
- {
- // we take the rectangle you'd get if you scrolled the DF view closely around
- // map edges with a pen pierced through the center,
- // compute the scaling factor between this rectangle and the map bounds and then scale
- // the coords with this scaling factor
- /**
-
- +---+
- |W+-++----------+
- +-+-+---------+ |
- | | | |
- | | inner | |
- | | rect. | |
- | | | |
- | | | |--- map boundary
- | +---------+ |
- +-------------+ W - corrected view
-
- */
- Maps::getSize((uint32_t &)mapx, (uint32_t &)mapy, (uint32_t &)mapz);
- mapx *= 16;
- mapy *= 16;
-
- Pos->getWindowSize(viewsizex,viewsizey);
- float scalex = float (mapx) / float (mapx - viewsizex);
- float scaley = float (mapy) / float (mapy - viewsizey);
-
- Pos->getViewCoords(newviewx,newviewy,newviewz);
- newviewx = newviewx + (viewsizex / 2) - mapx / 2;
- newviewy = newviewy + (viewsizey / 2) - mapy / 2;
-
- parms.x = float (newviewx) * scalex - (config.segmentSize.x / 2) + config.viewXoffset + mapx / 2;
- parms.y = float (newviewy) * scaley - (config.segmentSize.y / 2) + config.viewYoffset + mapy / 2;
- parms.z = newviewz + config.viewZoffset + 1;
-
- }
- else
- {
- //fail
- config.follow_DFscreen = false;
- }
- }
- catch(exception &err)
- {
- WriteErr("DFhack exeption: %s \n", err.what());
- config.follow_DFscreen = false;
- }
+ int32_t newviewx;
+ int32_t newviewy;
+ int32_t viewsizex;
+ int32_t viewsizey;
+ int32_t newviewz;
+ int32_t mapx, mapy, mapz;
+ // we take the rectangle you'd get if you scrolled the DF view closely around
+ // map edges with a pen pierced through the center,
+ // compute the scaling factor between this rectangle and the map bounds and then scale
+ // the coords with this scaling factor
+ /**
+ +---+
+ |W+-++----------+
+ +-+-+---------+ |
+ | | | |
+ | | inner | |
+ | | rect. | |
+ | | | |
+ | | | |--- map boundary
+ | +---------+ |
+ +-------------+ W - corrected view
+ */
+ Maps::getSize((uint32_t &)mapx, (uint32_t &)mapy, (uint32_t &)mapz);
+ mapx *= 16;
+ mapy *= 16;
+
+ Gui::getWindowSize(viewsizex,viewsizey);
+ float scalex = float (mapx) / float (mapx - viewsizex);
+ float scaley = float (mapy) / float (mapy - viewsizey);
+
+ Gui::getViewCoords(newviewx,newviewy,newviewz);
+ newviewx = newviewx + (viewsizex / 2) - mapx / 2;
+ newviewy = newviewy + (viewsizey / 2) - mapy / 2;
+
+ parms.x = float (newviewx) * scalex - (config.segmentSize.x / 2) + config.viewXoffset + mapx / 2;
+ parms.y = float (newviewy) * scaley - (config.segmentSize.y / 2) + config.viewYoffset + mapy / 2;
+ parms.z = newviewz + config.viewZoffset + 1;
}
void FollowCurrentDFCenter()
{
- int32_t newviewx;
- int32_t newviewy;
- int32_t viewsizex;
- int32_t viewsizey;
- int32_t newviewz;
- DFHack::Gui *Pos =pDFApiHandle->getGui();
- try
- {
- if (Pos)
- {
- Pos->getWindowSize(viewsizex,viewsizey);
- Pos->getViewCoords(newviewx,newviewy,newviewz);
- int screenx, screeny, screenz;
- ScreenToPoint(config.screenWidth/2, config.screenHeight/2, screenx, screeny, screenz);
- parms.x = newviewx + (viewsizex/2) - screenx + config.viewXoffset;
- parms.y = newviewy + (viewsizey/2) - screeny + config.viewYoffset;
- parms.z = newviewz + config.viewZoffset + 1;
- }
- else
- {
- //fail
- config.follow_DFscreen = false;
- }
- }
- catch(exception &err)
- {
- WriteErr("DFhack exeption: %s \n", err.what());
- config.follow_DFscreen = false;
- }
+ int32_t newviewx;
+ int32_t newviewy;
+ int32_t viewsizex;
+ int32_t viewsizey;
+ int32_t newviewz;
+ Gui::getWindowSize(viewsizex,viewsizey);
+ Gui::getViewCoords(newviewx,newviewy,newviewz);
+ int screenx, screeny, screenz;
+ ScreenToPoint(config.screenWidth/2, config.screenHeight/2, screenx, screeny, screenz);
+ parms.x = newviewx + (viewsizex/2) - screenx + config.viewXoffset;
+ parms.y = newviewy + (viewsizey/2) - screeny + config.viewYoffset;
+ parms.z = newviewz + config.viewZoffset + 1;
}
void read_segment( void *arg)
View
1  common.h
@@ -18,7 +18,6 @@
#include <Export.h>
#include <PluginManager.h>
using namespace DFHack;
-using namespace DFHack::Simple;
using namespace df::enums;
#define ALLEGRO_NO_MAGIC_MAIN //This is a DLL file. we got no main function.
Please sign in to comment.
Something went wrong with that request. Please try again.