develop
Petr Mrázek 2010-04-05 05:53:38 +02:00
parent f8d1c042d7
commit ea120a6709
2 changed files with 7 additions and 9 deletions

@ -486,7 +486,7 @@ bool Maps::ReadGeology (vector < vector <uint16_t> >& assign)
// iterate over 8 surrounding regions + local region // iterate over 8 surrounding regions + local region
for (int i = eNorthWest; i < eBiomeCount; i++) for (int i = eNorthWest; i < eBiomeCount; i++)
{ {
// check bounds, fix them if needed // check against worldmap boundaries, fix if needed
int bioRX = regionX / 16 + (i % 3) - 1; int bioRX = regionX / 16 + (i % 3) - 1;
if (bioRX < 0) bioRX = 0; if (bioRX < 0) bioRX = 0;
if (bioRX >= worldSizeX) bioRX = worldSizeX - 1; if (bioRX >= worldSizeX) bioRX = worldSizeX - 1;
@ -494,6 +494,8 @@ bool Maps::ReadGeology (vector < vector <uint16_t> >& assign)
if (bioRY < 0) bioRY = 0; if (bioRY < 0) bioRY = 0;
if (bioRY >= worldSizeY) bioRY = worldSizeY - 1; if (bioRY >= worldSizeY) bioRY = worldSizeY - 1;
/// regions are a 2d array. consists of pointers to arrays of regions
/// regions are of region_size size
// get pointer to column of regions // get pointer to column of regions
uint32_t geoX; uint32_t geoX;
g_pProcess->readDWord (regions + bioRX*4, geoX); g_pProcess->readDWord (regions + bioRX*4, geoX);
@ -502,15 +504,18 @@ bool Maps::ReadGeology (vector < vector <uint16_t> >& assign)
uint16_t geoindex; uint16_t geoindex;
g_pProcess->readWord (geoX + bioRY*region_size + region_geo_index_offset, geoindex); g_pProcess->readWord (geoX + bioRY*region_size + region_geo_index_offset, geoindex);
/// geology blocks are assigned to regions from a vector
// get the geoblock from the geoblock vector using the geoindex // get the geoblock from the geoblock vector using the geoindex
// read the matgloss pointer from the vector into temp // read the matgloss pointer from the vector into temp
uint32_t geoblock_off = * (uint32_t *) geoblocks[geoindex]; uint32_t geoblock_off = * (uint32_t *) geoblocks[geoindex];
/// geology blocks have a vector of layer descriptors
// get the vector with pointer to layers // get the vector with pointer to layers
DfVector geolayers (d->d->p, geoblock_off + geolayer_geoblock_offset , 4); // let's hope DfVector geolayers (d->d->p, geoblock_off + geolayer_geoblock_offset , 4); // let's hope
// make sure we don't load crap // make sure we don't load crap
assert (geolayers.getSize() > 0 && geolayers.getSize() <= 16); assert (geolayers.getSize() > 0 && geolayers.getSize() <= 16);
/// layer descriptor has a field that determines the type of stone/soil
d->v_geology[i].reserve (geolayers.getSize()); d->v_geology[i].reserve (geolayers.getSize());
// finally, read the layer matgloss // finally, read the layer matgloss
for (uint32_t j = 0;j < geolayers.getSize();j++) for (uint32_t j = 0;j < geolayers.getSize();j++)
@ -523,7 +528,6 @@ bool Maps::ReadGeology (vector < vector <uint16_t> >& assign)
} }
assign.clear(); assign.clear();
assign.reserve (eBiomeCount); assign.reserve (eBiomeCount);
// // TODO: clean this up
for (int i = 0; i < eBiomeCount;i++) for (int i = 0; i < eBiomeCount;i++)
{ {
assign.push_back (d->v_geology[i]); assign.push_back (d->v_geology[i]);

@ -2899,8 +2899,7 @@
<Offset name="v_vein">0x08</Offset> <Offset name="v_vein">0x08</Offset>
<Offset name="type">0x009A</Offset> <Offset name="type">0x009A</Offset>
<Offset name="designation">0x029C</Offset> <Offset name="designation">0x029C</Offset>
<!--<Offset name="occupancy">0x069c</Offset> seems unused, no watch hits-->
<!--<Offset name="occupancy">0x069c</Offset>-->
<Offset name="biome_stuffs">0x1D9C</Offset> <Offset name="biome_stuffs">0x1D9C</Offset>
<!-- <!--
map_data_map_x_offset 0x0058 map_data_map_x_offset 0x0058
@ -2917,11 +2916,6 @@ map_data_temperature2_offset 0x179c
map_data_1960_offset 0x199c map_data_1960_offset 0x199c
map_data_1b60_offset 0x1B9c map_data_1b60_offset 0x1B9c
--> -->
<!--
No idea if those are still relevant. I'll assume NO
-->
* map size in blocks * * map size in blocks *
<Address name="x_count_block">0x016ad738</Address> <Address name="x_count_block">0x016ad738</Address>