Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Medical HandleDamageWounds memory leak #6809

Merged
merged 3 commits into from
Mar 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions addons/medical_damage/functions/fnc_woundsHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ private _extensionOutput = "ace_medical" callExtension format ["HandleDamageWoun
TRACE_1("",_extensionOutput);

// these are default values and modified by _extensionOutput
private _painToAdd = 0;
private _woundsCreated = [];

call compile _extensionOutput;
(parseSimpleArray _extensionOutput) params ["_woundsCreated", "_painToAdd"];

// todo: Make the pain and bleeding calculations part of the extension again
private _woundDamage = _damage / ((count _woundsCreated) max 1); // If the damage creates multiple wounds
Expand Down
6 changes: 3 additions & 3 deletions extensions/medical/handleDamage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace ace {
double painToAdd = 0;
wounds = GetInjuryInfoFor(typeOfDamage, amountOfDamage, selectionN, woundID);

stream << "_woundsCreated = [";
stream << "[[";
for (int i = 0; i < wounds.size(); ++i)
{
stream << wounds.at(i).AsString();
Expand All @@ -45,9 +45,9 @@ namespace ace {

painToAdd += wounds.at(i).pain;
}
stream << "];";
stream << "],";

stream << "_painToAdd = " << painToAdd << ";";
stream << painToAdd << "]";

return stream.str();
}
Expand Down