|
|
@ -142,11 +142,6 @@ API::~API()
|
|
|
|
*-----------------------------------*/
|
|
|
|
*-----------------------------------*/
|
|
|
|
bool API::InitMap()
|
|
|
|
bool API::InitMap()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t x_array_loc, // location of the X array
|
|
|
|
|
|
|
|
temp_loc, // block location
|
|
|
|
|
|
|
|
temp_locx, // iterator for the X array
|
|
|
|
|
|
|
|
temp_locy, // iterator for the Y array
|
|
|
|
|
|
|
|
temp_locz; // iterator for the Z array
|
|
|
|
|
|
|
|
uint32_t map_offset = d->offset_descriptor->getAddress("map_data");
|
|
|
|
uint32_t map_offset = d->offset_descriptor->getAddress("map_data");
|
|
|
|
uint32_t x_count_offset = d->offset_descriptor->getAddress("x_count");
|
|
|
|
uint32_t x_count_offset = d->offset_descriptor->getAddress("x_count");
|
|
|
|
uint32_t y_count_offset = d->offset_descriptor->getAddress("y_count");
|
|
|
|
uint32_t y_count_offset = d->offset_descriptor->getAddress("y_count");
|
|
|
@ -157,8 +152,9 @@ bool API::InitMap()
|
|
|
|
d->designation_offset = d->offset_descriptor->getOffset("designation");
|
|
|
|
d->designation_offset = d->offset_descriptor->getOffset("designation");
|
|
|
|
d->occupancy_offset = d->offset_descriptor->getOffset("occupancy");
|
|
|
|
d->occupancy_offset = d->offset_descriptor->getOffset("occupancy");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// get the map pointer
|
|
|
|
// get the map pointer
|
|
|
|
x_array_loc = MreadDWord(map_offset);
|
|
|
|
uint32_t x_array_loc = MreadDWord(map_offset);
|
|
|
|
//FIXME: very inadequate
|
|
|
|
//FIXME: very inadequate
|
|
|
|
if (!x_array_loc)
|
|
|
|
if (!x_array_loc)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -751,7 +747,7 @@ uint32_t API::InitReadCreatures()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->p_cre = new DfVector(d->dm->readVector(creatures, 4));
|
|
|
|
d->p_cre = new DfVector(d->dm->readVector(creatures, 4));
|
|
|
|
InitReadNameTables();
|
|
|
|
//InitReadNameTables();
|
|
|
|
//if(d->InitReadNameTables())
|
|
|
|
//if(d->InitReadNameTables())
|
|
|
|
//{
|
|
|
|
//{
|
|
|
|
d->creaturesInited = true;
|
|
|
|
d->creaturesInited = true;
|
|
|
@ -963,7 +959,6 @@ int32_t API::ReadCreatureInBox(int32_t index, t_creature & furball,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint16_t coords[3];
|
|
|
|
uint16_t coords[3];
|
|
|
|
assert(d->creaturesInited);
|
|
|
|
assert(d->creaturesInited);
|
|
|
|
uint32_t temp;
|
|
|
|
|
|
|
|
uint32_t size = d->p_cre->getSize();
|
|
|
|
uint32_t size = d->p_cre->getSize();
|
|
|
|
while (index < size)
|
|
|
|
while (index < size)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1075,7 +1070,8 @@ void API::FinishReadNameTables()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete d->p_trans;
|
|
|
|
delete d->p_trans;
|
|
|
|
delete d->p_generic;
|
|
|
|
delete d->p_generic;
|
|
|
|
d->p_trans=d->p_generic=NULL;
|
|
|
|
delete d->p_dwarf_names;
|
|
|
|
|
|
|
|
d->p_trans=d->p_generic=d->p_dwarf_names=NULL;
|
|
|
|
d->nameTablesInited=false;
|
|
|
|
d->nameTablesInited=false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1084,7 +1080,7 @@ void API::FinishReadCreatures()
|
|
|
|
delete d->p_cre;
|
|
|
|
delete d->p_cre;
|
|
|
|
d->p_cre = NULL;
|
|
|
|
d->p_cre = NULL;
|
|
|
|
d->creaturesInited = false;
|
|
|
|
d->creaturesInited = false;
|
|
|
|
FinishReadNameTables();
|
|
|
|
//FinishReadNameTables();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool API::Attach()
|
|
|
|
bool API::Attach()
|
|
|
|