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-08-20 06:10:05 -06:00
|
|
|
#include "dfhack/VersionInfo.h"
|
2010-05-25 22:48:23 -06:00
|
|
|
#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
|
2010-06-24 23:11:26 -06:00
|
|
|
allModules.clear();
|
|
|
|
memset(&(s_mods), 0, sizeof(s_mods));
|
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
|
|
|
{
|
2010-06-24 23:11:26 -06:00
|
|
|
// invalidate all modules
|
|
|
|
for(int i = 0 ; i < allModules.size(); i++)
|
|
|
|
{
|
|
|
|
delete allModules[i];
|
|
|
|
}
|
|
|
|
allModules.clear();
|
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-08-30 22:52:03 -06:00
|
|
|
OffsetGroup * OG = offset_descriptor->getGroup("name");
|
|
|
|
name_firstname_offset = OG->getOffset("first");
|
|
|
|
name_nickname_offset = OG->getOffset("nick");
|
|
|
|
name_words_offset = OG->getOffset("second_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
|
|
|
}
|