Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: (BUG) never-ending raid (Tank related)  (Read 3562 times)

Purple Gorilla

  • Bay Watcher
    • View Profile
(BUG) never-ending raid (Tank related)
« on: June 05, 2015, 03:36:33 pm »

There is a serious Bug in the Game, that prevents raids from ending.

The Navy Seals raided my Safehouse. The Firemen left my safehouse an almost empty map, so I could reach the Tank without fighting any Seals, and destroyed the Tank. Another Wave of Seals and a second Tank appered. I got to the other Tank and destroyed it too. The raid wasn't over. I started to fight the seals, but inbetween two other waves of Seals and Tanks were spawned. I finally manged to kill all siegeunits and tanks, and now nothing is left on the map. This could be repeated infinitly (or exactly 65536 times).


includes.h :
The structure siegest containes a short variable named tanks.

combat\fight.cpp ; sidemode\advance.cpp :
fight.cpp line 1152 and advance.cpp lines 406 and 466 decrease this variable, if a tank is killed.

sitemode\sitemode.cpp :
line 258 sets this variable to 1 when the initial tank is created.
lines 2449 and 2450 are the conditions to win the raid : siege.tanks must be exactly 0 and siege.kills must be above 9.
The block from 2402 to 2450 contains the actual bug :
                  if(!(location[cursite]->compound_walls & COMPOUND_TANKTRAPS)&&
                     location[cursite]->siege.siegetype==SIEGE_POLICE&&
                     location[cursite]->siege.escalationstate>=2)
                  {
                     count=10000;
                     int hunitnum=1;
                     for(int t=0;t<hunitnum;t++)
                     {
                        do
                        {
                           lx=LCSrandom(7)+(MAPX/2)-3;
                           ly=LCSrandom(5);
                           lz=0;
                           count--;
                           if(count==0)break;
                        }while((levelmap[lx][ly][lz].flag & (SITEBLOCK_BLOCK|SITEBLOCK_DOOR|SITEBLOCK_EXIT))||
                              (levelmap[lx][ly][lz].siegeflag & (SIEGEFLAG_UNIT|SIEGEFLAG_HEAVYUNIT|SIEGEFLAG_TRAP)));
                        levelmap[lx][ly][lz].siegeflag|=SIEGEFLAG_HEAVYUNIT;                     }
                  }
               }

The marked line creates a new Tank, but does not increase siege.tanks.
If you kill more than two tanks, siege.tanks goes negative, and the raid becomes unwinnable.

To fix the Bug, insert the following line after the marked line :
Code: [Select]
            location[cursite]->siege.tanks++;
To harden the Game further replace the following line (2450) :
Code: [Select]
                  location[cursite]->siege.tanks==0&&with the following line :
Code: [Select]
                  location[cursite]->siege.tanks<1&&

To provoke the Bug :
*Get your safehouse raided by the Naly Seals and Tanks
* Kill two or more Tanks without killing more than 9 Seals.
Tips:
* It helps to reach the Tank, if the firemen burned out every tile in another raid.

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: (BUG) never-ending raid (Tank related)
« Reply #1 on: June 07, 2015, 03:00:23 pm »

OK, the Bug is very serious :
* Version 4.7.0 has it
* Version 4.7.4 has it
* Revision [860] has it

FinetalPies

  • Bay Watcher
  • Even on the battlefield.
    • View Profile
Re: (BUG) never-ending raid (Tank related)
« Reply #2 on: June 07, 2015, 06:20:35 pm »

Though I can definitely see why no one has caught it before this point.
Logged

Jiharo

  • Bay Watcher
  • Adequate Lurker
    • View Profile
Re: (BUG) never-ending raid (Tank related)
« Reply #3 on: June 10, 2015, 04:12:18 am »

Another tiny siege related bug in revision 860:

In lcsmonthly.cpp at line 685
Code: [Select]
  change_public_opinion(VIEW_AMRADIO,50);
  offended_cablenews=1;
should be changed to
Code: [Select]
  change_public_opinion(VIEW_AMRADIO,50);
  offended_amradio=1;
Otherwise, even if you publish AM Radio Memos only cable viewers would get angry.
Logged
All your goblin bone bolts, suddenly rising up in vengeance...
I wonder ... is it smart amunition or dumb amunition?

SlatersQuest

  • Bay Watcher
    • View Profile
Re: (BUG) never-ending raid (Tank related)
« Reply #4 on: July 12, 2015, 12:01:54 am »

This bug has been fixed in the Terra Vitae mod.
Logged