Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Unending Siege bug  (Read 1016 times)

addictgamer

  • Bay Watcher
  • Penguin Developer
    • View Profile
    • Github
Unending Siege bug
« on: September 19, 2012, 01:28:44 pm »

So, I got busted at the homeless shelter. All my liberals were there. 19 or so.
The cops laid siege to the place, and I tried to escape. All the liberals present either died or were captured. Two liberals remained, which had been sent to the free clinic due to angry mobs beating them up whilst they were causing liberal disobedience. That was about two months after the first events.
The siege was still being laid to the homeless shelter, so I have no idea how my liberals managed to get back in. So I tried escaping again. The founder died, and I was left with one liberal whom survived being shot by 6 or so SWAT/Police officers. He was sentenced to prison for 11 years.
Come 2020, he was released. He got back into the homeless shelter, which was STILL under siege. FOR 11 YEARS. 11 YEARS!

Apparently the code doesn't clear the siege flag or whatever it's supposed to be doing.
Logged
I'm patiently waiting for the ability to mine and construct palaces in adventure mode.
Barony. A 3D, multiplayer roguelike I am developing.

Jboy2000000

  • Bay Watcher
  • Hello good people of the interwebs!
    • View Profile
Re: Unending Siege bug
« Reply #1 on: September 19, 2012, 04:17:12 pm »

This bug happens when all librerals are killed/captured. To fix it you're supposed to [G]ive Up istead of fight when your game is first bugged.
Logged
"Wanna be a better liberal? Go get shot in the fuckin' face."

Just goes to show, even a Male Doctor that Looks Like a Female and a Criminal with Poor Hygiene Habits can fall in love.

addictgamer

  • Bay Watcher
  • Penguin Developer
    • View Profile
    • Github
Re: Unending Siege bug
« Reply #2 on: September 19, 2012, 08:31:05 pm »

Ya, I was able to deduce when it happens. I'd only need to know that if I intended to fix the bug, which at this point in time, I don't.

What happens when the "Give Up" command is given? Will it do what it should, which would mean that the siege actually is going on and it's not just a partial botch? Or would it do nothing more than end the siege?

Actually, I typed up this post before I headed off to college. Now that I'm back, I might take a look into this bug. Maybe. No promises whatsoever.
Logged
I'm patiently waiting for the ability to mine and construct palaces in adventure mode.
Barony. A 3D, multiplayer roguelike I am developing.

Jboy2000000

  • Bay Watcher
  • Hello good people of the interwebs!
    • View Profile
Re: Unending Siege bug
« Reply #3 on: September 19, 2012, 09:33:22 pm »

Based on Police Regulation laws, law enforcment may take money, and if you have a bussiness front, it will be dismantled.
Logged
"Wanna be a better liberal? Go get shot in the fuckin' face."

Just goes to show, even a Male Doctor that Looks Like a Female and a Criminal with Poor Hygiene Habits can fall in love.

addictgamer

  • Bay Watcher
  • Penguin Developer
    • View Profile
    • Github
Re: Unending Siege bug
« Reply #4 on: September 19, 2012, 09:42:30 pm »

