View Issue Details

IDProjectCategoryLast Update
0021386AI War 2[All Projects] Bug - GameplayJul 12, 2019 12:22 pm
ReporterzeusalmightyAssigned Tox4000Bughunter 
Severityminor 
Status resolvedResolutionfixed 
Product Version0.874 Basic Fleet Management 
Fixed in Version0.875 Counterattacks You Can Taste 
Summary0021386: Increasing cap of p. turrets (+50K cap) after GCS hack
DescriptionUpon completing a GCS hack, I was rewarded (among other things) +15 paralysis mines. Instead, I have a growing cap of these, 25K just a minute after hack and 50K shortly after

Very amusing, but obviously a bug

Save and picture attached
TagsNo tags attached.

Activities

wm46

Jul 12, 2019 1:03 am

reporter   ~0052193

I've tried replicating this by hacking an AI-owned GCA and a player-owned GCA, but nothing interesting happened. Could you upload the save so I can at least put in a bunch of debug lines into the code?

wm46

Jul 12, 2019 2:35 am

reporter   ~0052194

I got the bug to occur, and added a bit of (delusional) debugging and was pretty confused:

HOI! MY NAME IS GLOBALPLAYERSTEPLOGIC

  HOI! ATCS_C CONTAINS THESE THINGS:
    HOI! NOTHING TO REPORT!

  HOI! IM ADDING THESE THINGS TO ATCS_C:
    HOI! <Ambush Turret>
      HOI! COUNT <18>
    HOI! <Grenade Launcher Turret>
      HOI! COUNT <23>
    HOI! <Sentry Frigate>
      HOI! COUNT <1128>
    HOI! <Tritium Sniper Turret>
      HOI! COUNT <22>
    HOI! <Beam Cannon>
      HOI! COUNT <1128>
    HOI! <Area Minefield>
      HOI! COUNT <11>
    HOI! <Tachyon Array>
      HOI! COUNT <1>

  HOI! IM GCA 0007631
    HOI! IM ADDING <Concussion Turret> COUNT 15
      HOI! IM CREATING A NEW ENTRY
    HOI! IM ADDING <Beam Cannon> COUNT 2
      HOI! IM ADDING TO ATCS_C, COUNT BEFORE = 1128
    HOI! IM ADDING <Sentry Frigate> COUNT 2
      HOI! IM ADDING TO ATCS_C, COUNT BEFORE = 1128

HOI! MY NAME IS GLOBALPLAYERSTEPLOGIC.

...

  HOI! IM ADDING THESE THINGS TO ATCS_C:
    HOI! <Ambush Turret>
      HOI! COUNT <18>
    HOI! <Grenade Launcher Turret>
      HOI! COUNT <23>
    HOI! <Sentry Frigate>
      HOI! COUNT <1130>
    HOI! <Tritium Sniper Turret>
      HOI! COUNT <22>
    HOI! <Beam Cannon>
      HOI! COUNT <1130>
    HOI! <Area Minefield>
      HOI! COUNT <11>
    HOI! <Tachyon Array>
      HOI! COUNT <1>

  HOI! IM GCA 0007631
    HOI! IM ADDING <Concussion Turret> COUNT 15
      HOI! IM CREATING A NEW ENTRY
    HOI! IM ADDING <Beam Cannon> COUNT 2
      HOI! IM ADDING TO ATCS_C, COUNT BEFORE = 1130
    HOI! IM ADDING <Sentry Frigate> COUNT 2
      HOI! IM ADDING TO ATCS_C, COUNT BEFORE = 1130

I was thinking, is it possible that when using ( this.Player_AddedToCommandStation_Current.AddRange( this.Player_AddedToCommandStation_Permanent ) ), it is adding the values as a reference to ATCS_P ?

Then when it does ATCS_C[i] += CountToAdd, the reference link means its actually doing ATCS_P += CountToAdd. Maybe the fix is to change ATCS_C.AddRange to a for loop that copies to a variable before adding element by element to ATCS_C. That's what I had to do for my knockback code to get things to inherit properly without breaking.

x4000Bughunter

Jul 12, 2019 12:22 pm

administrator   ~0052200

Thank you!

* Fixed a bug where if you had captured a GCA that was granting a ship type cap of some amount, and you had hacked a different GCA to get ship cap added for that same type, it would start infinitely counting up your ship count added.
** We were using RefPair as if it was a value type (AddRange), when it fact it was a reference type (it's right in the name of the class, sigh, and we made it ourselves). Perils of coding while tired?

Issue History

Date Modified Username Field Change
Jul 11, 2019 10:04 pm zeusalmighty New Issue
Jul 12, 2019 1:03 am wm46 Note Added: 0052193
Jul 12, 2019 2:35 am wm46 Note Added: 0052194
Jul 12, 2019 12:22 pm x4000Bughunter Assigned To => x4000Bughunter
Jul 12, 2019 12:22 pm x4000Bughunter Status new => resolved
Jul 12, 2019 12:22 pm x4000Bughunter Resolution open => fixed
Jul 12, 2019 12:22 pm x4000Bughunter Fixed in Version => 0.875 Counterattacks You Can Taste
Jul 12, 2019 12:22 pm x4000Bughunter Note Added: 0052200