Update for temperaturest

develop
Quietust 2012-11-12 11:54:21 -06:00
parent b4dcc7e7ad
commit bbe94c006f
4 changed files with 24 additions and 24 deletions

@ -71,15 +71,15 @@ bool Vegetation::copyPlant(const int32_t index, t_plant &out)
out.material = out.origin->material;
out.pos = out.origin->pos;
out.grow_counter = out.origin->grow_counter;
out.temperature_1 = out.origin->temperature_1;
out.temperature_2 = out.origin->temperature_2;
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_3;
//out.temperature_4 = out.origin->temperature_4;
//out.temperature_5 = out.origin->temperature_5;
//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;
}

@ -263,7 +263,7 @@ struct liquid_hook : df::item_liquid_miscst {
DEFINE_VMETHOD_INTERPOSE(bool, checkTemperatureDamage, ())
{
if (mat_state.whole & BOILING_FLAG)
temperature = std::max(int(temperature), getBoilingPoint()-1);
temperature.whole = std::max(int(temperature.whole), getBoilingPoint()-1);
return INTERPOSE_NEXT(checkTemperatureDamage)();
}
@ -371,8 +371,8 @@ struct workshop_hook : df::building_workshopst {
// Update flags
liquid->flags.bits.in_building = true;
liquid->mat_state.whole |= liquid_hook::BOILING_FLAG;
liquid->temperature = liquid->getBoilingPoint()-1;
liquid->temperature_fraction = 0;
liquid->temperature.whole = liquid->getBoilingPoint()-1;
liquid->temperature.fraction = 0;
// This affects where the steam appears to come from
if (engine->hearth_tile.isValid())
@ -387,7 +387,7 @@ struct workshop_hook : df::building_workshopst {
{
liquid->wear = 4;
liquid->flags.bits.in_building = false;
liquid->temperature = liquid->getBoilingPoint() + 10;
liquid->temperature.whole = liquid->getBoilingPoint() + 10;
return liquid->checkMeltBoil();
}

@ -291,18 +291,18 @@ struct stable_temp_hook : df::item_actual {
DEFINE_VMETHOD_INTERPOSE(bool, adjustTemperature, (uint16_t temp, int32_t rate_mult))
{
if (temperature != temp)
if (temperature.whole != temp)
{
// Bug 6012 is caused by fixed-point precision mismatch jitter
// when an item is being pushed by two sources at N and N+1.
// This check suppresses it altogether.
if (temp == temperature+1 ||
(temp == temperature-1 && temperature_fraction == 0))
temp = temperature;
if (temp == temperature.whole+1 ||
(temp == temperature.whole-1 && temperature.fraction == 0))
temp = temperature.whole;
// When SPEC_HEAT is NONE, the original function seems to not
// change the temperature, yet return true, which is silly.
else if (getSpecHeat() == 60001)
temp = temperature;
temp = temperature.whole;
}
return INTERPOSE_NEXT(adjustTemperature)(temp, rate_mult);
@ -317,10 +317,10 @@ struct stable_temp_hook : df::item_actual {
{
auto obj = (*contaminants)[i];
if (abs(obj->temperature - temperature) == 1)
if (abs(obj->temperature.whole - temperature.whole) == 1)
{
obj->temperature = temperature;
obj->temperature_fraction = temperature_fraction;
obj->temperature.whole = temperature.whole;
obj->temperature.fraction = temperature.fraction;
}
}
}
@ -355,11 +355,11 @@ struct fast_heat_hook : df::item_actual {
(uint16_t temp, bool local, bool contained, bool adjust, int32_t rate_mult)
) {
// Some items take ages to cross the last degree, so speed them up
if (map_temp_mult > 0 && temp != temperature && max_heat_ticks > 0)
if (map_temp_mult > 0 && temp != temperature.whole && max_heat_ticks > 0)
{
int spec = getSpecHeat();
if (spec != 60001)
rate_mult = std::max(map_temp_mult, spec/max_heat_ticks/abs(temp - temperature));
rate_mult = std::max(map_temp_mult, spec/max_heat_ticks/abs(temp - temperature.whole));
}
return INTERPOSE_NEXT(updateTemperature)(temp, local, contained, adjust, rate_mult);

@ -8,20 +8,20 @@ local count = 0
local types = {}
local function update_temp(item,btemp)
if item.temperature ~= btemp then
if item.temperature.whole ~= btemp then
count = count + 1
local tid = item:getType()
types[tid] = (types[tid] or 0) + 1
end
if apply then
item.temperature = btemp
item.temperature_fraction = 0
item.temperature.whole = btemp
item.temperature.fraction = 0
if item.contaminants then
for _,c in ipairs(item.contaminants) do
c.temperature = btemp
c.temperature_fraction = 0
c.temperature.whole = btemp
c.temperature.fraction = 0
end
end
end