So then, giving up during a bugged siege works as if it were a normal siege (I'm assuming you also meant to include all the other events that happen when the give up command is issued)?

If so, that eliminates the possibility that it's a partial cleanup of the siege variables. Which would most likely mean the function that does the siege cleanup or what have you is not called if all liberals are killed or captured...Sounds simple enough. I'll dive into and take a look at this.
Logged
I'm patiently waiting for the ability to mine and construct palaces in adventure mode.
Barony. A 3D, multiplayer roguelike I am developing.

addictgamer

  • Bay Watcher
  • Penguin Developer
    • View Profile
    • Github
Re: Unending Siege bug
« Reply #5 on: September 19, 2012, 10:27:56 pm »

I don't see any obvious fixes to this, but that's because all I did was use grep to locate every occurrence of the word "siege". I don't know this codebase as I do the codebases of my own projects. A dirty hack that comes to mind is running a check every...whatever code is run to advance to the next day. Anyway, all I can think of is adding a check there that deactivates a siege if no more liberals are present at a sieged location. It would also seem that this code could be added in basemode/basemode.cpp, assuming the following piece of code is not limited to only the location the player has z'd too (which I'm afraid it might be).
Code: [Select]
      siegest *siege=NULL;
      if(selectedsiege!=-1)siege=&location[selectedsiege]->siege;
      if (activesquad!=NULL && activesquad->squad[0]->location!=-1)
      {
          siege=&location[activesquad->squad[0]->location]->siege;
      }
      char sieged=0;
      if(siege!=NULL)sieged=siege->siege;
      char underattack=0;
      if(siege!=NULL)
      {
         if(sieged)underattack=siege->underattack;
      }
     
      char haveflag=0;
      if(selectedsiege!=-1)haveflag=location[selectedsiege]->haveflag;
      if(activesquad!=NULL && activesquad->squad[0]->location!=-1)
         haveflag=location[activesquad->squad[0]->location]->haveflag;
     
      // Count people at each location
      int* location2 = new int[location.size()];
      for(int i=0;i<location.size();i++)
      {
         location2[i]=0;
      }
      for(int p=0;p<pool.size();p++)
      {
         if(!pool[p]->alive)continue; // Dead people don't count
         if(pool[p]->align!=1)continue; // Non-liberals don't count
         if(pool[p]->location==-1)continue; // Vacationers don't count
         location2[pool[p]->location]++;
      }

      char cannotwait=0;
      for(l=0;l<location.size();l++)
      {
         if(!location[l]->siege.siege)continue;

         

         if(location[l]->siege.underattack)
         {
            // Allow siege if no liberals present
            if(location2[l])cannotwait=1;
            break;
         }
         //NOTE: returns -1 if no eaters, so is okay
         if(fooddaysleft(l)==0)
         {
            // Allow siege if no liberals present

            // Allow waiting if there's no food...
            //   we'll handle this by decrementing starving Liberals' health
            //if(location2[l])cannotwait=1;
            break;
         }
      }
      delete[] location2;
On the other hand, this fix seems to be against game features, according to the implications of this comment:
Code: [Select]
// Allow siege if no liberals presentSo I don't know. I don't feel like diving in and figuring this all out.
One of the developers of this project probably knows what's wrong and how to fix it. I'll leave it in their hands.
« Last Edit: September 19, 2012, 10:29:48 pm by addictgamer »
Logged
I'm patiently waiting for the ability to mine and construct palaces in adventure mode.
Barony. A 3D, multiplayer roguelike I am developing.

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Unending Siege bug
« Reply #6 on: September 19, 2012, 10:35:44 pm »

This bug has been in place for a long time specifically because I'm not actually sure what's wrong or how to fix it.

Are there clear conditions under which this occurs?
Logged

addictgamer

  • Bay Watcher
  • Penguin Developer
    • View Profile
    • Github
Re: Unending Siege bug
« Reply #7 on: September 19, 2012, 10:46:57 pm »

The only cause I'm aware of is the scenario presented in the opening post.
All the liberals not in the hospital (2 where in the free clinic) were either killed or caught in a siege on the homeless shelter (all my liberals were stationed in the homeless shelter).
When my two hospitalized liberals got out of the hospital come the end of the next month, they went back to their last location - the homeless shelter. Which was still under siege. I was not able to do anything over the ~two months that passed since the siege was initiated on the homeless shelter since all the liberals I could control were killed in that siege (I had no sleepers by the way. I think. If I did have a sleeper, it was a lawyer whom was a romantic interest of my founder (one of the two liberals hospitalized)). I was surprised seeing the siege still active after about two months. So, I tried to have my two liberals (the ones that just came back from the hospital) attempt an escape. The founder was shot to death. The other liberal was captured. He was sentenced to 11 years in prison. After 11 years of looking at the game count of time and telling me of the failed conservative attempts to re-educate my liberal, he was released and returned to the homeless shelter, which was still under siege.

See the correlation between the two encounters with the siege?
1. Both times all my active liberals were at the siege location.
 - The first time, though, I had two liberals hospitalized and thus away from the siege, thus not ending the game yet.
 - The second time, those two liberals were all I had - and they were both at the siege site.
2. Both times, all the liberals involved in the siege were killed or captured.

I hope this is clear. Do ask any questions you may have.

Edit: I just remembered. I did have a sleeper lawyer. I tried to use him to save my liberals from being judged guilty (which didn't work obviously. It's not easy to turn the court proceedings in your favor when you only have one sleeper lawyer).
« Last Edit: September 19, 2012, 10:48:56 pm by addictgamer »
Logged
I'm patiently waiting for the ability to mine and construct palaces in adventure mode.
Barony. A 3D, multiplayer roguelike I am developing.

MicroclineHat

  • Bay Watcher
    • View Profile
Re: Unending Siege bug
« Reply #8 on: September 25, 2012, 09:10:22 pm »

I still have this problem, too. However, it doesn't just occur when you have all your active liberals in one place. What makes it particularly nasty is that it also applies when the CIA, Mercenaries, or the CCS attacks as well. This eliminates the ability to Give Up as all your liberals are executed on the spot and the siege still doesn't end.
Logged
Cake throne needs cake, badly.