@@ -62,6 +62,8 @@ struct BattleUnitKills
6262 UnitFaction faction;
6363 UnitStatus status;
6464 int mission, turn;
65+ UnitSide side;
66+ UnitBodyPart bodypart;
6567
6668 // / Functions
6769 // Make turn unique across all kills
@@ -86,6 +88,8 @@ struct BattleUnitKills
8688 faction = (UnitFaction)node[" faction" ].as <int >();
8789 mission = node[" mission" ].as <int >(mission);
8890 turn = node[" turn" ].as <int >(turn);
91+ side = (UnitSide)node[" side" ].as <int >();
92+ bodypart = (UnitBodyPart)node[" bodypart" ].as <int >();
8993 }
9094 // Save
9195 YAML ::Node save () const
@@ -99,9 +103,11 @@ struct BattleUnitKills
99103 node[" faction" ] = (int )faction;
100104 node[" mission" ] = mission;
101105 node[" turn" ] = turn;
106+ node[" side" ] = (int )side;
107+ node[" bodypart" ] = (int )bodypart;
102108 return node;
103109 }
104- // Convert victim State to string
110+ // Convert victim State to string.
105111 std::string getUnitStatusString () const
106112 {
107113 switch (status)
@@ -111,7 +117,7 @@ struct BattleUnitKills
111117 default : return " status error" ;
112118 }
113119 }
114- // Convert victim Faction to string
120+ // Convert victim Faction to string.
115121 std::string getUnitFactionString () const
116122 {
117123 switch (faction)
@@ -122,9 +128,36 @@ struct BattleUnitKills
122128 default : return " faction error" ;
123129 }
124130 }
131+ // Convert victim Side to string.
132+ std::string getUnitSideString () const
133+ {
134+ switch (side)
135+ {
136+ case SIDE_FRONT : return " SIDE_FRONT" ;
137+ case SIDE_LEFT : return " SIDE_LEFT" ;
138+ case SIDE_RIGHT : return " SIDE_RIGHT" ;
139+ case SIDE_REAR : return " SIDE_REAR" ;
140+ case SIDE_UNDER : return " SIDE_UNDER" ;
141+ default : return " side error" ;
142+ }
143+ }
144+ // Convert victim Body part to string.
145+ std::string getUnitBodyPart () const
146+ {
147+ switch (bodypart)
148+ {
149+ case BODYPART_HEAD : return " BODYPART_HEAD" ;
150+ case BODYPART_TORSO : return " BODYPART_TORSO" ;
151+ case BODYPART_RIGHTARM : return " BODYPART_RIGHTARM" ;
152+ case BODYPART_LEFTARM : return " BODYPART_LEFTARM" ;
153+ case BODYPART_RIGHTLEG : return " BODYPART_RIGHTLEG" ;
154+ case BODYPART_LEFTLEG : return " BODYPART_LEFTLEG" ;
155+ default : return " body part error" ;
156+ }
157+ }
125158 BattleUnitKills (const YAML ::Node& node) { load (node); }
126- BattleUnitKills (std::string Rank, std::string Race, std::string Weapon, std::string WeaponAmmo, UnitFaction Faction, UnitStatus Status, int Mission, int Turn) :
127- rank (Rank), race(Race), weapon(Weapon), weaponAmmo(WeaponAmmo), faction(Faction), status(Status), mission(Mission), turn(Turn) { }
159+ BattleUnitKills (std::string Rank, std::string Race, std::string Weapon, std::string WeaponAmmo, UnitFaction Faction, UnitStatus Status, int Mission, int Turn, UnitSide Side, UnitBodyPart BodyPart ) :
160+ rank (Rank), race(Race), weapon(Weapon), weaponAmmo(WeaponAmmo), faction(Faction), status(Status), mission(Mission), turn(Turn), side(Side), bodypart(BodyPart) { }
128161 ~BattleUnitKills () { }
129162};
130163
@@ -261,6 +294,8 @@ class BattleUnit
261294 std::string _activeHand;
262295 BattleUnitStatistics* _statistics;
263296 int _murdererId; // used to credit the murderer with the kills that this unit got by blowing up on death
297+ UnitSide _fatalShotSide;
298+ UnitBodyPart _fatalShotBodyPart;
264299
265300 // static data
266301 std::string _type;
@@ -622,6 +657,12 @@ class BattleUnit
622657 void setMurdererId (int id);
623658 // / Get the unit murderer's id.
624659 int getMurdererId () const ;
660+ // / Set information on the unit's fatal shot.
661+ void setFatalShotInfo (UnitSide side, UnitBodyPart bodypart);
662+ // / Get information on the unit's fatal shot's side.
663+ UnitSide getFatalShotSide () const ;
664+ // / Get information on the unit's fatal shot's body part.
665+ UnitBodyPart getFatalShotBodyPart () const ;
625666};
626667
627668}
0 commit comments