Make all "origin" fields strongly typed, and fix building.origin to actually be meaningful

develop
Quietust 2012-01-28 14:12:41 -06:00
parent 9e40228767
commit 8a4740c479
4 changed files with 11 additions and 7 deletions

@ -24,6 +24,8 @@ distribution.
#pragma once #pragma once
#include "Export.h" #include "Export.h"
#include "DataDefs.h"
#include "df/building.h"
namespace DFHack namespace DFHack
{ {
@ -45,7 +47,7 @@ struct t_building
t_matglossPair material; t_matglossPair material;
uint32_t type; uint32_t type;
int32_t custom_type; int32_t custom_type;
void * origin; df::building * origin;
}; };
/** /**

@ -39,7 +39,7 @@ distribution.
#include "modules/Materials.h" #include "modules/Materials.h"
#include "df/world.h" #include "df/world.h"
#include "df/feature_type.h" #include "df/feature_init.h"
#include "df/map_block.h" #include "df/map_block.h"
#include "df/block_square_event.h" #include "df/block_square_event.h"
#include "df/block_square_event_mineralst.h" #include "df/block_square_event_mineralst.h"
@ -84,7 +84,7 @@ struct t_feature
/// placeholder /// placeholder
bool discovered; bool discovered;
/// this is NOT part of the DF feature, but an address of the feature as seen by DFhack. /// this is NOT part of the DF feature, but an address of the feature as seen by DFhack.
void * origin; df::feature_init * origin;
}; };
/** /**
@ -178,7 +178,7 @@ typedef struct
/// values used for geology/biome assignment /// values used for geology/biome assignment
biome_indices40d biome_indices; biome_indices40d biome_indices;
/// the address where the block came from /// the address where the block came from
void * origin; df::map_block * origin;
t_blockflags blockflags; t_blockflags blockflags;
/// index into the global feature vector /// index into the global feature vector
int32_t global_feature; int32_t global_feature;

@ -3,6 +3,9 @@
* \defgroup grp_vermin Wild vermin (ants, bees, etc) * \defgroup grp_vermin Wild vermin (ants, bees, etc)
*/ */
#include "Export.h" #include "Export.h"
#include "DataDefs.h"
#include "df/vermin.h"
namespace DFHack { namespace Simple { namespace Vermin namespace DFHack { namespace Simple { namespace Vermin
{ {
/** /**
@ -11,7 +14,7 @@ namespace DFHack { namespace Simple { namespace Vermin
*/ */
struct t_vermin struct t_vermin
{ {
void * origin; df::vermin * origin;
int16_t race; int16_t race;
int16_t caste; int16_t caste;
uint16_t x; uint16_t x;

@ -43,7 +43,6 @@ using namespace DFHack::Simple;
#include "DataDefs.h" #include "DataDefs.h"
#include "df/world.h" #include "df/world.h"
#include "df/building_def.h" #include "df/building_def.h"
#include "df/building.h"
#include "df/building_workshopst.h" #include "df/building_workshopst.h"
using namespace df::enums; using namespace df::enums;
@ -72,7 +71,7 @@ bool Buildings::Read (const uint32_t index, t_building & building)
building.material.type = bld_40d->mat_type; building.material.type = bld_40d->mat_type;
building.type = type; building.type = type;
building.custom_type = bld_40d->getCustomType(); building.custom_type = bld_40d->getCustomType();
building.origin = (void *) &bld_40d; building.origin = bld_40d;
return true; return true;
} }