dump Vegetation::t_plant, fix plant.is_burning

develop
jj 2012-12-03 19:03:07 +01:00
parent dc7f9f56cd
commit 3953112eb9
3 changed files with 2 additions and 49 deletions

@ -40,31 +40,9 @@ namespace Vegetation
{
const uint32_t sapling_to_tree_threshold = 120 * 28 * 12 * 3; // 3 years
// "Simplified" copy of plant
struct t_plant {
df::language_name name;
df::plant_flags flags;
int16_t material;
df::coord pos;
int32_t grow_counter;
uint16_t temperature_1;
uint16_t temperature_2;
int32_t is_burning;
int32_t hitpoints;
int16_t update_order;
//std::vector<void *> unk1;
//int32_t unk2;
//uint16_t temperature_3;
//uint16_t temperature_4;
//uint16_t temperature_5;
// Pointer to original object, in case you want to modify it
df::plant *origin;
};
DFHACK_EXPORT bool isValid();
DFHACK_EXPORT uint32_t getCount();
DFHACK_EXPORT df::plant * getPlant(const int32_t index);
DFHACK_EXPORT bool copyPlant (const int32_t index, t_plant &out);
}
}
#endif

@ -58,28 +58,3 @@ df::plant * Vegetation::getPlant(const int32_t index)
return NULL;
return world->plants.all[index];
}
bool Vegetation::copyPlant(const int32_t index, t_plant &out)
{
if (uint32_t(index) >= getCount())
return false;
out.origin = world->plants.all[index];
out.name = out.origin->name;
out.flags = out.origin->flags;
out.material = out.origin->material;
out.pos = out.origin->pos;
out.grow_counter = out.origin->grow_counter;
out.temperature_1 = out.origin->temperature.whole;
out.temperature_2 = out.origin->temperature.fraction;
out.is_burning = out.origin->is_burning;
out.hitpoints = out.origin->hitpoints;
out.update_order = out.origin->update_order;
//out.unk1 = out.origin->anon_1;
//out.unk2 = out.origin->anon_2;
//out.temperature_3 = out.origin->temperature_unk;
//out.temperature_4 = out.origin->min_safe_temp;
//out.temperature_5 = out.origin->max_safe_temp;
return true;
}

@ -113,7 +113,7 @@ static command_result immolations (color_ostream &out, do_what what, bool shrubs
if(shrubs && p->flags.bits.is_shrub || trees && !p->flags.bits.is_shrub)
{
if (what == do_immolate)
p->is_burning = true;
p->damage_flags.bits.is_burning = true;
p->hitpoints = 0;
destroyed ++;
}
@ -136,7 +136,7 @@ static command_result immolations (color_ostream &out, do_what what, bool shrubs
if(tree->pos.x == x && tree->pos.y == y && tree->pos.z == z)
{
if(what == do_immolate)
tree->is_burning = true;
tree->damage_flags.bits.is_burning = true;
tree->hitpoints = 0;
didit = true;
break;