Author Topic: [FIXED] Issue with number of kills? (killedBy not saved)  (Read 1387 times)

Offline Bloodvoin

  • Squaddie
  • *
  • Posts: 6
    • View Profile
[FIXED] Issue with number of kills? (killedBy not saved)
« on: August 19, 2022, 08:46:58 pm »
Hello, I noticed that since version 7.6.3, if you boot up during the mission, say, the previous round, the game does not remember all the kill and starts to count them from the boot.
« Last Edit: February 02, 2023, 03:32:03 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8596
    • View Profile
Re: Issue with number of kills?
« Reply #1 on: August 19, 2022, 09:23:43 pm »
I don't understand.

Offline Bloodvoin

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Issue with number of kills?
« Reply #2 on: August 20, 2022, 09:18:52 am »
Let's say by round 7 I killed 30 people, leaving 2 people on the map. When I go to round 8 I have a soldier killed and I load up for round 7 and complete the mission killing 2 enemy soldiers, then the mission completion score will only include the 2 soldiers killed, not 32

Offline Delian

  • Colonel
  • ****
  • Posts: 240
    • View Profile
Re: Issue with number of kills?
« Reply #3 on: August 20, 2022, 09:32:56 am »
Post screenshot of the score screen, or a sav file.

Offline Bloodvoin

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Issue with number of kills?
« Reply #4 on: August 20, 2022, 09:40:42 am »
!

Offline Delian

  • Colonel
  • ****
  • Posts: 240
    • View Profile
Re: Issue with number of kills?
« Reply #5 on: August 20, 2022, 11:47:16 am »
You said that 30 out of 32 enemies are dead. But in this sav there are 9 out of 13 enemies dead. Those numbers don't quite match.

Btw, I don't like how tempUnitStatistics is all in a single line - it's unreadable.

Offline Bloodvoin

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Issue with number of kills?
« Reply #6 on: August 20, 2022, 01:46:40 pm »
Above I wrote just to illustrate, and this saving game where I started noticing it, it shows that the map has more dead bodies than it counts kills at the end of the mission.

Offline R1dO

  • Colonel
  • ****
  • Posts: 436
    • View Profile
Re: Issue with number of kills?
« Reply #7 on: August 20, 2022, 03:38:01 pm »
Looking at the save.

No enemy seemed to be killed by you: "killedBy: 0".
All other enemies were killed by their own faction: "killedBy: 1"

When loading the save and killing the last person too stubborn to surrender this means ending up with 1 enemy killed by the player and 3 surrenders, as is correctly shown in the debriefing.

A quick glance at the ruleset code tells me you are not suppose to recover corpses of dead enemies, hence there will no be a section called "alien corpses recovered".
That is normally the section filled with dead bodies not limited to the category "killed by player".

Hope this explains the difference.

P.s.
Debugging recipe used:
- load battlegame
- select next soldier .. twice
- attempt to rotate clockwise 45 degrees
- kill enemy that becomes visible in order to end battle (snapshot should suffice)

--edit--
Adapted text since original was based on a autosave where i did a next turn after killing 1. Where the game correctly set "killedBy: 0" on the enemy i killed in the 1st turn after loading the bugged one.
That one ended up with 2 killed by players and no surrenders (died by wounds i suppose).

--edit 2--
Seems like your save is broken.
I compared the enemies on 3 different scenarios, which led to the table below:

Scenario 1 = original battlesave
Scenario 2 = manual save after loading original battelsave (using OpenXcomEx-7.6)
Scenario 3 = manual save after killing 1 enemy (using OpenXcomEx-7.6)
Code: [Select]
        | Scenario 1                     | Scenario 2                     | Scenario 3                     |
enemy   | status | killedBy | murdererId | status | killedBy | murdererId | status | killedBy | murdererId |
--------+--------+----------+------------+--------+----------+------------+--------+----------+------------|
1000000 | 6      | missing  | 4          | 6      | 1        | 4          | 6      | 1        | 4          |
1000001 | 6      | 1        | 6          | 6      | 1        | 6          | 6      | 1        | 6          |
1000002 | 6      | 1        | 5          | 6      | 1        | 5          | 6      | 1        | 5          |
1000003 | 0      | 1        | N/A        | 0      | 1        | 0          | 0      | 1        | 0          |
1000004 | 6      | 1        | 5          | 6      | 1        | 5          | 6      | 1        | 5          |
1000005 | 0      | 1        | N/A        | 0      | 1        | 0          | 0      | 1        | 0          |
1000006 | 6      | 1        | 6          | 6      | 1        | 6          | 6      | 1        | 6          |
1000007 | 0      | 1        | N/A        | 0      | 1        | 0          | 0      | 1        | 0          |
1000008 | 6      | 1        | 6          | 6      | 1        | 6          | 6      | 1        | 6          |
1000009 | 0      | 1        | 5          | 0      | 1        | 5          | 6 <<   | 0 <<     | 6 <<       |
1000010 | 6      | 1        | 4          | 6      | 1        | 4          | 6      | 1        | 4          |
1000011 | 6      | 1        | 2          | 6      | 1        | 2          | 6      | 1        | 2          |
1000012 | 6      | missing  | 6          | 6      | 1        | 6          | 6      | 1        | 6          |

-- edit 3 --
Did a test with saving using 7.6.8 (self compiled on linux). This results in savegames representing scenario1.

@Yankes/Meridian
I suspect this is because of commit "a1ffd4c4".
In `BattleUnit::save()` a check was introduced if `_killedBy` exists before saving that node.

In the enum `UnitFaction` the `FACTION_PLAYER` has position 0. I would not be surprised if the check above treats that as false, causing it to omit that node.
Combine this with
Code: [Select]
BattleUnit::BattleUnit( ... UnitFaction ...), ... _killedBy(faction), ... and any dead non-player unit killed by the player will initialize with the `_killedBy` parameter set to the faction that unit belongs to upon loading a save where that node was omitted.

That is ... if my c++ skills are not too far of ;-)
« Last Edit: August 20, 2022, 05:53:58 pm by R1dO »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8596
    • View Profile
Re: Issue with number of kills?
« Reply #8 on: August 21, 2022, 02:37:26 pm »
fixed