From f606c248540bc03f12d28bb6306ef440fc13e625 Mon Sep 17 00:00:00 2001
From: Glowbal <thomasskooi@live.nl>
Date: Tue, 28 Apr 2015 20:47:11 +0200
Subject: [PATCH] fixes #901

---
 .../medical/functions/fnc_actionDiagnose.sqf   |  8 ++++++--
 .../fnc_displayPatientInformation.sqf          |  2 +-
 .../medical/functions/fnc_handleUnitVitals.sqf | 18 ++++++++++++------
 addons/medical/functions/fnc_init.sqf          |  2 +-
 .../fnc_treatmentAdvanced_fullHealLocal.sqf    |  2 +-
 addons/medical/stringtable.xml                 |  3 +++
 6 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/addons/medical/functions/fnc_actionDiagnose.sqf b/addons/medical/functions/fnc_actionDiagnose.sqf
index 234cc6d303..886fa4752b 100644
--- a/addons/medical/functions/fnc_actionDiagnose.sqf
+++ b/addons/medical/functions/fnc_actionDiagnose.sqf
@@ -26,8 +26,12 @@ if (alive _target) then {
 } else {
     _genericMessages pushback "STR_ACE_MEDICAL_diagnoseDead";
 };
-if (_target getvariable[QGVAR(hasLostBlood), false]) then {
-    _genericMessages pushback "STR_ACE_MEDICAL_lostBlood";
+if (_target getvariable[QGVAR(hasLostBlood), 0] > 0) then {
+	if (_target getvariable[QGVAR(hasLostBlood), 0] > 1) then {
+		_genericMessages pushback "STR_ACE_MEDICAL_lostBloodALot";
+	} else {
+		_genericMessages pushback "STR_ACE_MEDICAL_lostBlood";
+	};
 } else {
     _genericMessages pushback "STR_ACE_MEDICAL_noBloodloss";
 };
diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf
index 1fc1051efa..a62bfcacbc 100644
--- a/addons/medical/functions/fnc_displayPatientInformation.sqf
+++ b/addons/medical/functions/fnc_displayPatientInformation.sqf
@@ -57,7 +57,7 @@ if (_show) then {
         if (_target getvariable[QGVAR(isBleeding), false]) then {
             _genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_BLEEDING", [1, 0.1, 0.1, 1]];
         };
-        if (_target getvariable[QGVAR(hasLostBlood), false]) then {
+        if (_target getvariable[QGVAR(hasLostBlood), 0] > 1) then {
             _genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_LOST_BLOOD", [1, 0.1, 0.1, 1]];
         };
 
diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf
index b806d1358f..e04b35955e 100644
--- a/addons/medical/functions/fnc_handleUnitVitals.sqf
+++ b/addons/medical/functions/fnc_handleUnitVitals.sqf
@@ -33,13 +33,19 @@ _bloodVolume = _bloodVolume max 0;
 _unit setvariable  [QGVAR(bloodVolume), _bloodVolume, _syncValues];
 
 // Set variables for synchronizing information across the net
-if (_bloodVolume < 90) then {
-    if !(_unit getvariable [QGVAR(hasLostBlood), false]) then {
-        _unit setvariable [QGVAR(hasLostBlood), true, true];
-    };
+if (_bloodVolume < 100) then {
+    if ((_bloodVolume < 90 && (GVAR(level) == 2)) || _bloodVolume <= 30) then {
+        if (_unit getvariable [QGVAR(hasLostBlood), 0] != 2) then {
+            _unit setvariable [QGVAR(hasLostBlood), 2, true];
+        };
+    } else {
+        if (_unit getvariable [QGVAR(hasLostBlood), 0] != 1) then {
+            _unit setvariable [QGVAR(hasLostBlood), 1, true];
+        };
+    }
 } else {
-    if (_unit getvariable [QGVAR(hasLostBlood),false]) then {
-        _unit setvariable [QGVAR(hasLostBlood), false, true];
+    if (_unit getvariable [QGVAR(hasLostBlood), 0] != 0) then {
+        _unit setvariable [QGVAR(hasLostBlood), 0, true];
     };
 };
 
diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf
index d01a63b3a5..80e8d9ba19 100644
--- a/addons/medical/functions/fnc_init.sqf
+++ b/addons/medical/functions/fnc_init.sqf
@@ -60,7 +60,7 @@ _unit setvariable [QGVAR(airwayCollapsed), false];
 _unit setvariable [QGVAR(addedToUnitLoop), false, true];
 _unit setvariable [QGVAR(inCardiacArrest), false, true];
 _unit setVariable ["ACE_isUnconscious", false, true];
-_unit setvariable [QGVAR(hasLostBlood), false, true];
+_unit setvariable [QGVAR(hasLostBlood), 0, true];
 _unit setvariable [QGVAR(isBleeding), false, true];
 _unit setvariable [QGVAR(hasPain), false, true];
 _unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true];
diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf
index 77f6d7f44c..e385c5f7c0 100644
--- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf
+++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf
@@ -55,7 +55,7 @@ if (alive _target) exitwith {
     _target setvariable [QGVAR(inCardiacArrest), false, true];
     _target setvariable [QGVAR(inReviveState), false, true];
     _target setVariable ["ACE_isUnconscious", false, true];
-    _target setvariable [QGVAR(hasLostBlood), false, true];
+    _target setvariable [QGVAR(hasLostBlood), 0, true];
     _target setvariable [QGVAR(isBleeding), false, true];
     _target setvariable [QGVAR(hasPain), false, true];
 
diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml
index 52baf9bbe3..7d3c2a6db4 100644
--- a/addons/medical/stringtable.xml
+++ b/addons/medical/stringtable.xml
@@ -1497,6 +1497,9 @@
             <French>Il à perdu du sang</French>
             <Polish>Stracił trochę krwi</Polish>
         </Key>
+        <Key ID="STR_ACE_MEDICAL_lostBloodALot">
+            <English>He's lost a lot of blood</English>
+        </Key>
         <Key ID="STR_ACE_MEDICAL_noBloodloss">
             <English>He hasn't lost blood</English>
             <Russian>Нет кровопотери</Russian>