forked from DFHack/dfhack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPIPrivate.cpp
More file actions
62 lines (56 loc) · 1.61 KB
/
Copy pathAPIPrivate.cpp
File metadata and controls
62 lines (56 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "DFCommonInternal.h"
#include <shms.h>
#include <mod-core.h>
#include <mod-maps.h>
#include <mod-creature40d.h>
#include "private/APIPrivate.h"
#include "DFMemInfo.h"
#include "DFProcess.h"
#include "modules/Creatures.h"
#include "modules/Maps.h"
#include "modules/Materials.h"
#include "modules/Position.h"
#include "modules/Translation.h"
#include "modules/Vegetation.h"
#include "modules/Gui.h"
#include "modules/Buildings.h"
#include "modules/Constructions.h"
using namespace DFHack;
APIPrivate::APIPrivate()
{
// init modules
creatures = 0;
maps = 0;
position = 0;
gui = 0;
materials = 0;
translation = 0;
vegetation = 0;
buildings = 0;
constructions = 0;
}
APIPrivate::~APIPrivate()
{
if(creatures) delete creatures;
if(maps) delete maps;
if(position) delete position;
if(gui) delete gui;
if(materials) delete materials;
if(translation) delete translation;
if(vegetation) delete vegetation;
if(buildings) delete buildings;
if(constructions) delete constructions;
}
bool APIPrivate::InitReadNames()
{
name_firstname_offset = offset_descriptor->getOffset("name_firstname");
name_nickname_offset = offset_descriptor->getOffset("name_nickname");
name_words_offset = offset_descriptor->getOffset("name_words");
return true;
}
void APIPrivate::readName(t_name & name, uint32_t address)
{
g_pProcess->readSTLString(address + name_firstname_offset , name.first_name, 128);
g_pProcess->readSTLString(address + name_nickname_offset , name.nickname, 128);
g_pProcess->read(address + name_words_offset ,48, (uint8_t *) name.words);
}