Merge commit 'origin' into bartavelle

develop
simon 2010-04-19 14:46:30 +02:00
commit 7f5edd58c8
3 changed files with 72 additions and 2 deletions

@ -113,6 +113,62 @@ bool API::Detach()
d->p = NULL;
d->shm_start = 0;
d->offset_descriptor = NULL;
// invalidate all modules
if(d->creatures)
{
delete d->creatures;
d->creatures = 0;
}
if(d->creatures)
{
delete d->creatures;
d->creatures = 0;
}
if(d->maps)
{
delete d->maps;
d->maps = 0;
}
if(d->gui)
{
delete d->gui;
d->gui = 0;
}
if(d->position)
{
delete d->position;
d->position = 0;
}
if(d->materials)
{
delete d->materials;
d->materials = 0;
}
if(d->gui)
{
delete d->gui;
d->gui = 0;
}
if(d->translation)
{
delete d->translation;
d->translation = 0;
}
if(d->vegetation)
{
delete d->vegetation;
d->vegetation = 0;
}
if(d->constructions)
{
delete d->constructions;
d->constructions = 0;
}
if(d->translation)
{
delete d->translation;
d->translation = 0;
}
return true;
}

@ -17,6 +17,7 @@ int main (void)
int32_t x,y,z;
DFHack::designations40d designations;
DFHack::tiletypes40d tiles;
DFHack::t_temperatures temp1,temp2;
uint32_t x_max,y_max,z_max;
DFHack::API DF("Memory.xml");
@ -180,11 +181,16 @@ int main (void)
{
// place the magma
Maps->ReadDesignations((x/16),(y/16),z, &designations);
Maps->ReadTemperatures((x/16),(y/16),z, &temp1, &temp2);
if(brush == "point")
{
if(mode != "flowbits")
{
// fix temperatures so we don't produce lethal heat traps
if(amount == 0 || designations[x%16][y%16].bits.liquid_type == DFHack::liquid_magma && mode == "water")
temp1[x%16][y%16] = temp2[x%16][y%16] = 10015;
designations[x%16][y%16].bits.flow_size = amount;
}
if(mode == "magma")
designations[x%16][y%16].bits.liquid_type = DFHack::liquid_magma;
else if(mode == "water")
@ -195,13 +201,19 @@ int main (void)
for(uint32_t xx = 0; xx < 16; xx++) for(uint32_t yy = 0; yy < 16; yy++)
{
if(mode != "flowbits")
{
// fix temperatures so we don't produce lethal heat traps
if(amount == 0 || designations[xx][yy].bits.liquid_type == DFHack::liquid_magma && mode == "water")
temp1[xx%16][yy%16] = temp2[xx%16][yy%16] = 10015;
designations[xx][yy].bits.flow_size = amount;
}
if(mode == "magma")
designations[xx][yy].bits.liquid_type = DFHack::liquid_magma;
else if(mode == "water")
designations[xx][yy].bits.liquid_type = DFHack::liquid_water;
}
}
Maps->WriteTemperatures((x/16),(y/16),z, &temp1, &temp2);
Maps->WriteDesignations(x/16,y/16,z, &designations);
}

@ -85,8 +85,10 @@ int main (void)
cout << "Press any key to unreveal. Don't close DF or unpause in that case!" << endl;
cin.ignore();
cout << "Unrevealing... please wait." << endl;
DF.Attach();
// FIXME: do some consistency checks here!
DF.Attach();
Maps = DF.getMaps();
Maps->Start();
for(int i = 0; i < hidesaved.size();i++)
{
hideblock & hb = hidesaved[i];