summaryrefslogtreecommitdiff
path: root/Creatures.cpp
diff options
context:
space:
mode:
authorPetr Mrázek2012-01-27 05:52:06 +0100
committerPetr Mrázek2012-01-27 05:52:06 +0100
commit66115070844f3bc1ae3f9142e43f7c110aa18159 (patch)
tree661a3c27bcdc105ea890e117dfb1f3790e5a0c0c /Creatures.cpp
parent92627e39cb3502812cd5a131716d3d1da8ef625a (diff)
downloadstonesense-66115070844f3bc1ae3f9142e43f7c110aa18159.tar.gz
stonesense-66115070844f3bc1ae3f9142e43f7c110aa18159.tar.bz2
stonesense-66115070844f3bc1ae3f9142e43f7c110aa18159.tar.xz
Major stonesense fixage.
Diffstat (limited to 'Creatures.cpp')
-rw-r--r--Creatures.cpp37
1 files changed, 7 insertions, 30 deletions
diff --git a/Creatures.cpp b/Creatures.cpp
index 136c7bd..b0ba69b 100644
--- a/Creatures.cpp
+++ b/Creatures.cpp
@@ -6,7 +6,8 @@
#include "GUI.h"
#include "Block.h"
#include "SpriteColors.h"
-
+#include "DataDefs.h"
+#include "df/world.h"
//vector<t_matgloss> v_creatureNames;
//vector<CreatureConfiguration> creatureTypes;
@@ -307,7 +308,7 @@ void DrawCreatureText(int drawx, int drawy, t_unit* creature ){
}
//t_creature* global = 0;
-
+using df::global::world;
void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
{
int x1 = segment->x;
@@ -317,31 +318,8 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
int z1 = segment->z;
int z2 = segment->z + segment->sizez;
uint32_t numcreatures;
- DFHack::Units * Creatures;
- if(!config.skipCreatures)
- {
- try
- {
- Creatures = DF.getUnits();
- }
- catch(exception &err)
- {
- WriteErr("DFhack exeption: %s\n", err.what());
- config.skipCreatures = true;
- return;
- }
- }
- try
- {
- if(!Creatures->Start(numcreatures)) return;
- }
- catch(exception &err)
- {
- WriteErr("DFhack exeption: %s \n", err.what());
- config.skipCreatures = true;
- return;
- }
+ numcreatures = DFHack::Simple::Units::getNumCreatures();
if(!numcreatures) return;
if(x1<0) x1=0;
if(y1<0) y1=0;
@@ -351,7 +329,7 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
if(z2<0) z2=0;
t_unit *tempcreature = new t_unit();
- df_unit *unit_ptr = 0;
+ df::unit *unit_ptr = 0;
/*for (uint32_t index = 0; index < numcreatures ; index++)
{
Creatures->ReadCreature( index, *tempcreature );*/
@@ -360,9 +338,9 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
{
try
{
- while((index = Creatures->GetCreatureInBox( index, &unit_ptr, x1,y1,z1,x2,y2,z2)) != -1 )
+ while((index = DFHack::Simple::Units::GetCreatureInBox( index, &unit_ptr, x1,y1,z1,x2,y2,z2)) != -1 )
{
- Creatures->CopyCreature(unit_ptr,*tempcreature);
+ DFHack::Simple::Units::CopyCreature(unit_ptr,*tempcreature);
index++;
if( IsCreatureVisible( tempcreature ) )
{
@@ -410,7 +388,6 @@ void ReadCreaturesToSegment( DFHack::Core& DF, WorldSegment* segment)
}
}
delete(tempcreature); // there will be one left over
- Creatures->Finish();
}