Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7ecda1

Browse files
committed
Kill the Maps module
1 parent e7dcd4c commit e7ecda1

17 files changed

Lines changed: 769 additions & 1072 deletions

library/Core.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,6 @@ TYPE * Core::get##TYPE() \
10901090

10911091
MODULE_GETTER(Units);
10921092
MODULE_GETTER(Engravings);
1093-
MODULE_GETTER(Maps);
10941093
MODULE_GETTER(Gui);
10951094
MODULE_GETTER(World);
10961095
MODULE_GETTER(Materials);

library/include/Core.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ namespace DFHack
5454
class Module;
5555
class Units;
5656
class Engravings;
57-
class Maps;
5857
class Gui;
5958
class World;
6059
class Materials;
@@ -102,8 +101,6 @@ namespace DFHack
102101
Units * getUnits();
103102
/// get the engravings module
104103
Engravings * getEngravings();
105-
/// get the maps module
106-
Maps * getMaps();
107104
/// get the gui module
108105
Gui * getGui();
109106
/// get the world module
@@ -166,7 +163,6 @@ namespace DFHack
166163
{
167164
Units * pUnits;
168165
Engravings * pEngravings;
169-
Maps * pMaps;
170166
Gui * pGui;
171167
World * pWorld;
172168
Materials * pMaterials;

library/include/ModuleFactory.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ namespace DFHack
3939
Module* createVegetation();
4040
Module* createBuildings();
4141
Module* createConstructions();
42-
Module* createMaps();
4342
Module* createNotes();
4443
Module* createGraphic();
4544
}

library/include/modules/MapCache.h

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ distribution.
3232
#include <cstring>
3333
#include "df/map_block.h"
3434
#include "df/block_square_event_mineralst.h"
35+
using namespace DFHack;
36+
using namespace DFHack::Simple;
3537
namespace MapExtras
3638
{
37-
void SquashVeins (DFHack::Maps *m, DFHack::DFCoord bcoord, DFHack::mapblock40d & mb, DFHack::t_blockmaterials & materials)
39+
void SquashVeins (DFCoord bcoord, mapblock40d & mb, t_blockmaterials & materials)
3840
{
3941
memset(materials,-1,sizeof(materials));
4042
std::vector <df::block_square_event_mineralst *> veins;
41-
m->SortBlockEvents(bcoord.x,bcoord.y,bcoord.z,&veins);
43+
Maps::SortBlockEvents(bcoord.x,bcoord.y,bcoord.z,&veins);
4244
//iterate through block rows
4345
for(uint32_t j = 0;j<16;j++)
4446
{
@@ -83,20 +85,19 @@ void SquashRocks ( std::vector< std::vector <uint16_t> > * layerassign, DFHack::
8385
class Block
8486
{
8587
public:
86-
Block(DFHack::Maps *_m, DFHack::DFCoord _bcoord, std::vector< std::vector <uint16_t> > * layerassign = 0)
88+
Block(DFHack::DFCoord _bcoord, std::vector< std::vector <uint16_t> > * layerassign = 0)
8789
{
88-
m = _m;
8990
dirty_designations = false;
9091
dirty_tiletypes = false;
9192
dirty_temperatures = false;
9293
dirty_blockflags = false;
9394
dirty_occupancies = false;
9495
valid = false;
9596
bcoord = _bcoord;
96-
if(m->ReadBlock40d(bcoord.x,bcoord.y,bcoord.z,&raw))
97+
if(Maps::ReadBlock40d(bcoord.x,bcoord.y,bcoord.z,&raw))
9798
{
98-
m->ReadTemperatures(bcoord.x,bcoord.y, bcoord.z,&temp1,&temp2);
99-
SquashVeins(m,bcoord,raw,veinmats);
99+
Maps::ReadTemperatures(bcoord.x,bcoord.y, bcoord.z,&temp1,&temp2);
100+
SquashVeins(bcoord,raw,veinmats);
100101
if(layerassign)
101102
SquashRocks(layerassign,raw,basemats);
102103
else
@@ -202,28 +203,28 @@ class Block
202203
if(!valid) return false;
203204
if(dirty_designations)
204205
{
205-
m->WriteDesignations(bcoord.x,bcoord.y,bcoord.z, &raw.designation);
206-
m->WriteDirtyBit(bcoord.x,bcoord.y,bcoord.z,true);
206+
Maps::WriteDesignations(bcoord.x,bcoord.y,bcoord.z, &raw.designation);
207+
Maps::WriteDirtyBit(bcoord.x,bcoord.y,bcoord.z,true);
207208
dirty_designations = false;
208209
}
209210
if(dirty_tiletypes)
210211
{
211-
m->WriteTileTypes(bcoord.x,bcoord.y,bcoord.z, &raw.tiletypes);
212+
Maps::WriteTileTypes(bcoord.x,bcoord.y,bcoord.z, &raw.tiletypes);
212213
dirty_tiletypes = false;
213214
}
214215
if(dirty_temperatures)
215216
{
216-
m->WriteTemperatures(bcoord.x,bcoord.y,bcoord.z, &temp1, &temp2);
217+
Maps::WriteTemperatures(bcoord.x,bcoord.y,bcoord.z, &temp1, &temp2);
217218
dirty_temperatures = false;
218219
}
219220
if(dirty_blockflags)
220221
{
221-
m->WriteBlockFlags(bcoord.x,bcoord.y,bcoord.z,raw.blockflags);
222+
Maps::WriteBlockFlags(bcoord.x,bcoord.y,bcoord.z,raw.blockflags);
222223
dirty_blockflags = false;
223224
}
224225
if(dirty_occupancies)
225226
{
226-
m->WriteOccupancy(bcoord.x,bcoord.y,bcoord.z,&raw.occupancy);
227+
Maps::WriteOccupancy(bcoord.x,bcoord.y,bcoord.z,&raw.occupancy);
227228
dirty_occupancies = false;
228229
}
229230
return true;
@@ -234,7 +235,6 @@ class Block
234235
bool dirty_temperatures:1;
235236
bool dirty_blockflags:1;
236237
bool dirty_occupancies:1;
237-
DFHack::Maps * m;
238238
DFHack::mapblock40d raw;
239239
DFHack::DFCoord bcoord;
240240
DFHack::t_blockmaterials veinmats;
@@ -246,12 +246,11 @@ class Block
246246
class MapCache
247247
{
248248
public:
249-
MapCache(DFHack::Maps * Maps)
249+
MapCache()
250250
{
251251
valid = 0;
252-
this->Maps = Maps;
253-
Maps->getSize(x_bmax, y_bmax, z_max);
254-
validgeo = Maps->ReadGeology( layerassign );
252+
Maps::getSize(x_bmax, y_bmax, z_max);
253+
validgeo = Maps::ReadGeology( layerassign );
255254
valid = true;
256255
};
257256
~MapCache()
@@ -278,9 +277,9 @@ class MapCache
278277
{
279278
Block * nblo;
280279
if(validgeo)
281-
nblo = new Block(Maps,blockcoord, &layerassign);
280+
nblo = new Block(blockcoord, &layerassign);
282281
else
283-
nblo = new Block(Maps,blockcoord);
282+
nblo = new Block(blockcoord);
284283
blocks[blockcoord] = nblo;
285284
return nblo;
286285
}
@@ -455,7 +454,6 @@ class MapCache
455454
uint32_t y_tmax;
456455
uint32_t z_max;
457456
std::vector< std::vector <uint16_t> > layerassign;
458-
DFHack::Maps * Maps;
459457
std::map<DFHack::DFCoord, Block *> blocks;
460458
};
461459
}

0 commit comments

Comments
 (0)