@@ -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;
3537namespace 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::
8385class 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
246246class 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