2010-05-26 04:24:45 -06:00
|
|
|
#include "Internal.h"
|
2010-04-02 19:52:46 -06:00
|
|
|
#include <shms.h>
|
|
|
|
#include <mod-core.h>
|
|
|
|
#include <mod-maps.h>
|
|
|
|
#include <mod-creature40d.h>
|
2010-05-26 04:24:45 -06:00
|
|
|
#include "private/ContextShared.h"
|
2010-05-25 22:48:23 -06:00
|
|
|
#include "dfhack/DFMemInfo.h"
|
|
|
|
#include "dfhack/DFProcess.h"
|
2010-04-04 16:48:19 -06:00
|
|
|
|
2010-05-26 00:42:09 -06:00
|
|
|
#include "dfhack/modules/Materials.h"
|
|
|
|
#include "dfhack/modules/Creatures.h"
|
|
|
|
#include "dfhack/modules/Maps.h"
|
|
|
|
#include "dfhack/modules/Position.h"
|
|
|
|
#include "dfhack/modules/Translation.h"
|
|
|
|
#include "dfhack/modules/Vegetation.h"
|
|
|
|
#include "dfhack/modules/Gui.h"
|
|
|
|
#include "dfhack/modules/World.h"
|
|
|
|
#include "dfhack/modules/Buildings.h"
|
|
|
|
#include "dfhack/modules/Constructions.h"
|
2010-05-26 07:15:14 -06:00
|
|
|
#include "dfhack/modules/WindowIO.h"
|
2010-04-04 16:48:19 -06:00
|
|
|
|
|
|
|
using namespace DFHack;
|
2010-04-02 19:52:46 -06:00
|
|
|
|
2010-05-26 04:24:45 -06:00
|
|
|
DFContextShared::DFContextShared()
|
2010-04-02 19:52:46 -06:00
|
|
|
{
|
2010-04-04 16:48:19 -06:00
|
|
|
// init modules
|
|
|
|
creatures = 0;
|
|
|
|
maps = 0;
|
|
|
|
position = 0;
|
|
|
|
gui = 0;
|
2010-05-12 07:27:51 -06:00
|
|
|
world = 0;
|
2010-04-04 16:48:19 -06:00
|
|
|
materials = 0;
|
2010-04-06 17:17:03 -06:00
|
|
|
translation = 0;
|
2010-04-07 04:49:37 -06:00
|
|
|
vegetation = 0;
|
2010-04-09 16:24:41 -06:00
|
|
|
buildings = 0;
|
|
|
|
constructions = 0;
|
2010-05-12 07:27:51 -06:00
|
|
|
items = 0;
|
2010-05-26 04:24:45 -06:00
|
|
|
windowio = 0;
|
2010-04-04 16:48:19 -06:00
|
|
|
}
|
|
|
|
|
2010-05-26 04:24:45 -06:00
|
|
|
DFContextShared::~DFContextShared()
|
2010-04-04 16:48:19 -06:00
|
|
|
{
|
|
|
|
if(creatures) delete creatures;
|
|
|
|
if(maps) delete maps;
|
|
|
|
if(position) delete position;
|
|
|
|
if(gui) delete gui;
|
|
|
|
if(materials) delete materials;
|
2010-04-06 17:17:03 -06:00
|
|
|
if(translation) delete translation;
|
2010-04-07 04:49:37 -06:00
|
|
|
if(vegetation) delete vegetation;
|
2010-04-09 16:24:41 -06:00
|
|
|
if(buildings) delete buildings;
|
|
|
|
if(constructions) delete constructions;
|
2010-05-12 07:27:51 -06:00
|
|
|
if(world) delete world;
|
2010-05-26 04:24:45 -06:00
|
|
|
if(windowio) delete windowio;
|
2010-04-02 19:52:46 -06:00
|
|
|
}
|
|
|
|
|
2010-05-26 04:24:45 -06:00
|
|
|
bool DFContextShared::InitReadNames()
|
2010-04-02 19:52:46 -06:00
|
|
|
{
|
2010-04-04 16:48:19 -06:00
|
|
|
name_firstname_offset = offset_descriptor->getOffset("name_firstname");
|
|
|
|
name_nickname_offset = offset_descriptor->getOffset("name_nickname");
|
|
|
|
name_words_offset = offset_descriptor->getOffset("name_words");
|
2010-04-02 19:52:46 -06:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-05-26 04:24:45 -06:00
|
|
|
void DFContextShared::readName(t_name & name, uint32_t address)
|
2010-04-02 19:52:46 -06:00
|
|
|
{
|
2010-04-18 13:30:02 -06:00
|
|
|
p->readSTLString(address + name_firstname_offset , name.first_name, 128);
|
|
|
|
p->readSTLString(address + name_nickname_offset , name.nickname, 128);
|
|
|
|
p->read(address + name_words_offset ,48, (uint8_t *) name.words);
|
2010-04-28 09:40:27 -06:00
|
|
|
}
|