Author Topic: Difficulty bug, perhaps.  (Read 5994 times)

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Difficulty bug, perhaps.
« on: October 17, 2013, 09:52:10 pm »
introducing 2 muton soldiers

The first has been mind-controlled this turn, and its stats show normal, adjusted for Genius difficulty.

The second, however, was mind-controlled last turn and reloaded from a save. Its stats have reverted to Beginner.


I tried to hunt this down but it eludes me; the closest i got is that UnitStats seem to be derived via BattleUnit for fresh aliens, while reloaded aliens appear to take theirs from Unit

( it's slightly possible there's something quirky in my ruleset, so confirmation is appreciated )



These screens were taken in git_master_2013_10_17_1853 (recent)
« Last Edit: October 17, 2013, 10:01:59 pm by kevL »

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Difficulty bug, perhaps.
« Reply #1 on: October 17, 2013, 09:59:14 pm »
ps.
I also noticed that BattleUnit::adjustStats() lists strength twice, resulting in a double bonus for Difficulty. (don't want to commit on that until this is sorted tho)
« Last Edit: October 17, 2013, 10:05:47 pm by kevL »

Offline Shadow

  • Captain
  • ***
  • Posts: 75
  • Veteran Lieutenant
    • View Profile
Re: Difficulty bug, perhaps.
« Reply #2 on: October 17, 2013, 11:58:01 pm »
Might want to put this on the bug tracker.

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Difficulty bug, perhaps.
« Reply #3 on: October 18, 2013, 12:21:13 am »
I'll give it a day and if no one bites will open a reference.

i feel there can be a more open discussion, which i'm interested in learning from, here on the forum. Things are pretty claustrophobic -- open and shut -- on the 'tracker

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Difficulty bug, perhaps.
« Reply #4 on: October 18, 2013, 01:17:06 am »
ok found it.

The BattleUnit class has two constructors, one for soldiers, the second for aliens. Only the aliens make a call to adjustStats(), which levels them up per Difficulty. unfortunately this bit of protective code:

Code: [Select]
if (faction == FACTION_HOSTILE)
{
adjustStats(diff);
}

in the second constructor prevents mind controlled aliens *that are reloaded* while Mc'd from getting their difficulty bonuses. Because units are saved to file with their FACTION value: 0 for soldiers, 1 for aliens. Hence even though Mc'd aliens still use the second cTor, that bit there thinks they are Faction_Player...

ie. by commenting out the condition, things returned to what I think they should be. But who knows, maybe others want mind-controlled aliens that are reloaded to be Beginners ....


workaround: do not save reload while having an Mc'd alien.


tl;dr It takes someone with more knowledge of what those 2 constructors do than me, to make change.

[ edit ] the issue is in the bug traker..
« Last Edit: October 18, 2013, 01:54:59 pm by kevL »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Difficulty bug, perhaps.
« Reply #5 on: October 18, 2013, 03:07:24 pm »
simply commenting out that code would result in xcom tanks and civilians being adjusted as well.
i've added a call to adjustStats() in the load function that should fix the problem.

Offline kevL

  • Colonel
  • ****
  • Posts: 482
  • pitchforks and torches
    • View Profile
Re: Difficulty bug, perhaps.
« Reply #6 on: October 18, 2013, 03:24:46 pm »
ok. Thanks a lot, Wb.

will let you know if (i notice) things go bork