Skip to content

Commit

Permalink
remove redundant call to rng.init() from tweak.cpp, remove white spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkow committed Sep 28, 2024
1 parent 7a5e0fd commit 119e169
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion plugins/tweak/tweak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ DFhackCExport command_result plugin_init(color_ostream &out, vector<PluginComman
TWEAK_HOOK("material-size-for-melting", material_size_for_melting_weapon_hook, getMaterialSizeForMelting);
TWEAK_HOOK("material-size-for-melting", material_size_for_melting_trapcomp_hook, getMaterialSizeForMelting);
TWEAK_HOOK("material-size-for-melting", material_size_for_melting_tool_hook, getMaterialSizeForMelting);
rng.init();

return CR_OK;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/tweak/tweaks/material-size-for-melting.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int32_t get_material_size_for_melting(df::item_constructed *item, int32_t

if (item->mat_type != 0) // bail if not INORGANIC
return base_material_size;

float forging_cost_per_item;
if (auto inorganic = df::inorganic_raw::find(item->mat_index);
inorganic && inorganic->flags.is_set(df::inorganic_flags::DEEP_SPECIAL))
Expand All @@ -42,7 +42,7 @@ static int32_t get_material_size_for_melting(df::item_constructed *item, int32_t
forging_cost_per_item = std::max(std::floor(static_cast<float>(base_material_size) / 3.0f), 1.0f);
forging_cost_per_item /= production_stack_size;
}

float calculated_size = forging_cost_per_item / melt_return_per_material_size;
float melt_recovery = base_melt_recovery - static_cast<float>(item->wear) * loss_per_wear_level;
calculated_size *= melt_recovery;
Expand Down

0 comments on commit 119e169

Please sign in to comment.