void dispersalcheck(char &clearformess)
{
int p = 0;
   //NUKE DISPERSED SQUAD MEMBERS WHOSE MASTERS ARE NOT AVAILABLE
   if(pool.size()>0)
   {
      // *JDS* I'm documenting this algorithm carefully because it
      // took me awhile to figure out what exactly was going on here.
      //
      // nukeme tracks whether each person has a secure chain of command.
      // 
      // if nukeme == 1, no confirmation of contact has been made
      // if nukeme == 0, confirmation that THEY are safe is given,
      //    but it is still needed to check whether their subordinates
      //    can reach them.
      // if nukeme == -1, confirmation has been made that this squad
      //    member is safe, and their immediate subordinates have also
      //    checked.
      //
      // The way the algorithm works, everyone starts at nukeme = 1.
      // Then we start at the top of the chain of command and walk
      // down it slowly, marking people 0 and then -1 as we sweep
      // down the chain. If someone is dead or in an unreachable state,
      // they block progression down the chain to their subordinates,
      // preventing everyone who requires contact with that person
      // from being marked safe. After everyone reachable has been
      // reached and marked safe, all remaining squad members are nuked.
      vector<int> nukeme;
      nukeme.resize(pool.size());

      for(p=pool.size()-1;p>=0;p--)
      {
         // If member is dead or has no boss (founder level), mark
         // them nukeme = 0, using them as a starting point at the top
         // of the chain.
         if(!pool[p]->alive||pool[p]->hireid==-1)nukeme[p]=0;
         // All remaining members are marked nukeme = 1.
         else nukeme[p]=1;
      }

      char changed;

      do // while(changed!=0)
      {
         changed=0;

         char inprison, alive;

         // Go through the entire pool to locate people at nukeme = 0,
         // so we can verify that their subordinates can reach them.
         for(p=pool.size()-1;p>=0;p--)
         {
            if(pool[p]->location!=-1&&location[pool[p]->location]->type==SITE_GOVERNMENT_PRISON)
               inprison=1;
            else inprison=0;

            if(pool[p]->alive)alive=1;
            else alive=0;

            // If in prison or unreachable due to a member of the command structure
            // above being in prison
            if(nukeme[p]==0&&alive&&inprison||nukeme[p]==2)
            {
               // If you're here because you're unreachable, mark as checked and unreachable
               if(!inprison)
               {
                  // Roll to see if you go into hiding or not
                  if(!pool[p]->hiding&&
                     pool[p]->attval(ATTRIBUTE_HEART)*5+pool[p]->juice<LCSrandom(200))
                  {
                     nukeme[p]=1;
                  }
                  else nukeme[p]=3;
               }
               else nukeme[p]=-1; // Else you're in prison; you're guaranteed contactable
               
               // Find all subordinates if you didn't lose contact completely
               if(nukeme[p]!=1)
               {
                  for(int p2=pool.size()-1;p2>=0;p2--)
                  {
                     if(pool[p2]->hireid==pool[p]->id)
                     {
                        nukeme[p2]=2; // Mark them as unreachable
                        changed=1; // Need another iteration
                     }
                  }
               }
            }
            // Otherwise, if they're both alive and reachable
            else if(nukeme[p]==0&&alive&&!inprison)
            {
               // Start looking through the pool again.
               for(int p2=pool.size()-1;p2>=0;p2--)
               {
                  // Locate each of this person's subordinates.
                  if(pool[p2]->hireid==pool[p]->id)
                  {
                     // Protect them from being dispersed -- their boss is
                     // safe. Their own subordinates will then be considered
                     // in the next loop iteration.
                     nukeme[p2]=0;
                     // If they're hiding indefinately and their boss isn't
                     // hiding at all, then have them discreetly return in a
                     // couple of weeks
                     if(pool[p2]->hiding==-1&&!pool[p]->hiding)
                     {
                        pool[p2]->hiding=LCSrandom(10)+3;
                     }
                     changed=1; // Take note that another iteration is needed.
                  }
               }
               // Now that we've dealt with this person's subordinates, mark
               // them so that we don't look at them again in this loop.
               nukeme[p]=-1;
            }
         }
      }while(changed); // If another iteration is needed, continue the loop.

      // After checking through the entire command structure, proceed
      // to nuke all squad members who are unable to make contact with
      // the LCS.
      for(p=pool.size()-1;p>=0;p--)
      {
         if(nukeme[p]==1||nukeme[p]==3)
         {
            if(clearformess)
            {
               erase();
            }
            else
            {
               makedelimiter(8,0);
            }

            if(!pool[p]->hiding&&nukeme[p]==3)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,1);
               move(8,1);
               addstr(pool[p]->name);
               addstr(" has lost touch with the Liberal Crime Squad.");
               move(9,1);
               addstr("The Liberal has gone into hiding...");
               refresh();
               getch();
            }
            else if(nukeme[p]==1)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,1);
               move(8,1);
               addstr(pool[p]->name);
               addstr(" has lost touch with the Liberal Crime Squad.");
               refresh();
               getch();
            }


            removesquadinfo(*pool[p]);
            if(nukeme[p]==1)
            {
               delete pool[p];
               pool.erase(pool.begin() + p);
            }
            else
            {
               int hs=0;
               for(int l=0;l<location.size();l++)
               {
                  if(location[l]->type==SITE_RESIDENTIAL_SHELTER)
                  {
                     hs=l;
                     break;
                  }
               }
               pool[p]->location=-1;
               pool[p]->base=hs;
               pool[p]->hiding=-1; // Hide indefinately
            }
         }
      }
   }

   //MUST DO AN END OF GAME CHECK HERE BECAUSE OF DISPERSAL
   endcheck(END_DISPERSED);
}
/* does end of month actions */
void passmonth(char &clearformess,char canseethings)
{
   short oldlaw[LAWNUM];
   memmove(oldlaw,law,sizeof(short)*LAWNUM);
   int l, v, p;

   //TIME ADVANCE
   day=1;
   month++;
   if(month==13)
   {
      month=1;
      year++;
   }

   switch(endgamestate)
   {
   case ENDGAME_NONE:
      if(publicmood(-1)>60)
      {
         endgamestate=ENDGAME_CCS_APPEARANCE;
         attitude[VIEW_CONSERVATIVECRIMESQUAD]=0;
      }
      break;
   case ENDGAME_CCS_APPEARANCE:
      if(publicmood(-1)>80)
         endgamestate=ENDGAME_CCS_ATTACKS;
      break;
   case ENDGAME_CCS_ATTACKS:
      if(publicmood(-1)>90)
         endgamestate=ENDGAME_CCS_SIEGES;
      break;
   case ENDGAME_CCS_SIEGES:
   case ENDGAME_CCS_DEFEATED:
      //if(publicmood(-1)>85&&presparty!=LIBERAL_PARTY)
      //   endgamestate=ENDGAME_MARTIALLAW;
      break;
   }

   //CLEAR RENT EXEMPTIONS
   for(l=0;l<len(location);l++) location[l]->newrental=0;

   //YOUR PAPER AND PUBLIC OPINION AND STUFF
   vector<int> nploc;
   for(l=0;l<len(location);l++)
   {
      if((location[l]->compound_walls & COMPOUND_PRINTINGPRESS)&&
         !location[l]->siege.siege&&
          location[l]->renting!=RENTING_CCS) nploc.push_back(l);
   }

   // Check for game over
   endcheck(END_DEAD);
   dispersalcheck(clearformess);

   int guardianpower=0;
   if(len(nploc)&&!disbanding)
   {
      //DO SPECIAL EDITIONS
      int loottypeindex=choosespecialedition(clearformess);

      if(loottypeindex!=-1)
      {
         guardianpower+=10*len(nploc);
         printnews(loottypeindex,len(nploc));

         if(loottype[loottypeindex]->get_idname()=="LOOT_INTHQDISK"|| //For special edition xml file? -XML
            loottype[loottypeindex]->get_idname()=="LOOT_SECRETDOCUMENTS")
         {
            for(int l=0;l<len(nploc);l++)
               criminalizepool(LAWFLAG_TREASON,-1,nploc[l]);
         }
      }
   }

   int libpower[VIEWNUM]={0};

   //STORIES STALE EVEN IF NOT PRINTED
   for(v=0;v<VIEWNUM;v++)public_interest[v]/=2;

   int conspower=200-attitude[VIEW_AMRADIO]-attitude[VIEW_CABLENEWS];

   //HAVING SLEEPERS
   for(int pl=len(pool)-1;pl>0;pl--)
      if(pool[pl]->alive&&(pool[pl]->flag & CREATUREFLAG_SLEEPER))
         sleepereffect(*pool[pl],clearformess,canseethings,libpower);

   //Manage graffiti
   for(int l=0;l<len(location);l++) // Check each location
   {
      for(int c=len(location[l]->changes)-1;c>=0;c--) // Each change to the map
      {
         if(location[l]->changes[c].flag==SITEBLOCK_GRAFFITI||
            location[l]->changes[c].flag==SITEBLOCK_GRAFFITI_CCS||
            location[l]->changes[c].flag==SITEBLOCK_GRAFFITI_OTHER) // Find changes that refer specifically to graffiti
         {
            int power=0,align=0;

            if(location[l]->changes[c].flag==SITEBLOCK_GRAFFITI) align=1;
            if(location[l]->changes[c].flag==SITEBLOCK_GRAFFITI_CCS) align=-1;

            //Purge graffiti from more secure sites (or from non-secure
            //sites about once every five years), but these will
            //influence people more for the current month
            if(securityable(location[l]->type))
            {
               location[l]->changes.erase(location[l]->changes.begin()+c);
               power=5;
            }
            else
            {
               if(location[l]->renting==RENTING_CCS)
                  location[l]->changes[c].flag=SITEBLOCK_GRAFFITI_CCS; // Convert to CCS tags
               else if(location[l]->renting==RENTING_PERMANENT)
                  location[l]->changes[c].flag=SITEBLOCK_GRAFFITI; // Convert to LCS tags
               else
               {
                  power=1;
                  if(!LCSrandom(10))
                     location[l]->changes[c].flag=SITEBLOCK_GRAFFITI_OTHER; // Convert to other tags
                  if(!LCSrandom(10)&&endgamestate<ENDGAME_CCS_DEFEATED&&endgamestate>0)
                     location[l]->changes[c].flag=SITEBLOCK_GRAFFITI_CCS; // Convert to CCS tags
                  if(!LCSrandom(30))
                     location[l]->changes.erase(location[l]->changes.begin()+c); // Clean up
               }
            }
            if(align==1)
            {
               background_liberal_influence[VIEW_LIBERALCRIMESQUAD]+=power;
               background_liberal_influence[VIEW_CONSERVATIVECRIMESQUAD]+=power;
            }
            else if(align==-1)
            {
               background_liberal_influence[VIEW_LIBERALCRIMESQUAD]-=power;
               background_liberal_influence[VIEW_CONSERVATIVECRIMESQUAD]-=power;
            }
         }
      }
   }

   int mediabalance=0;
   int issuebalance[VIEWNUM-5];
   //int stimulus=0;
   //double cost=0;
   //double tax=0;

   //PUBLIC OPINION NATURAL MOVES
   for(v=0;v<VIEWNUM;v++)
   {
      // Liberal essays add their power to the effect of sleepers
      libpower[v]+=background_liberal_influence[v];
      background_liberal_influence[v]=static_cast<short>(background_liberal_influence[v]*0.66);

      if(v==VIEW_LIBERALCRIMESQUADPOS) continue;
      if(v==VIEW_LIBERALCRIMESQUAD) continue;
      //if(v==VIEW_POLITICALVIOLENCE)
      //{
      //   change_public_opinion(VIEW_POLITICALVIOLENCE,-1,0);
      //   continue;
      //}
      if(v==VIEW_CONSERVATIVECRIMESQUAD) continue;
      if(v!=VIEW_AMRADIO&&v!=VIEW_CABLENEWS)
      {
         issuebalance[v] = libpower[v] - conspower;
         mediabalance += issuebalance[v];

         // Heavy randomization -- balance of power just biases the roll
         int roll = issuebalance[v] + LCSrandom(400)-200;

         // If +/-50 to either side, that side wins the tug-of-war
         if(roll < -50)
            change_public_opinion(v,-1,0);
         else if(roll > 50)
            change_public_opinion(v,1,0);
         else // Else random movement
            change_public_opinion(v,LCSrandom(2)*2-1,0);
      }

      // AM Radio and Cable News popularity slowly shift to reflect public
      // opinion over time -- if left unchecked, their subtle influence
      // on society will become a self-perpetuating Conservative nightmare!
      else if(v==VIEW_AMRADIO||v==VIEW_CABLENEWS)
      {
         if(publicmood(-1)<attitude[v])change_public_opinion(v,-1);
         else change_public_opinion(v,1);
      }
   }

   // Temporary Stalinizing Code (TODO: Implement the Stalinist Comrade Squad for changing public opinion, then remove this)
   if(stalinmode) for(int v=0;v<VIEWNUM-3;v++)
   {
      if(stalinview(v,false)) { if((attitude[v]+=3)>100) attitude[v]=100; }
      else { if(--attitude[v]<0) attitude[v]=0; }
   }
   // End Temporary Stalinizing Code (TODO: Implement the Stalinist Comrade Squad for changing public opinion, then remove this)

   // Seduction monthly experience stipends for those liberals
   // who have been getting it on with their love slaves/masters
   // in the background
   for(int s=0;s<len(pool);s++)
   {
      pool[s]->train(SKILL_SEDUCTION,loveslaves(*pool[s])*5);
      if(pool[s]->flag & CREATUREFLAG_LOVESLAVE)
         pool[s]->train(SKILL_SEDUCTION,5);
   }

   /*******************************************************
   *                 INTELLIGENCE REPORT                  *
   *     ONLY IF SHOWMECHANICS OR SHOWWAIT IS DEFINED     *
   *        EYES ONLY - LCS PROPERTY - TOP SECRET         *
   *******************************************************/
   #if defined(SHOWMECHANICS) || defined(SHOWWAIT)
   if(canseethings)
   {
      music.play(MUSIC_ELECTIONS);
      erase();
      set_color(COLOR_WHITE,COLOR_BLACK,1);
      mvaddstr(0,23,"LCS MONTHLY INTELLIGENCE REPORT");
      mvaddstr(2,27,"CURRENT POLITICAL TRENDS");
      int numviews=(endgamestate>=ENDGAME_CCS_DEFEATED||newscherrybusted<2)?VIEWNUM-1:VIEWNUM;
      for(int v=-1-stalinmode,y=4,x=0,pip;v<numviews;v++)
      {
         if((y-4)*2>=numviews+1+stalinmode) y=4,x=40;
         for(pip=2;pip>=-2;pip--)
         {
            set_alignment_color(pip,true);
            if(pip==2) mvaddchar(y,x+22,'\x11');
            addstr("ÄÄÄ");
            if(pip==-2) addchar('\x10');
         }
         if(v>=0) pip=14-(attitude[v]*14)/100;
         else pip=14-(publicmood(v)*14)/100;
         set_alignment_color((14-pip)/3-2,true);
         mvaddstr(y,x,getview(v,false));
         mvaddchar(y++,x+23+pip,'O');
      }
      set_color(COLOR_GREEN,COLOR_BLACK,1);
      mvaddstr(23,0,"Elite Liberal ");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
      addstr("-  ");
      set_color(COLOR_CYAN,COLOR_BLACK,1);
      addstr("Liberal  ");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
      addstr("-  ");
      set_color(COLOR_YELLOW,COLOR_BLACK,1);
      addstr("moderate  ");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
      addstr("-  ");
      set_color(COLOR_MAGENTA,COLOR_BLACK,1);
      addstr("Conservative  ");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
      addstr("-  ");
      set_color(COLOR_RED,COLOR_BLACK,1);
      addstr("Arch-Conservative");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
      mvaddstr(24,0,"Press any key to reflect on these poll numbers.");
      clearformess=1;

      getkey();
   }
   #endif
   /*******************************************************
   *                                                      *
   *               END INTELLIGENCE REPORT                *
   *                                                      *
   *******************************************************/

   //ELECTIONS
   if(month==11){elections(clearformess,canseethings);clearformess=1;}

   //SUPREME COURT
   if(month==6){supremecourt(clearformess,canseethings);clearformess=1;}

   //CONGRESS
   congress(clearformess,canseethings);clearformess=1;

   //DID YOU WIN?
   if(wincheck())
   {
      liberalagenda(1);
      savehighscore(END_WON);
      reset(savefile_name);
      viewhighscores();
      end_game();
   }

   //CONTROL LONG DISBANDS
   if(disbanding&&year-disbandtime>=50)
   {
      music.play(MUSIC_DEFEAT);
      set_color(COLOR_WHITE,COLOR_BLACK,1);

      erase();
      move(12,10);
      addstr("The Liberal Crime Squad is now just a memory.", gamelog);
      gamelog.newline();

      getkey();

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      erase();
      move(12,12);
      addstr("The last LCS members have all been hunted down.", gamelog);
      gamelog.newline();

      getkey();

      set_color(COLOR_BLACK,COLOR_BLACK,1);
      erase();
      move(12,14);
      addstr("They will never see the utopia they dreamed of...", gamelog);
      gamelog.newline();
      gamelog.nextMessage();

      getkey();

      savehighscore(END_DISBANDLOSS);
      reset(savefile_name);
      viewhighscores();
      end_game();
   }

   //UPDATE THE WORLD IN CASE THE LAWS HAVE CHANGED
   updateworld_laws(law,oldlaw);

   //THE SYSTEM!
   for(p=len(pool)-1;p>=0;p--)
   {
      if(disbanding) break;

      if(!pool[p]->alive) continue;
      if(pool[p]->flag & CREATUREFLAG_SLEEPER) continue;
      if(pool[p]->location==-1) continue;

      if(location[pool[p]->location]->type==SITE_GOVERNMENT_POLICESTATION)
      {
         if(clearformess) erase();
         else makedelimiter();

         if(pool[p]->flag & CREATUREFLAG_MISSING)
         {
            set_color(COLOR_MAGENTA,COLOR_BLACK,1);
            move(8,1);
            addstr("Cops re-polluted ", gamelog);
            addstr(pool[p]->name, gamelog);
            addstr("'s mind with Conservatism!", gamelog);
            gamelog.nextMessage();

            getkey();

            removesquadinfo(*pool[p]);
            delete_and_remove(pool,p);
            continue;
         }
         else if(pool[p]->flag & CREATUREFLAG_ILLEGALALIEN && law[LAW_IMMIGRATION]!=2)
         {
            set_color(COLOR_MAGENTA,COLOR_BLACK,1);
            move(8,1);
            addstr(pool[p]->name, gamelog);
            addstr(" has been shipped out to the INS to face ", gamelog);
            if(law[LAW_IMMIGRATION]==-2 && law[LAW_DEATHPENALTY]==-2)
               addstr("execution.", gamelog);
            else addstr("deportation.", gamelog);
            gamelog.newline();

            getkey();

            removesquadinfo(*pool[p]);
            delete_and_remove(pool,p);
            continue;
         }
         else
         {
            //TRY TO GET RACKETEERING CHARGE
            int copstrength=100;
            if(law[LAW_POLICEBEHAVIOR]==-2) copstrength=200;
            if(law[LAW_POLICEBEHAVIOR]==-1) copstrength=150;
            if(law[LAW_POLICEBEHAVIOR]==1) copstrength=75;
            if(law[LAW_POLICEBEHAVIOR]==2) copstrength=50;

            copstrength=(copstrength*pool[p]->heat)/4;
            if(copstrength>200)copstrength=200;

            //Confession check
            if(LCSrandom(copstrength)>pool[p]->juice  +  pool[p]->get_attribute(ATTRIBUTE_HEART,true)*5  -
                                      pool[p]->get_attribute(ATTRIBUTE_WISDOM,true)*5  +  pool[p]->get_skill(SKILL_PSYCHOLOGY)*5
                                      /*+ pool[p]->get_skill(SKILL_SURVIVAL)*5*/  &&  pool[p]->hireid!=-1)
            {
               int nullify=0;
               int p2=getpoolcreature(pool[p]->hireid);

               if(pool[p2]->alive && (pool[p2]->location==-1 || location[pool[p2]->location]->type!=SITE_GOVERNMENT_PRISON))
               {  //Charge the boss with racketeering!
                  criminalize(*pool[p2],LAWFLAG_RACKETEERING);
                  //Rack up testimonies against the boss in court!
                  pool[p2]->confessions++;
               }
               if(!nullify)
               {  //Issue a raid on this guy's base!
                  if(pool[p]->base>=0)location[pool[p]->base]->heat+=300;

                  set_color(COLOR_WHITE,COLOR_BLACK,1);
                  move(8,1);
                  addstr(pool[p]->name, gamelog);
                  addstr(" has broken under the pressure and ratted you out!", gamelog);
                  gamelog.newline();

                  getkey();

                  set_color(COLOR_WHITE,COLOR_BLACK,1);
                  move(9,1);
                  addstr("The traitor will testify in court, and safehouses may be compromised.", gamelog);
                  gamelog.nextMessage();

                  getkey();

                  removesquadinfo(*pool[p]);

                  delete_and_remove(pool,p);
                  continue; //no trial for this person; skip to next person
               }
               //else continue to trial
            }

            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(8,1);
            addstr(pool[p]->name, gamelog);
            addstr(" is moved to the courthouse for trial.", gamelog);
            gamelog.nextMessage();

            getkey();

            pool[p]->location=find_courthouse(*pool[p]);
            Armor prisoner(*armortype[getarmortype("ARMOR_PRISONER")]);
            pool[p]->give_armor(prisoner,NULL);
         }
      }
      else if(location[pool[p]->location]->type==SITE_GOVERNMENT_COURTHOUSE)
      { trial(*pool[p]); clearformess=1; }
      else if(location[pool[p]->location]->type==SITE_GOVERNMENT_PRISON)
         if(prison(*pool[p])) clearformess=1;
   }

   //NUKE EXECUTION VICTIMS
   for(p=len(pool)-1;p>=0;p--)
   {
      if(pool[p]->location==-1) continue;

      if(location[pool[p]->location]->type==SITE_GOVERNMENT_PRISON&&!pool[p]->alive)
      {
         removesquadinfo(*pool[p]);
         pool[p]->die();
         pool[p]->location=-1;
      }
   }

   //MUST DO AN END OF GAME CHECK HERE BECAUSE OF EXECUTIONS
   endcheck(END_EXECUTED);

   //DISPERSAL CHECK
   dispersalcheck(clearformess);

   //FUND REPORTS
   if(canseethings)fundreport(clearformess);
   ledger.resetMonthlyAmounts();
   if(clearformess) erase();

   //HEAL CLINIC PEOPLE
   for(p=0;p<len(pool);p++)
   {
      if(disbanding) break;
      if(!(pool[p]->alive)) continue;

      if(pool[p]->clinic>0)
      {
         pool[p]->clinic--;

         for(int w=0;w<BODYPARTNUM;w++)
         {
            if((pool[p]->wound[w]&WOUND_NASTYOFF)||(pool[p]->wound[w]&WOUND_CLEANOFF))
               pool[p]->wound[w]=(char)WOUND_CLEANOFF;
            else pool[p]->wound[w]=0;
         }

         int healthdamage = 0;

         if(pool[p]->special[SPECIALWOUND_RIGHTLUNG]!=1)
         {
            pool[p]->special[SPECIALWOUND_RIGHTLUNG]=1;
            if(LCSrandom(2)) healthdamage++;
         }
         if(pool[p]->special[SPECIALWOUND_LEFTLUNG]!=1)
         {
            pool[p]->special[SPECIALWOUND_LEFTLUNG]=1;
            if(LCSrandom(2)) healthdamage++;
         }
         if(pool[p]->special[SPECIALWOUND_HEART]!=1)
         {
            pool[p]->special[SPECIALWOUND_HEART]=1;
            if(LCSrandom(3)) healthdamage++;
         }
         pool[p]->special[SPECIALWOUND_LIVER]=1;
         pool[p]->special[SPECIALWOUND_STOMACH]=1;
         pool[p]->special[SPECIALWOUND_RIGHTKIDNEY]=1;
         pool[p]->special[SPECIALWOUND_LEFTKIDNEY]=1;
         pool[p]->special[SPECIALWOUND_SPLEEN]=1;
         pool[p]->special[SPECIALWOUND_RIBS]=RIBNUM;

         if(!pool[p]->special[SPECIALWOUND_NECK])
            pool[p]->special[SPECIALWOUND_NECK]=2;
         if(!pool[p]->special[SPECIALWOUND_UPPERSPINE])
            pool[p]->special[SPECIALWOUND_UPPERSPINE]=2;
         if(!pool[p]->special[SPECIALWOUND_LOWERSPINE])
            pool[p]->special[SPECIALWOUND_LOWERSPINE]=2;

         // Inflict permanent health damage
         pool[p]->set_attribute(ATTRIBUTE_HEALTH,pool[p]->get_attribute(ATTRIBUTE_HEALTH,0)-healthdamage);
         if(pool[p]->get_attribute(ATTRIBUTE_HEALTH,0)<=0)
            pool[p]->set_attribute(ATTRIBUTE_HEALTH,1);

         if(pool[p]->blood<=20&&pool[p]->clinic<=2)pool[p]->blood=50;
         if(pool[p]->blood<=50&&pool[p]->clinic<=1)pool[p]->blood=75;

         // If at clinic and in critical condition, transfer to university hospital
         if(pool[p]->clinic > 2 &&
            pool[p]->location > -1 &&
            location[pool[p]->location]->type==SITE_HOSPITAL_CLINIC)
         {
            int hospital=find_hospital(*pool[p]);
            if(hospital!=-1)
            {
               pool[p]->location=hospital;
               set_color(COLOR_WHITE,COLOR_BLACK,1);
               move(8,1);
               addstr(pool[p]->name, gamelog);
               addstr(" has been transferred to ", gamelog);
               addstr(location[hospital]->name, gamelog);
               addstr(".", gamelog);
               gamelog.nextMessage();

               getkey();
            }
         }

         // End treatment
         if(pool[p]->clinic==0)
         {
            pool[p]->blood=100;
            if(clearformess) erase();
            else makedelimiter();

            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(8,1);
            addstr(pool[p]->name, gamelog);
            addstr(" has left ", gamelog);
            addstr(location[pool[p]->location]->name, gamelog);
            addstr(".", gamelog);
            gamelog.nextMessage();

            int hs=find_homeless_shelter(*pool[p]);
            if(hs==-1) hs=0; //TODO: Error unable to find location

            if(location[pool[p]->base]->siege.siege||
               location[pool[p]->base]->renting==RENTING_NOCONTROL)
               pool[p]->base=hs;

            pool[p]->location=pool[p]->base;

            getkey();
         }
      }
   }
}
/* character info at top of screen */
void printcreatureinfo(Creature *cr, unsigned char knowledge)
{
   char num[20],str[200];

   makedelimiter(1,0);

   set_color(COLOR_WHITE,COLOR_BLACK,0);
   move(1,2);
   addstr(cr->name);
   addstr(", ");
   gettitle(str,*cr);
   addstr(str);

   if(cr->prisoner!=NULL)
   {
      addstr(", holding ");
      switch(cr->prisoner->type)
      {
      case CREATURE_CORPORATE_CEO:addstr("a squirming CEO");break;
      case CREATURE_RADIOPERSONALITY:addstr("a crying Radio Personality");break;
      case CREATURE_NEWSANCHOR:addstr("smarmy News Anchor");break;
      case CREATURE_SCIENTIST_EMINENT:addstr("a frightened Eminent Scientist");break;
      case CREATURE_JUDGE_CONSERVATIVE:addstr("an angry Hangin' Judge");break;
      default:
         addstr(cr->prisoner->name);
         break;
      }
   }

   move(2,0);addstr("Hrt:    ");
   if(knowledge>0)
   {
      itoa(cr->get_attribute(ATTRIBUTE_HEART,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(3,0);addstr("Int:    ");
   if(knowledge>0)
   {
      itoa(cr->get_attribute(ATTRIBUTE_INTELLIGENCE,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(4,0);addstr("Wis:    ");
   if(knowledge>0)
   {
      itoa(cr->get_attribute(ATTRIBUTE_WISDOM,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(5,0);addstr("Hlth:   ");
   if(knowledge>1)
   {
      itoa(cr->get_attribute(ATTRIBUTE_HEALTH,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(2,11);addstr("Agi:    ");
   if(knowledge>1)
   {
      itoa(cr->get_attribute(ATTRIBUTE_AGILITY,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(3,11);addstr("Str:    ");
   if(knowledge>1)
   {
      itoa(cr->get_attribute(ATTRIBUTE_STRENGTH,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(4,11);addstr("Char:   ");
   if(knowledge>0)
   {
      itoa(cr->get_attribute(ATTRIBUTE_CHARISMA,true),num,10);
      addstr(num);
   }
   else addstr("?");
   move(5,11);
   addstr("Trans: ");
   long v=-1;
   if(showcarprefs==1)v=id_getcar(cr->pref_carid);
   else v=id_getcar(cr->carid);
   if(v!=-1&&showcarprefs!=-1)
   {
      strcpy(str,vehicle[v]->shortname().c_str());
      char d;
      if(showcarprefs==1)d=cr->pref_is_driver;
      else d=cr->is_driver;
      if(d)strcat(str,"-D");
   }
   else
   {
      int legok=2;
      if((cr->wound[BODYPART_LEG_RIGHT] & WOUND_NASTYOFF)||
         (cr->wound[BODYPART_LEG_RIGHT] & WOUND_CLEANOFF))legok--;
      if((cr->wound[BODYPART_LEG_LEFT] & WOUND_NASTYOFF)||
         (cr->wound[BODYPART_LEG_LEFT] & WOUND_CLEANOFF))legok--;
      if(cr->flag & CREATUREFLAG_WHEELCHAIR)strcpy(str,"Wheelchair");
      else if(legok>=1)strcpy(str,"On Foot");
      else strcpy(str,"On \"Foot\"");
   }
   addstr(str);
   move(6,0);
   if(mode!=GAMEMODE_SITE)set_color(COLOR_WHITE,COLOR_BLACK,0);
   else
      switch(weaponcheck(*cr))
   {
      case -1:
      case 0:set_color(COLOR_GREEN,COLOR_BLACK,1);break;
      case 1:set_color(COLOR_YELLOW,COLOR_BLACK,1);break;
      case 2:set_color(COLOR_RED,COLOR_BLACK,1);break;
   }
   addstr("Weapon: ");
   addstr(cr->get_weapon_string(1).c_str());
   

   if(mode!=GAMEMODE_SITE)set_color(COLOR_WHITE,COLOR_BLACK,0);
   else
   {
      switch(hasdisguise(*cr))
      {
      case 1:set_color(COLOR_GREEN,COLOR_BLACK,1);break;
      case 2:set_color(COLOR_YELLOW,COLOR_BLACK,1);break;
      default:
         if(cr->get_armor().get_stealth_value() > 1)
            set_color(COLOR_BLACK,COLOR_BLACK,1);
         else
            set_color(COLOR_RED,COLOR_BLACK,1);
      }
      if(sitealarmtimer>=0 || sitealarm==1)
         if(cr->get_armor().get_stealth_value() > 1)
            set_color(COLOR_BLACK,COLOR_BLACK,1);
   }
   move(7,0);
   addstr("Clothes: ");
   addstr(cr->get_armor_string(false).c_str());

   set_color(COLOR_WHITE,COLOR_BLACK,0);

   char used[SKILLNUM];
   memset(used,0,sizeof(char)*SKILLNUM);

   int snum=5;
   char printed=1;

   while(snum>0&&printed)
   {
      printed=0;

      int max=0;
      long maxs=-1;
      for(int s=0;s<SKILLNUM;s++)
      {
         if(cr->get_skill(s)>max && !used[s])
         {
            max=cr->get_skill(s);
            maxs=s;
         }
      }

      if(maxs!=-1)
      {
         used[maxs]=1;
         printed=1;

         if(cr->get_skill_ip(maxs)>=100+(10*cr->get_skill(maxs))&&
            cr->get_skill(maxs)<cr->skill_cap(maxs,true))set_color(COLOR_WHITE,COLOR_BLACK,1);
         else set_color(COLOR_WHITE,COLOR_BLACK,0);

         move(3+5-snum,31);
         if(knowledge>5-snum)
            strcpy(str,Skill::get_name(maxs).c_str());
         else
            strcpy(str,"???????");
         strcat(str,": ");
         if(knowledge>7-snum)
            itoa(cr->get_skill(maxs),num,10);
         else
            strcpy(num,"?");
         strcat(str,num);
         addstr(str);

         if(snum==5&&printed)
         {
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            move(2,31);
            addstr("Top Skills:");
         }
      }

      snum--;
   }

   int woundsum=0;
   for(int w=0;w<BODYPARTNUM;w++)
   {
      if(cr->wound[w]!=0)woundsum++;
   }

   printhealthstat(*cr,1,49,FALSE);

   if(woundsum>0)
   {
      for(int w=0;w<BODYPARTNUM;w++)
      {
         if(cr->wound[w] & WOUND_BLEEDING)set_color(COLOR_RED,COLOR_BLACK,1);
         else set_color(COLOR_WHITE,COLOR_BLACK,0);

         move(2+w,49);
         switch(w)
         {
         case BODYPART_HEAD:addstr("Head:");break;
         case BODYPART_BODY:addstr("Body:");break;
         case BODYPART_ARM_RIGHT:addstr("Right Arm:");break;
         case BODYPART_ARM_LEFT:addstr("Left Arm:");break;
         case BODYPART_LEG_RIGHT:addstr("Right Leg:");break;
         case BODYPART_LEG_LEFT:addstr("Left Leg:");break;
         }

         move(2+w,61);
         if(cr->wound[w] & WOUND_NASTYOFF)addstr("Ripped off");
         else if(cr->wound[w] & WOUND_CLEANOFF)addstr("Clean sever");
         else
         {
            int sum=0;

            if(cr->wound[w] & WOUND_SHOT)sum++;
            if(cr->wound[w] & WOUND_CUT)sum++;
            if(cr->wound[w] & WOUND_BRUISED)sum++;
            if(cr->wound[w] & WOUND_BURNED)sum++;
            if(cr->wound[w] & WOUND_TORN)sum++;

            if(sum==0)
            {
               set_color(COLOR_GREEN,COLOR_BLACK,1);
               if(cr->animalgloss==ANIMALGLOSS_ANIMAL)
                  addstr("Animal");
               else
                  addstr("Liberal");
            }

            if(cr->wound[w] & WOUND_SHOT){addstr("Sht");sum--;if(sum>0)addstr(",");}
            if(cr->wound[w] & WOUND_BRUISED){addstr("Brs");sum--;if(sum>0)addstr(",");}
            if(cr->wound[w] & WOUND_CUT){addstr("Cut");sum--;if(sum>0)addstr(",");}
            if(cr->wound[w] & WOUND_TORN){addstr("Trn");sum--;if(sum>0)addstr(",");}
            if(cr->wound[w] & WOUND_BURNED){addstr("Brn");sum--;if(sum>0)addstr(",");}
         }
      }
      set_color(COLOR_WHITE,COLOR_BLACK,0);
   }
}
void activate(Creature *cr)
{
   int hostagecount=0;
   int state=0;
   int choice=0;
   char havedead=0;
   for(int p=0;p<pool.size();p++)
   {
      if(pool[p]->alive&&pool[p]->align!=1&&pool[p]->location==cr->location)hostagecount++;
      if(!pool[p]->alive)havedead=1;
   }

   do
   {
      erase();

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      printfunds(0,1,"Money: ");

      move(0,0);
     if (cr->income)
     {
        addstr(cr->name);
        addstr(" made $");
        char num[20];
        itoa(cr->income,num,10);
        addstr(num);
        addstr(" yesterday. What now?");
     }
     else
     {
        addstr("Taking Action: What will ");
        addstr(cr->name);
        addstr(" be doing today?");
     }

      printcreatureinfo(cr);

      makedelimiter(8,0);

      set_color(COLOR_WHITE,COLOR_BLACK,state=='a');
      move(10,1);
      addstr("A - Engaging in Liberal Activism");

      set_color(COLOR_WHITE,COLOR_BLACK,state=='b');
      move(11,1);
      addstr("B - Legal Fundraising");

      set_color(COLOR_WHITE,COLOR_BLACK,state=='c');
      move(12,1);
      addstr("C - Illegal Fundraising");

      set_color(COLOR_WHITE,COLOR_BLACK,state=='d');
      move(13,1);
      addstr("D - Make/Repair Clothing");

      if(cr->get_skill(SKILL_FIRSTAID)!=0)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,(cr->activity.type==ACTIVITY_HEAL||cr->activity.type==ACTIVITY_NONE)&&state==0);
      }
      else
      {
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      }
      move(14,1);
      addstr("H - Heal Liberals");

      move(15,1);
      if(cr->canwalk())
      {
         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_STEALCARS&&state==0);
         addstr("S - Stealing a Car");
      }
      else
      {
         if(!(cr->flag & CREATUREFLAG_WHEELCHAIR))set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_WHEELCHAIR&&state==0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         addstr("S - Procuring a Wheelchair");
      }

      set_color(COLOR_WHITE,COLOR_BLACK,state=='t');
      move(16,1);
      addstr("T - Teaching Other Liberals");

     if(hostagecount>0)set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_HOSTAGETENDING&&state==0);
      else set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(17,1);
      addstr("I - Tend to a Conservative hostage");

      if(clinictime(*cr))
     {
        set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_CLINIC&&state==0);
        move(18,1);
        addstr("M - Move to the Free CLINIC");
     }
      else
     {
        set_color(COLOR_WHITE,COLOR_BLACK,state=='l');
        move(18,1);
        addstr("L - Learn in the University District");
     }
      

      if(havedead)set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_BURY&&state==0);
      else set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(19,1);
      addstr("Z - Dispose of bodies");

     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;
      }

     if (!sieged)
     {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
        move(20,1);
        addstr("E - Equip this Liberal");
     }

      if(state == 'a' || state == 'b' || state == 'c' ||state == 'd' )
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(19,40);
         addstr("? - Help");
      }

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(20,40);
      addstr("Enter - Confirm Selection");

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(21,1);
      addstr("X - Nothing for Now");

      switch(state)
      {
      case 'a':
         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_COMMUNITYSERVICE);
         move(10,40);
         addstr("1 - Community Service");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_TROUBLE);
         move(11,40);
         addstr("2 - Liberal Disobedience");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_GRAFFITI);
         move(12,40);
         addstr("3 - Graffiti");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_POLLS);
         move(13,40);
         addstr("4 - Search Opinion Polls");

         //set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_DOS_ATTACKS);
         //move(14,40);
         //addstr("5 - Harass Websites");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_HACKING);
         move(14,40);
         addstr("5 - Hacking");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_WRITE_LETTERS);
         move(15,40);
         addstr("6 - Write to Newspapers");

         if(cr->location!=-1&&
            location[cr->location]->compound_walls & COMPOUND_PRINTINGPRESS)
         {
            set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_WRITE_GUARDIAN);
            move(16,40);
            addstr("7 - Write for The Liberal Guardian");
         }
         break;
      case 'b':
         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_DONATIONS);
         move(10,40);
         addstr("1 - Solicit Donations");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SELL_TSHIRTS);
         move(11,40);
         if(cr->get_skill(SKILL_TAILORING)>=8)
            addstr("2 - Sell Liberal T-Shirts");
         else if(cr->get_skill(SKILL_TAILORING)>=4)
            addstr("2 - Sell Embroidered Shirts");
         else
            addstr("2 - Sell Tie-Dyed T-Shirts");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SELL_ART);
         move(12,40);
         if(cr->get_skill(SKILL_ART)>=8)
            addstr("3 - Sell Liberal Art");
         else if(cr->get_skill(SKILL_ART)>=4)
            addstr("3 - Sell Paintings");
         else
            addstr("3 - Sell Portrait Sketches");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SELL_MUSIC);
         move(13,40);
         if(cr->get_skill(SKILL_MUSIC)>8)
            addstr("4 - Play Liberal Music");
         else
            addstr("4 - Play Street Music");
         break;
      case 'c':
         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SELL_DRUGS);
         move(10,40);
         addstr("1 - Sell Brownies");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_PROSTITUTION);
         move(11,40);
         if(cr->age < 18)
            set_color(COLOR_BLACK, COLOR_BLACK, 1);    //Grayed out for minors
         addstr("2 - Prostitution");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_CCFRAUD);
         move(12,40);
         addstr("3 - Steal Credit Card Numbers");

         /*set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_DOS_RACKET);
         move(13,40);
         addstr("4 - Electronic Protection Racket");*/
         break;
      case 'd':
         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_MAKE_ARMOR);
         move(10,40);
         addstr("1 - Make Clothing");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_REPAIR_ARMOR);
         move(11,40);
         addstr("2 - Repair Clothing");
         break;
      case 't':
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(10,40);
         addstr("Teach Liberals About What?");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_TEACH_POLITICS);
         move(12,40);
         addstr("1 - Political Activism");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_TEACH_COVERT);
         move(13,40);
         addstr("2 - Infiltration");

         set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_TEACH_FIGHTING);
         move(14,40);
         addstr("3 - Urban Warfare");
       break;
     case 'l':
       listclasses(cr);
       break;
      }

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      switch(cr->activity.type)
      {
      case ACTIVITY_COMMUNITYSERVICE:
         move(22,3);
         addstr(cr->name);
         addstr(" will help the elderly, local library, anything");
         move(23,1);
         addstr("  that is liberal.");
         break;
      case ACTIVITY_TROUBLE:
         move(22,3);
         addstr(cr->name);
         addstr(" will create public disturbances. ");
         break;
      case ACTIVITY_GRAFFITI:
         move(22,3);
         addstr(cr->name);
         addstr(" will spray political graffiti. Art and Heart will");
         move(23,1);
         addstr("  enhance the liberal effect.");
         break;
      case ACTIVITY_POLLS:
         move(22,3);
         addstr(cr->name);
         addstr(" will search the internet for public opinion polls.");
         move(23,1);
         addstr("  Polls will give an idea on how the liberal agenda is going. Computers");
         move(24,1);
         addstr("  and intelligence will provide better results.");
         break;
      case ACTIVITY_DOS_ATTACKS:
         move(22,3);
         addstr(cr->name);
         addstr(" will harass Conservative websites. Computer skill");
         move(23,1);
         addstr("  will give greater effect.");
         break;
      case ACTIVITY_HACKING:
         move(22,3);
         addstr(cr->name);
         addstr(" will harass websites and hack private networks.");
         move(23,1);
         addstr("  Computer skill and intelligence will give more frequent results.");
         move(24,1);
         addstr("  Multiple hackers will increase chances of both success and detection.");
         break;
      case ACTIVITY_WRITE_LETTERS:
         move(22,3);
         addstr(cr->name);
         addstr(" will write letters to newspapers about current events.");
         break;
      case ACTIVITY_WRITE_GUARDIAN:
         move(22,3);
         addstr(cr->name);
         addstr(" will write articles for the LCS's newspaper.");
         break;
      case ACTIVITY_DONATIONS:
         move(22,3);
         addstr(cr->name);
         addstr(" will walk around and ask for donations to the LCS.");
         move(23,1);
         addstr("  Based on persuasion, public's view on the cause, and how well dressed the");
         move(24,1);
         addstr("  activist is.");
         break;
      case ACTIVITY_SELL_TSHIRTS:
         move(22,3);
         addstr(cr->name);
         if(cr->get_skill(SKILL_TAILORING)>=8)
            addstr(" will print and distribute shirts with Liberal slogans.");
         else if(cr->get_skill(SKILL_TAILORING)>=4)
            addstr(" will embroider shirts and sell them on the street.");
         else
            addstr(" will tie-dye T-shirts and sell them on the street.");
         break;
      case ACTIVITY_SELL_ART:
         move(22,3);
         addstr(cr->name);
         if(cr->get_skill(SKILL_ART)>=8)
            addstr(" will create and sell paintings embracing the Liberal agenda.");
         else if(cr->get_skill(SKILL_ART)>=4)
            addstr(" will make pretty paintings and sell them on the streets.");
         else
            addstr(" will sketch people and sell portraits back to them.");
         break;
      case ACTIVITY_SELL_MUSIC:
         move(22,3);
         addstr(cr->name);
         addstr(" will go out into the streets and drum on buckets,");
         move(23,1);
         addstr("  or play guitar if one is equipped.");
         break;
      case ACTIVITY_SELL_DRUGS:
         move(22,3);
         addstr(cr->name);
         addstr(" will bake and sell special adult brownies that open");
         move(23,1);
         addstr("  magical shimmering doorways to the adamantium pits.");
         break;
      case ACTIVITY_PROSTITUTION:
         move(22,3);
         addstr(cr->name);
         addstr(" will trade sex for money.");
         break;
      case ACTIVITY_CCFRAUD:
         move(22,3);
         addstr(cr->name);
         addstr(" will commit credit card fraud online.");
         break;
      case ACTIVITY_DOS_RACKET:
         move(22,3);
         addstr(cr->name);
         addstr(" will demand money in exchange for not bringing down");
         move(23,1);
         addstr("major websites.");
         break;
      case ACTIVITY_TEACH_POLITICS:
         move(22,1);
         addstr("  Skills Trained: Writing, Persuasion, Law, Street Sense, Science,");
         move(23,1);
         addstr("    Religion, Business, Music, Art");
         move(24,1);
         addstr("  Classes cost up to $20/day to conduct. All Liberals able will attend.");
         break;
      case ACTIVITY_TEACH_COVERT:
         move(22,1);
         addstr("  Skills Trained: Computers, Security, Stealth, Disguise, Tailoring,");
         move(23,1);
         addstr("    Seduction, Psychology, Driving");
         move(24,1);
         addstr("  Classes cost up to $60/day to conduct. All Liberals able will attend.");
         break;
      case ACTIVITY_TEACH_FIGHTING:
         move(22,1);
         addstr("  Skills Trained: All Weapon Skills, Martial Arts, Dodge, First Aid");
         move(24,1);
         addstr("  Classes cost up to $100/day to conduct. All Liberals able will attend.");
         break;
      case ACTIVITY_STUDY_DEBATING:
      case ACTIVITY_STUDY_MARTIAL_ARTS:
      case ACTIVITY_STUDY_DRIVING:
      case ACTIVITY_STUDY_PSYCHOLOGY:
      case ACTIVITY_STUDY_FIRST_AID:
      case ACTIVITY_STUDY_LAW:
      case ACTIVITY_STUDY_DISGUISE:
      case ACTIVITY_STUDY_SCIENCE:
      case ACTIVITY_STUDY_BUSINESS:
      //case ACTIVITY_STUDY_COOKING:
      case ACTIVITY_STUDY_GYMNASTICS:
      case ACTIVITY_STUDY_WRITING:
      case ACTIVITY_STUDY_ART:
      case ACTIVITY_STUDY_MUSIC:
      case ACTIVITY_STUDY_TEACHING:
      case ACTIVITY_STUDY_LOCKSMITHING:
         move(22,3);
         addstr(cr->name);
         addstr(" will attend classes in the University District");
         move(23,1);
         addstr("  at a cost of $60 a day.");
         break;
      }

      refresh();
      int c=getch();
      translategetch(c);



      if(c>='a'&&c<='z'){state=c;}
      if((c>='a'&&c<='z') || (c>='1'&&c<='9'))
      {
         choice=c;
         switch(state)
         {
         case 'a':
            switch(choice)
            {
            case '1':cr->activity.type=ACTIVITY_COMMUNITYSERVICE;break;
            case '2':cr->activity.type=ACTIVITY_TROUBLE;break;
            case '3':cr->activity.type=ACTIVITY_GRAFFITI;
               cr->activity.arg=-1;
               break;
            case '4':cr->activity.type=ACTIVITY_POLLS;break;
            //case '5':cr->activity.type=ACTIVITY_DOS_ATTACKS;break;
            case '5':cr->activity.type=ACTIVITY_HACKING;break;
            case '6':cr->activity.type=ACTIVITY_WRITE_LETTERS;break;
            case '7':
               if(cr->location!=-1&&
                  location[cr->location]->compound_walls & COMPOUND_PRINTINGPRESS)
               {
                  cr->activity.type=ACTIVITY_WRITE_GUARDIAN;break;
               }
            default:
               if(cr->get_attribute(ATTRIBUTE_WISDOM,true)>7)
               {
                  cr->activity.type=ACTIVITY_COMMUNITYSERVICE;
                  choice='1';
               }
               else if(cr->get_attribute(ATTRIBUTE_WISDOM,true)>4)
               {
                  cr->activity.type=ACTIVITY_TROUBLE;
                  choice='2';
               }
               else
               {
                  if(cr->get_skill(SKILL_COMPUTERS)>2)
                  {
                     cr->activity.type=ACTIVITY_HACKING;
                     choice='5';
                  }
                  else if(cr->get_skill(SKILL_ART)>1)
                  {
                     cr->activity.type=ACTIVITY_GRAFFITI;
                     cr->activity.arg=-1;
                     choice='3';
                  }
                  else
                  {
                     cr->activity.type=ACTIVITY_TROUBLE;
                     choice='2';
                  }
               }
            }
            break;
         case 'b':
            switch(choice)
            {
            case '1':cr->activity.type=ACTIVITY_DONATIONS;break;
            case '2':cr->activity.type=ACTIVITY_SELL_TSHIRTS;break;
            case '3':cr->activity.type=ACTIVITY_SELL_ART;break;
            case '4':cr->activity.type=ACTIVITY_SELL_MUSIC;break;
            default:
               if(cr->get_skill(SKILL_ART)>1)
               {
                  cr->activity.type=ACTIVITY_SELL_ART;
                  choice='3';
               }
               else if(cr->get_skill(SKILL_TAILORING)>1)
               {
                  cr->activity.type=ACTIVITY_SELL_TSHIRTS;
                  choice='2';
               }
               else if(cr->get_skill(SKILL_MUSIC)>1)
               {
                  cr->activity.type=ACTIVITY_SELL_MUSIC;
                  choice='4';
               }
               else
               {
                  cr->activity.type=ACTIVITY_DONATIONS;
                  choice='1';
               }
            }
            break;
         case 'c':
            switch(choice)
            {
            case '1':cr->activity.type=ACTIVITY_SELL_DRUGS;break;
            case '2':
               if(cr->age >= 18) cr->activity.type=ACTIVITY_PROSTITUTION;break;
            case '3':cr->activity.type=ACTIVITY_CCFRAUD;break;
               //case '4':cr->activity.type=ACTIVITY_DOS_RACKET;break;
            default:
               if(cr->get_skill(SKILL_COMPUTERS)>1)
               {
                  cr->activity.type=ACTIVITY_CCFRAUD;
                  choice='3';
               }
               else if(cr->get_skill(SKILL_SEDUCTION)>1 && cr->age >= 18)
               {
                  cr->activity.type=ACTIVITY_PROSTITUTION;
                  choice='2';
               }
               else
               {
                  cr->activity.type=ACTIVITY_SELL_DRUGS;
                  choice='1';
               }
            }
            break;
         case 'd':
            switch(choice)
            {
            case '1':break;
            case '2':cr->activity.type=ACTIVITY_REPAIR_ARMOR;choice='2';break;
            default:cr->activity.type=ACTIVITY_REPAIR_ARMOR;choice='2';break;
            }
            break;
       case 'l':
          updateclasschoice(cr, choice);
          break;
         case 't':
            switch(choice)
            {
            case '1':cr->activity.type=ACTIVITY_TEACH_POLITICS;break;
            case '2':cr->activity.type=ACTIVITY_TEACH_COVERT;break;
            case '3':cr->activity.type=ACTIVITY_TEACH_FIGHTING;break;
            default:
               switch(cr->type)
               {
               case CREATURE_MERC:
               case CREATURE_SWAT:
               case CREATURE_DEATHSQUAD:
               case CREATURE_GANGUNIT:
               case CREATURE_SOLDIER:
               case CREATURE_VETERAN:
               case CREATURE_HARDENED_VETERAN:
               case CREATURE_GANGMEMBER:
               case CREATURE_MUTANT:
               case CREATURE_CRACKHEAD:
                  cr->activity.type=ACTIVITY_TEACH_FIGHTING;
                  choice='2';
                  break;
               case CREATURE_AGENT:
               case CREATURE_AMATEURMAGICIAN:
               case CREATURE_THIEF:
               case CREATURE_PROSTITUTE:
               case CREATURE_PRISONER:
                  cr->activity.type=ACTIVITY_TEACH_COVERT;
                  choice='3';
                  break;
               default:
                  cr->activity.type=ACTIVITY_TEACH_POLITICS;
                  choice='1';
                  break;
               }
               break;
            }
            break;
         }
      }

      if(c=='h'&&cr->get_skill(SKILL_FIRSTAID)!=0)
      {
         cr->activity.type=ACTIVITY_HEAL;
         break;
      }
      if(state=='d'&&choice=='1')
      {
         activityst oact=cr->activity;
         cr->activity.type=ACTIVITY_NONE;
         select_makeclothing(cr);
         if(cr->activity.type==ACTIVITY_MAKE_ARMOR)break;
         else cr->activity=oact;
      }
      if(c=='i'&&hostagecount>0)
      {
         activityst oact=cr->activity;
         cr->activity.type=ACTIVITY_NONE;
         select_tendhostage(cr);
         if(cr->activity.type==ACTIVITY_HOSTAGETENDING)break;
         else cr->activity=oact;
      }
      if (!sieged && c == 'e')
      {
         //create a temp squad containing just this liberal
         int oldsquadid = cr->squadid;
         squadst *oldactivesquad = activesquad;
         activesquad=new squadst;
         strcpy(activesquad->name, "Temporary Squad");
         activesquad->id=cursquadid;
         activesquad->squad[0]=cr;
         cr->squadid = activesquad->id;
         //go to equipment screen
         equip(location[activesquad->squad[0]->location]->loot,-1);
         //once you're done, restore original squad status.
         delete activesquad;
         activesquad = oldactivesquad;
         cr->squadid = oldsquadid;
      }
      if(c=='s')
      {
         if(cr->canwalk())
         {
            cr->activity.type=ACTIVITY_STEALCARS;
            break;
         }
         else if(!(cr->flag & CREATUREFLAG_WHEELCHAIR))
         {
            cr->activity.type=ACTIVITY_WHEELCHAIR;
            break;
         }
      }
      /*if(c=='w'&&location[cr->location]->compound_walls==COMPOUND_PRINTINGPRESS)
      {
      activityst oact=cr->activity;
      cr->activity.type=ACTIVITY_NONE;
      if(select_view(cr,cr->activity.arg))
      cr->activity.type=ACTIVITY_WRITE_GUARDIAN;
      else cr->activity=oact;
      break;
      }*/
      if(c=='m'&&clinictime(*cr))
      {
         cr->activity.type=ACTIVITY_CLINIC;
         break;
      }
      if(c=='z'&&havedead)
      {
         cr->activity.type=ACTIVITY_BURY;
         break;
      }
      if(c=='x')
      {
         cr->activity.type=ACTIVITY_NONE;
         break;
      }
      // Enter pressed
      if(c==10||c==ESC)
      {
         break;
      }
      // ? Pressed
      if(c==63)
      {     
         if(state == 'a' || state == 'b' || state == 'c' ||state == 'd' )
         {
            // Call activity help pages
            HelpActivities(cr->activity.type);
         }
      }
   }while(1);
}
Beispiel #5
0
/* daily - recruit - recruit meeting */
char completerecruitmeeting(recruitst &r,int p,char &clearformess)
{
   clearformess=1;

   

   erase();
   set_color(COLOR_WHITE,COLOR_BLACK,1);
   move(0,0);
   if(pool[p]->meetings++>5 && LCSrandom(pool[p]->meetings-5))
   {
      addstr(pool[p]->name, gamelog);
      addstr(" accidentally missed the meeting with ", gamelog);
      addstr(r.recruit->name, gamelog);
      move(1,0);
      addstr("due to multiple booking of recruitment sessions.", gamelog);
      gamelog.newline();

      move(3,0);
      addstr("Get it together, ", gamelog);
      addstr(pool[p]->name, gamelog);
      addstr("!", gamelog);
      gamelog.nextMessage();
      getch();

      return 1;
   }
   addstr("Meeting with ", gamelog);
   addstr(r.recruit->name, gamelog);
   addstr(", ", gamelog);
   char str[75];
   getrecruitcreature(str,r.recruit->type);
   addstr(str, gamelog);
   addstr(", ", gamelog);
   addstr(location[r.recruit->location]->name, gamelog);
   gamelog.newline();

   set_color(COLOR_WHITE,COLOR_BLACK,0);
   printfunds(0,1,"Money: ");

   printcreatureinfo(r.recruit);
   makedelimiter(8,0);

   move(10,0);
   addstr(r.recruit->name);
   switch(r.eagerness())
   {
   case 1:
      addstr(" will take a lot of persuading.");
      break;
   case 2:
      addstr(" is interested in learning more.");
      break;
   case 3:
      addstr(" feels something needs to be done.");
      break;
   default:
      if(r.eagerness()>=4)
         addstr(" is ready to fight for the Liberal Cause.");
      else
      {
         addstr(" kind of regrets agreeing to this.");
      }
      break;
   }
   move(11,0);
   addstr("How should ");
   addstr(pool[p]->name);
   addstr(" approach the situation?");

   move(13,0);
   if(ledger.get_funds()<50)set_color(COLOR_BLACK,COLOR_BLACK,1);
   addstr("A - Spend $50 on props and a book for them to keep afterward.");
   set_color(COLOR_WHITE,COLOR_BLACK,0);
   move(14,0);
   addstr("B - Just casually chat with them and discuss politics.");
   
   move(15,0);
   if(subordinatesleft(*pool[p]) && r.eagerness()>=4)
   {
      addstr("C - Offer to let ");
      addstr(r.recruit->name);
      addstr(" to join the LCS as a full member.");
   }
   else if(!subordinatesleft(*pool[p]))
   {
      set_color(COLOR_BLACK,COLOR_BLACK,1);
      addstr("C - ");
      addstr(pool[p]->name);
      addstr(" needs more Juice to recruit.");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
   }
   else
   {
      set_color(COLOR_BLACK,COLOR_BLACK,1);
      addstr("C - ");
      addstr(r.recruit->name);
      addstr(" isn't ready to join the LCS.");
      set_color(COLOR_WHITE,COLOR_BLACK,0);
   }

   move(16,0);
   addstr("D - Break off the meetings.");

   int y=18;
   

   do
   {
      refresh();
      int c=getch();
      translategetch(c);

      if(c=='c' && subordinatesleft(*pool[p]) && r.eagerness()>=4)
      {
         move(y,0);
         addstr(pool[p]->name, gamelog);
         addstr(" offers to let ", gamelog);
         addstr(r.recruit->name, gamelog);
         addstr(" join the Liberal Crime Squad.", gamelog);
         gamelog.newline();

         refresh();
         getch();

         set_color(COLOR_GREEN,COLOR_BLACK,1);
         move(y+=2,0);
            
         addstr(r.recruit->name, gamelog);
         addstr(" accepts, and is eager to get started.", gamelog);
         gamelog.nextMessage();

         liberalize(*r.recruit,false);

         refresh();
         getch();

         erase();
         sleeperize_prompt(*r.recruit,*pool[p],6);

         r.recruit->hireid=pool[p]->id;

         pool[p]->train(SKILL_PERSUASION,25);

         pool.push_back(r.recruit);
         r.recruit = NULL;
         stat_recruits++;

         return 1;
      }
      if(c=='b' || (c=='a' && ledger.get_funds()>=50))
      {
         if(c=='a')
         {
            ledger.subtract_funds(50,EXPENSE_RECRUITMENT);
         }

         pool[p]->train(SKILL_PERSUASION,
            max(12-pool[p]->get_skill(SKILL_PERSUASION),5));
         pool[p]->train(SKILL_SCIENCE,
            max(r.recruit->get_skill(SKILL_SCIENCE)-pool[p]->get_skill(SKILL_SCIENCE),0));
         pool[p]->train(SKILL_RELIGION,
            max(r.recruit->get_skill(SKILL_RELIGION)-pool[p]->get_skill(SKILL_RELIGION),0));
         pool[p]->train(SKILL_LAW,
            max(r.recruit->get_skill(SKILL_LAW)-pool[p]->get_skill(SKILL_LAW),0));
         pool[p]->train(SKILL_BUSINESS,
            max(r.recruit->get_skill(SKILL_BUSINESS)-pool[p]->get_skill(SKILL_BUSINESS),0));
         
         int lib_persuasiveness = pool[p]->get_skill(SKILL_BUSINESS)+
                                  pool[p]->get_skill(SKILL_SCIENCE)+
                                  pool[p]->get_skill(SKILL_RELIGION)+
                                  pool[p]->get_skill(SKILL_LAW)+
                                  pool[p]->get_attribute(ATTRIBUTE_INTELLIGENCE,true);

         int recruit_reluctance = 5 +
                                  r.recruit->get_skill(SKILL_BUSINESS)+
                                  r.recruit->get_skill(SKILL_SCIENCE)+
                                  r.recruit->get_skill(SKILL_RELIGION)+
                                  r.recruit->get_skill(SKILL_LAW)+
                                  r.recruit->get_attribute(ATTRIBUTE_WISDOM,true)+
                                  r.recruit->get_attribute(ATTRIBUTE_INTELLIGENCE,true);

         if(lib_persuasiveness > recruit_reluctance)
            recruit_reluctance = 0;
         else
            recruit_reluctance -= lib_persuasiveness;

         int difficulty = recruit_reluctance;

         if(c=='a')
         {
            difficulty -= 5;

            move(y++,0);
            addstr(pool[p]->name, gamelog);
            addstr(" shares ", gamelog);
            strcpy(str,"");
            getissueeventstring(str);
            addstr(str), gamelog;
            addstr(".", gamelog);
            gamelog.newline();
            
            refresh();
            getch();
         }
         else
         {
            move(y++,0);
            addstr(pool[p]->name, gamelog);
            addstr(" explains ", gamelog);
            if(pool[p]->gender_liberal==GENDER_MALE)
               addstr("his ", gamelog);
            else if(pool[p]->gender_liberal==GENDER_FEMALE)
               addstr("her ", gamelog);
            else
               addstr("their ", gamelog);
            addstr("views on ", gamelog);
            getviewsmall(str,LCSrandom(VIEWNUM-3));
            addstr(str, gamelog);
            addstr(".", gamelog);
            gamelog.newline();
            refresh();
            getch();
         }
         
         bool success=0;

         if(pool[p]->skill_check(SKILL_PERSUASION,difficulty))
         {
            success=1;
            set_color(COLOR_CYAN,COLOR_BLACK,1);
            if(r.level<127) r.level++;
            if(r.eagerness1<127) r.eagerness1++;
            move(y++,0);
            addstr(r.recruit->name, gamelog);
            addstr(" found ", gamelog);
            addstr(pool[p]->name, gamelog);
            addstr("'s views to be insightful.", gamelog);
            gamelog.newline();
            move(y++,0);
            addstr("They'll definitely meet again tomorrow.", gamelog);
            gamelog.nextMessage();
         }
         else if(pool[p]->skill_check(SKILL_PERSUASION,difficulty)) // Second chance to not fail horribly
         {
            if(r.level<127) r.level++;
            if(r.eagerness1>-128) r.eagerness1--;
            move(y++,0);
            addstr(r.recruit->name, gamelog);
            addstr(" is skeptical about some of ", gamelog);
            addstr(pool[p]->name, gamelog);
            addstr("'s arguments.", gamelog);
            gamelog.newline();
            move(y++,0);
            addstr("They'll meet again tomorrow.", gamelog);
            gamelog.nextMessage();
         }
         else
         {
            set_color(COLOR_MAGENTA,COLOR_BLACK,1);
            move(y++,0);
            if(r.recruit->talkreceptive() && r.recruit->align==ALIGN_LIBERAL)
            {
               addstr(r.recruit->name, gamelog);
               addstr(" isn't convinced ", gamelog);
               addstr(pool[p]->name, gamelog);
               addstr(" really understands the problem.", gamelog);
               gamelog.newline();
               move(y++,0);
               addstr("Maybe ", gamelog);
               addstr(pool[p]->name, gamelog);
               addstr(" needs more experience.", gamelog);
               gamelog.nextMessage();
            }
            else
            {
               addstr(pool[p]->name, gamelog);
               addstr(" comes off as slightly insane.", gamelog);
               gamelog.newline();
               move(y++,0);
               addstr("This whole thing was a mistake. There won't be another meeting.", gamelog);
               gamelog.nextMessage();
            }
            refresh();
            getch();
            return 1;
         }
         refresh();
         getch();
         return 0;
      }
      if(c=='d')
      {
         return 1;
      }
   }while(1);
}
/* party info at top of screen */
void printparty(void)
{
   Creature *party[6]={NULL,NULL,NULL,NULL,NULL,NULL};
   if(activesquad!=NULL)
   {
      for(int p=0;p<6;p++)party[p]=activesquad->squad[p];
   }

   set_color(COLOR_WHITE,COLOR_BLACK,0);

   for(int i=2;i<8;i++)
   {
      move(i,0);
      addstr("                                                                                ");
   }

   if(party_status!=-1&&party[party_status]==NULL)party_status=-1;

   if(party_status!=-1)
   {
      printcreatureinfo(party[party_status]);

      char num[20];
      set_color(COLOR_WHITE,COLOR_BLACK,1);
      itoa(party_status+1,num,10);
      move(1,0);
      addstr(num);
   }
   else
   {
      char str[200];
      char num[20];

      move(1,0);
      addstr("#-CODE NAME------------SKILL---WEAPON---------ARMOR----------HEALTH---TRANSPORT-");

      for(int p=0;p<6;p++)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(p+2,0);
         addstr("                                                                                          ");
         move(p+2,0);
         addch('1'+p);

         if(party[p]!=NULL)
         {
            if(party[p]->prisoner!=NULL)set_color(COLOR_MAGENTA,COLOR_BLACK,1);
            else set_color(COLOR_WHITE,COLOR_BLACK,0);
            move(p+2,2);
            addstr(party[p]->name);
            if(party[p]->prisoner!=NULL)addstr("+H");

            int skill=0;
            char bright=0;
            for(int sk=0;sk<SKILLNUM;sk++)
            {
               skill+=(int)party[p]->get_skill(sk);
               if(party[p]->get_skill_ip(sk)>=100+(10*party[p]->get_skill(sk))&&
                  party[p]->get_skill(sk)<party[p]->skill_cap(sk,true))bright=1;
            }

            set_color(COLOR_WHITE,COLOR_BLACK,bright);
            move(p+2,23);
            itoa(skill,num,10);
            addstr(num);
            addstr("/");
            int wsk = SKILL_HANDTOHAND;
            if(party[p]->get_weapon().has_musical_attack())
               wsk=SKILL_MUSIC;
            else if (party[p]->has_thrown_weapon && !party[p]->extra_throwing_weapons.empty())
               wsk=party[p]->extra_throwing_weapons[0]->get_attack(false,false,false)->skill;
            else
               wsk=party[p]->get_weapon().get_attack(false,false,false)->skill;
            itoa(party[p]->get_skill(wsk),num,10);
            addstr(num);

            move(p+2,31);
            if(mode!=GAMEMODE_SITE)set_color(COLOR_WHITE,COLOR_BLACK,0);
            else
               switch(weaponcheck(*party[p]))
            {
               case -1:
               case 0:set_color(COLOR_GREEN,COLOR_BLACK,1);break;
               case 1:set_color(COLOR_YELLOW,COLOR_BLACK,1);break;
               case 2:set_color(COLOR_RED,COLOR_BLACK,1);break;
            }
            if(party[p]->has_thrown_weapon && !party[p]->extra_throwing_weapons.empty())
               addstr(party[p]->extra_throwing_weapons[0]->get_shortname(0).c_str());
            else
               addstr(party[p]->get_weapon().get_shortname(0).c_str());
            //set_color(COLOR_WHITE,COLOR_BLACK,0);
            if(party[p]->get_weapon().get_ammoamount()>0)
            {
               //set_color(COLOR_WHITE,COLOR_BLACK,0);
               char num[20];
               itoa(party[p]->get_weapon().get_ammoamount(),num,10);
               addstr(" (");
               addstr(num);
               addstr(")");
            }
            else if(party[p]->get_weapon().uses_ammo())
            {
               set_color(COLOR_BLACK,COLOR_BLACK,1);
               if(!party[p]->clips.empty())
               {
                  char num[20];
                  itoa(party[p]->count_clips(),num,10);
                  addstr(" (");
                  addstr(num);
                  addstr(")");
               }
               else
               {
                  addstr(" (XX)");
               }
            }
            else if(party[p]->get_weapon().is_throwable() && !party[p]->has_thrown_weapon)
            {
               addstr(" (1)");
            }
            else if(party[p]->has_thrown_weapon && !party[p]->extra_throwing_weapons.empty())
            {
               set_color(COLOR_BLACK,COLOR_BLACK,1);
               int no_weapons = party[p]->count_weapons() - party[p]->is_armed();
               char num[20];
               itoa(no_weapons,num,10);
               addstr(" (");
               addstr(num);
               addstr(")");
            }

            if(mode!=GAMEMODE_SITE)set_color(COLOR_WHITE,COLOR_BLACK,0);
            else
            {
               switch(hasdisguise(*party[p]))
               {
               case 1:set_color(COLOR_GREEN,COLOR_BLACK,1);break;
               case 2:set_color(COLOR_YELLOW,COLOR_BLACK,1);break;
               default:
                  if(party[p]->get_armor().get_stealth_value() > 1)
                     set_color(COLOR_BLACK,COLOR_BLACK,1);
                  else
                     set_color(COLOR_RED,COLOR_BLACK,1);
                  break;
               }
               if(sitealarmtimer>=0 || sitealarm==1)
                  if(party[p]->get_armor().get_stealth_value() > 1)
                     set_color(COLOR_BLACK,COLOR_BLACK,1);
            }
            move(p+2,46);
            addstr(party[p]->get_armor().get_shortname().c_str());

            printhealthstat(*party[p],p+2,61,TRUE);

            set_color(COLOR_WHITE,COLOR_BLACK,0);
            move(p+2,70);

            long v=-1;
            if(showcarprefs==1)v=id_getcar(party[p]->pref_carid);
            else v=id_getcar(party[p]->carid);
            if(v!=-1&&showcarprefs!=-1)
            {
               strcpy(str,vehicle[v]->shortname().c_str());
               char d;
               if(showcarprefs==1)d=party[p]->pref_is_driver;
               else d=party[p]->is_driver;
               if(d)strcat(str,"-D");
            }
            else
            {
               int legok=2;
               if((party[p]->wound[BODYPART_LEG_RIGHT] & WOUND_NASTYOFF)||
                  (party[p]->wound[BODYPART_LEG_RIGHT] & WOUND_CLEANOFF))legok--;
               if((party[p]->wound[BODYPART_LEG_LEFT] & WOUND_NASTYOFF)||
                  (party[p]->wound[BODYPART_LEG_LEFT] & WOUND_CLEANOFF))legok--;
               if(party[p]->flag & CREATUREFLAG_WHEELCHAIR)strcpy(str,"Wheelchair");
               else if(legok>=1)strcpy(str,"On Foot");
               else strcpy(str,"On \"Foot\"");
            }
            addstr(str);
         }
      }
   }

   makedelimiter(8,0);
}
/* base - activate sleepers */
void activate_sleepers(void)
{
    vector<Creature *> temppool;
    // Comb the pool of Liberals for sleeper agents
    for(int p=0; p<pool.size(); p++)
    {
        // Select only sleepers that can work
        if(pool[p]->alive==true&&
                pool[p]->flag & CREATUREFLAG_SLEEPER&&
                pool[p]->align==ALIGN_LIBERAL&&
                pool[p]->hiding==false&&
                pool[p]->clinic==false&&
                pool[p]->dating==false)
        {
            temppool.push_back(pool[p]);
        }
    }

    if(temppool.size()==0)return;

    sortliberals(temppool,activesortingchoice[SORTINGCHOICE_ACTIVATESLEEPERS]);

    int page=0;

    char str[80];

    do
    {
        erase();

        set_color(COLOR_WHITE,COLOR_BLACK,0);
        printfunds(0,1,"Money: ");


        move(0,0);
        addstr("Activate Sleeper Agents");
        makedelimiter(1,0);
        move(1,4);
        addstr("CODE NAME");
        move(1,25);
        addstr("JOB");
        move(1,42);
        addstr("SITE");
        move(1,57);
        addstr("ACTIVITY");

        int y=2;
        for(int p=page*9; p<temppool.size()&&p<page*9+9; p++)
        {
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            move(y,0);
            addch((y-2)/2+'A');
            addstr(" - ");
            addstr(temppool[p]->name);

            move(y,25);
            getrecruitcreature(str,temppool[p]->type);
            addstr(str);

            move(y+1,6);
            addstr("Effectiveness: ");

            if(temppool[p]->infiltration > 0.8f)
            {
                set_color(COLOR_RED,COLOR_BLACK,1);
            }
            else if(temppool[p]->infiltration > 0.6f)
            {
                set_color(COLOR_MAGENTA,COLOR_BLACK,1);
            }
            else if(temppool[p]->infiltration > 0.4f)
            {
                set_color(COLOR_YELLOW,COLOR_BLACK,1);
            }
            else if(temppool[p]->infiltration > 0.2f)
            {
                set_color(COLOR_WHITE,COLOR_BLACK,1);
            }
            else if(temppool[p]->infiltration > 0.1f)
            {
                set_color(COLOR_WHITE,COLOR_BLACK,0);
            }
            else
            {
                set_color(COLOR_GREEN,COLOR_BLACK,0);
            }
            char num[10];
            itoa(static_cast<int>(temppool[p]->infiltration*100),num,10);
            addstr(num);
            addstr("%");

            move(y,42);
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            addshortname(location[temppool[p]->worklocation]);

            move(y,57);
            // Let's add some color here...
            set_activity_color(temppool[p]->activity.type);
            getactivity(str,temppool[p]->activity);
            addstr(str);

            y+=2;
        }

        set_color(COLOR_WHITE,COLOR_BLACK,0);
        move(22,0);
        addstr("Press a Letter to Assign an Activity.");
        move(23,0);
        addpagestr();
        addstr(" T to sort people.");

        set_color(COLOR_WHITE,COLOR_BLACK,0);

        refresh();

        int c=getch();
        translategetch(c);

        //PAGE UP
        if((c==interface_pgup||c==KEY_UP||c==KEY_LEFT)&&page>0)page--;
        //PAGE DOWN
        if((c==interface_pgdn||c==KEY_DOWN||c==KEY_RIGHT)&&(page+1)*9<temppool.size())page++;

        if(c>='a'&&c<='s')
        {
            int p=page*9+(int)(c-'a');
            if(p<temppool.size())
            {
                activate_sleeper(temppool[p]);
            }
        }

        if(c=='t')
        {
            sorting_prompt(SORTINGCHOICE_ACTIVATESLEEPERS);
            sortliberals(temppool,activesortingchoice[SORTINGCHOICE_ACTIVATESLEEPERS],true);
        }

        if(c==10)break;
    } while(1);
}
void activate_sleeper(Creature *cr)
{
    int state=0;
    int choice=0;
    char havedead=0;

    do
    {
        erase();

        set_color(COLOR_WHITE,COLOR_BLACK,0);
        printfunds(0,1,"Money: ");

        move(0,0);
        addstr("Taking Undercover Action:   What will ");
        addstr(cr->name);
        addstr(" focus on?");

        printcreatureinfo(cr);

        makedelimiter(8,0);

        set_color(COLOR_WHITE,COLOR_BLACK,state=='a');
        move(10,1);
        addstr("A - Communication and Advocacy");

        set_color(COLOR_WHITE,COLOR_BLACK,state=='b');
        move(11,1);
        addstr("B - Espionage");

        set_color(COLOR_WHITE,COLOR_BLACK,state=='d');
        move(12,1);
        addstr("C - Join the Active LCS");

        set_color(COLOR_WHITE,COLOR_BLACK,0);
        move(20,40);
        addstr("Enter - Confirm Selection");

        switch(state)
        {
        case 'a':
            set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_NONE);
            move(10,40);
            addstr("1 - Lay Low");

            set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_LIBERAL);
            move(11,40);
            addstr("2 - Advocate Liberalism");

            move(12,40);
            if(subordinatesleft(*cr))
            {
                set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_RECRUIT);
                addstr("3 - Expand Sleeper Network");
            }
            else
            {
                set_color(COLOR_BLACK,COLOR_BLACK,1);
                if(cr->flag & CREATUREFLAG_BRAINWASHED)
                    addstr("3 - [Enlightened Can't Recruit]");
                else
                    addstr("3 - [Need More Juice to Recruit]");
            }
            break;
        case 'b':
            set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_SPY);
            move(10,40);
            addstr("1 - Uncover Secrets");

            set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_EMBEZZLE);
            move(11,40);
            addstr("2 - Embezzle Funds");

            set_color(COLOR_WHITE,COLOR_BLACK,cr->activity.type==ACTIVITY_SLEEPER_STEAL);
            move(12,40);
            addstr("3 - Steal Equipment");
            break;
        }

        set_color(COLOR_WHITE,COLOR_BLACK,0);
        switch(cr->activity.type)
        {
        case ACTIVITY_NONE:
            move(22,3);
            addstr(cr->name);
            addstr(" will stay out of trouble.");
            break;
        case ACTIVITY_SLEEPER_LIBERAL:
            move(22,3);
            addstr(cr->name);
            addstr(" will build support for Liberal causes.");
            break;
        case ACTIVITY_SLEEPER_RECRUIT:
            if(subordinatesleft(*cr))
            {
                move(22,3);
                addstr(cr->name);
                addstr(" will try to recruit additional sleeper agents.");
            }
            break;
        case ACTIVITY_SLEEPER_SPY:
            move(22,3);
            addstr(cr->name);
            addstr(" will snoop around for secrets and enemy plans.");
            break;
        case ACTIVITY_SLEEPER_EMBEZZLE:
            move(22,3);
            addstr(cr->name);
            addstr(" will embezzle money for the LCS.");
            break;
        case ACTIVITY_SLEEPER_STEAL:
            move(22,3);
            addstr(cr->name);
            addstr(" will steal equipment and send it to the Shelter.");
            break;
        }

        refresh();
        int c=getch();
        translategetch(c);



        if(c>='a'&&c<='z') {
            state=c;
        }
        if((c>='a'&&c<='z') || (c>='1'&&c<='9'))
        {
            choice=c;
            switch(state)
            {
            case 'a':
                switch(choice)
                {
                default:
                case '1':
                    cr->activity.type=ACTIVITY_NONE;
                    break;
                case '2':
                    cr->activity.type=ACTIVITY_SLEEPER_LIBERAL;
                    break;
                case '3':
                    if(subordinatesleft(*cr))
                        cr->activity.type=ACTIVITY_SLEEPER_RECRUIT;
                    break;
                }
                break;
            case 'b':
                switch(choice)
                {
                default:
                case '1':
                    cr->activity.type=ACTIVITY_SLEEPER_SPY;
                    break;
                case '2':
                    cr->activity.type=ACTIVITY_SLEEPER_EMBEZZLE;
                    break;
                case '3':
                    cr->activity.type=ACTIVITY_SLEEPER_STEAL;
                    break;
                }
                break;
            }
        }

        if(state=='c')
        {
            activityst oact=cr->activity;
            cr->activity.type=ACTIVITY_SLEEPER_JOINLCS;
        }
        if(c=='x')
        {
            cr->activity.type=ACTIVITY_NONE;
            break;
        }
        if(c==10)
        {
            break;
        }
    } while(1);
}
Beispiel #9
0
void mode_base(void)
{
   short buyer=0;

   char forcewait,canseethings;
   long nonsighttime=0;
   int oldforcemonth=month;
   
   int length=0;

   int l = 0;

   do
   {
      forcewait=1;
      canseethings=0;
      cantseereason=3;
      if(!disbanding)
      {
         for(int p=0;p<pool.size();p++)
         {
            if(pool[p]->alive&&
               pool[p]->align==1&&
               pool[p]->dating==0&&
               pool[p]->hiding==0&&
               !(pool[p]->flag & CREATUREFLAG_SLEEPER))
            {
               if(location[pool[p]->location]->type!=SITE_GOVERNMENT_PRISON&&
                  location[pool[p]->location]->type!=SITE_GOVERNMENT_COURTHOUSE&&
                  location[pool[p]->location]->type!=SITE_GOVERNMENT_POLICESTATION)
               {
                  canseethings=1;
                  if(pool[p]->clinic==0){forcewait=0;break;}
               }
            }
            else
            {
               if(pool[p]->dating==1&&cantseereason>1)cantseereason=1;
               else if(pool[p]->hiding!=0&&cantseereason>2)cantseereason=2;
            }
         }
      }
      else
      {
         cantseereason=4;
      }

      if(disbanding&&oldforcemonth!=month)
      {
         for(int p=pool.size()-1;p>=0;p--)
         {
            int targetjuice=0;
            for(int i=0;i<(year-disbandtime)+1;i++)
            {
               targetjuice+=LCSrandom(100);
            }
            if(targetjuice>1000)
            {
               targetjuice=1000;
            }
            if(pool[p]->juice<targetjuice)
            {
               if(pool[p]->hireid!=-1 && !(pool[p]->flag & CREATUREFLAG_SLEEPER))
                  pool[p]->alive=0; // Kill for the purposes of disbanding all contacts below
            }
         }
         oldforcemonth=month;
         erase();
         move(0,0);
         char num[20];
         itoa(year,num,10);
         set_color(COLOR_WHITE,COLOR_BLACK,1);
         switch(month)
         {
            case 1:addstr("January ");break;
            case 2:addstr("February ");break;
            case 3:addstr("March ");break;
            case 4:addstr("April ");break;
            case 5:addstr("May ");break;
            case 6:addstr("June ");break;
            case 7:addstr("July ");break;
            case 8:addstr("August ");break;
            case 9:addstr("September ");break;
            case 10:addstr("October ");break;
            case 11:addstr("November ");break;
            case 12:addstr("December ");break;
         }
         addstr(num);


         int y=2;

         if(exec[EXEC_PRESIDENT]==-2)set_color(COLOR_RED,COLOR_BLACK,1);
         else if(exec[EXEC_PRESIDENT]==-1)set_color(COLOR_MAGENTA,COLOR_BLACK,1);
         else if(exec[EXEC_PRESIDENT]==0)set_color(COLOR_YELLOW,COLOR_BLACK,1);
         else if(exec[EXEC_PRESIDENT]==1)set_color(COLOR_BLUE,COLOR_BLACK,1);
         else set_color(COLOR_GREEN,COLOR_BLACK,1);
         move(1,0);
         addstr("President: ");
         addstr(execname[EXEC_PRESIDENT]);addstr(", ");
         switch(exec[EXEC_PRESIDENT])
         {
            case -2:addstr("Arch-Conservative");break;
            case -1:addstr("Conservative");break;
            case 0:addstr("moderate");break;
            case 1:addstr("Liberal");break;
            case 2:addstr("Elite Liberal");break;
         }
         if(execterm==1)addstr(", 1st Term");
         else addstr(", 2nd Term");

         int housemake[5]={0,0,0,0,0};
         for(int h=0;h<435;h++)
         {
            housemake[house[h]+2]++;
         }
         int lsum=housemake[3]+housemake[4]
            -housemake[0]-housemake[1];
         if(lsum<=-145)set_color(COLOR_RED,COLOR_BLACK,1);
         else if(lsum<0)set_color(COLOR_MAGENTA,COLOR_BLACK,1);
         else if(lsum<145)set_color(COLOR_YELLOW,COLOR_BLACK,1);
         else if(housemake[4]<290)set_color(COLOR_BLUE,COLOR_BLACK,1);
         else set_color(COLOR_GREEN,COLOR_BLACK,1);
         move(2,0);
         addstr("House: ");
         itoa(housemake[4],num,10);
         addstr(num);addstr("Lib+, ");
         itoa(housemake[3],num,10);
         addstr(num);addstr("Lib, ");
         itoa(housemake[2],num,10);
         addstr(num);addstr("Mod, ");
         itoa(housemake[1],num,10);
         addstr(num);addstr("Cons, ");
         itoa(housemake[0],num,10);
         addstr(num);addstr("Cons+");

         int senatemake[5]={0,0,0,0,0};
         for(int s=0;s<100;s++)
         {
            senatemake[senate[s]+2]++;
         }
         lsum=senatemake[3]+senatemake[4]
            -senatemake[0]-senatemake[1];
         if(lsum<=-33)set_color(COLOR_RED,COLOR_BLACK,1);
         else if(lsum<0)set_color(COLOR_MAGENTA,COLOR_BLACK,1);
         else if(lsum<33)set_color(COLOR_YELLOW,COLOR_BLACK,1);
         else if(senatemake[4]<67)set_color(COLOR_BLUE,COLOR_BLACK,1);
         else set_color(COLOR_GREEN,COLOR_BLACK,1);
         move(3,0);
         addstr("Senate: ");
         itoa(senatemake[4],num,10);
         addstr(num);addstr("Lib+, ");
         itoa(senatemake[3],num,10);
         addstr(num);addstr("Lib, ");
         itoa(senatemake[2],num,10);
         addstr(num);addstr("Mod, ");
         itoa(senatemake[1],num,10);
         addstr(num);addstr("Cons, ");
         itoa(senatemake[0],num,10);
         addstr(num);addstr("Cons+");

         int courtmake[5]={0,0,0,0,0};
         for(int s=0;s<9;s++)
         {
            courtmake[court[s]+2]++;
         }
         lsum=courtmake[3]+courtmake[4]
             -courtmake[0]-courtmake[1];
         if(courtmake[0]>=5)set_color(COLOR_RED,COLOR_BLACK,1);
         else if(courtmake[0]+courtmake[1]>=5)set_color(COLOR_MAGENTA,COLOR_BLACK,1);
         else if(courtmake[3]+courtmake[4]<5)set_color(COLOR_YELLOW,COLOR_BLACK,1);
         else if(courtmake[4]<5)set_color(COLOR_BLUE,COLOR_BLACK,1);
         else set_color(COLOR_GREEN,COLOR_BLACK,1);
         move(4,0);
         addstr("Supreme Court: ");
         itoa(courtmake[4],num,10);
         addstr(num);addstr("Lib+, ");
         itoa(courtmake[3],num,10);
         addstr(num);addstr("Lib, ");
         itoa(courtmake[2],num,10);
         addstr(num);addstr("Mod, ");
         itoa(courtmake[1],num,10);
         addstr(num);addstr("Cons, ");
         itoa(courtmake[0],num,10);
         addstr(num);addstr("Cons+");

         y=0;
         for(int l=0;l<LAWNUM;l++)
         {
            if(law[l]==ALIGN_ARCHCONSERVATIVE)set_color(COLOR_RED,COLOR_BLACK,1);
            else if(law[l]==ALIGN_CONSERVATIVE)set_color(COLOR_MAGENTA,COLOR_BLACK,1);
            else if(law[l]==ALIGN_MODERATE)set_color(COLOR_YELLOW,COLOR_BLACK,1);
            else if(law[l]==ALIGN_LIBERAL)set_color(COLOR_BLUE,COLOR_BLACK,1);
            else set_color(COLOR_GREEN,COLOR_BLACK,1);

            move(6+l/3,l%3*30);

            switch(l)
            {
               case LAW_WOMEN:
                  addstr("Women's Rights");
                  break;
               case LAW_CIVILRIGHTS:
                  addstr("Civil Rights");
                  break;
               case LAW_DRUGS:
                  addstr("Drug Law");
                  break;
               case LAW_IMMIGRATION:
                  addstr("Immigration");
                  break;
               case LAW_ELECTIONS:
                  addstr("Election Reform");
                  break;
               case LAW_MILITARY:
                  addstr("Military Spending");
                  break;
               case LAW_TORTURE:
                  addstr("Human Rights");
                  break;
               case LAW_TAX:
                  addstr("Tax Structure");
                  break;
               case LAW_ABORTION:
                  addstr("Abortion Rights");
                  break;
               case LAW_ANIMALRESEARCH:
                  addstr("Animal Rights");
                  break;
               case LAW_POLICEBEHAVIOR:
                  addstr("Police Regulation");
                  break;
               case LAW_PRIVACY:
                  addstr("Privacy Rights");
                  break;
               case LAW_DEATHPENALTY:
                  addstr("Death Penalty");
                  break;
               case LAW_NUCLEARPOWER:
                  addstr("Nuclear Power");
                  break;
               case LAW_POLLUTION:
                  addstr("Pollution");
                  break;
               case LAW_LABOR:
                  addstr("Labor Laws");
                  break;
               case LAW_GAY:
                  addstr("Gay Rights");
                  break;
               case LAW_CORPORATE:
                  addstr("Corporate Regulation");
                  break;
               case LAW_FREESPEECH:
                  addstr("Free Speech");
                  break;
               case LAW_FLAGBURNING:
                  addstr("Flag Burning");
                  break;
               case LAW_GUNCONTROL:
                  addstr("Gun Control");
                  break;
            }
         }

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(19,33);
         addstr("Public Mood");
         move(21,1);
         addstr("Conservative");
         move(21,66);
         addstr("Liberal");
         move(22,0);
         addstr("<------------------------------------------------------------------------------>");
         move(22,77*publicmood(-1)/100+1);
         addstr("|");

         move(23,0);
         addstr("R - Recreate the Liberal Crime Squad                  Any Other Key - Next Month");

         refresh();
         char c=getch();
         if(c=='r')
         {
            disbanding=0;
         }
      }

      if(!forcewait)
      {
         if(nonsighttime>=365*4)
         {
            erase();
            char str[100];
            if(nonsighttime>=365*16)
            {
               strcpy(str,"How long since you've heard these sounds...  times have changed.");
            }
            else if(nonsighttime>=365*8)
            {
               strcpy(str,"It has been a long time.  A lot must have changed...");
            }
            else
            {
               strcpy(str,"It sure has been a while.  Things might have changed a bit.");
            }
            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(12,39-((strlen(str)-1)>>1));
            addstr(str);

            refresh();
            getch();
         }

         nonsighttime=0;
      }

      int partysize=0;
      int partydead=0;
      if(activesquad!=NULL)
      {
         for(int p=0;p<6;p++)
         {
            if(activesquad->squad[p]!=NULL)partysize++;
            else
            {
               if(p==buyer)buyer=0;
               continue;
            }
            // *JDS* This bay be a hack vvv
            if(!partysize)
            {
               delete activesquad;
               activesquad=NULL;
            }

            if(!activesquad->squad[p]->alive)partydead++;
         }
      }

      int safenumber=0;
      for(l=0;l<location.size();l++)
      {
         if(location[l]->renting>=0)safenumber++;
      }

      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;

      if(!forcewait)
      {
         erase();

         if(activesquad!=NULL)selectedsiege=-1;

         locheader();
         if(selectedsiege!=-1)
         {
            printlocation(selectedsiege);

            if((location[selectedsiege]->type==SITE_INDUSTRY_WAREHOUSE||
		location[selectedsiege]->type==SITE_BUSINESS_CRACKHOUSE)&&
               !location[selectedsiege]->siege.siege)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,0);
               move(8,1);
               addstr("I - Invest in this location");
            }
         }
         else if(activesquad!=NULL)printparty();
         else makedelimiter(8,0);

         if(sieged)
         {
            move(8,1);
            if(underattack)
            {
               set_color(COLOR_RED,COLOR_BLACK,1);
               addstr("Under Attack");
            }
            else
            {
               set_color(COLOR_YELLOW,COLOR_BLACK,1);
               addstr("Under Siege");
               int stock=1;
               if(selectedsiege!=-1)stock=location[selectedsiege]->compound_stores;
               else if(activesquad!=NULL && activesquad->squad[0]->location!=-1)stock=location[activesquad->squad[0]->location]->compound_stores;
               if(!stock)addstr(" (No Food)");
            }
         }

         if(haveflag)
         {
            for(int p=0;p<7;p++)
            {
               move(p+10,32);
               if(p<3)
               {
                  set_color(COLOR_WHITE,COLOR_BLUE,1);
                  move(p+10,32);
                  addstr("::::::");
                  set_color(COLOR_WHITE,COLOR_RED,1);
                  move(p+10,38);
                  for(int i=0;i<10;i++)addch(CH_LOWER_HALF_BLOCK);
               }
               else
               {
                  if(p<6)set_color(COLOR_WHITE,COLOR_RED,1);
                  else set_color(COLOR_RED,COLOR_BLACK,0);
                  for(int i=0;i<16;i++)
                  {
                     if(p==6)addch(CH_UPPER_HALF_BLOCK);
                     else addch(CH_LOWER_HALF_BLOCK);
                  }
               }
            }
         }

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(18,10);
         addstr("--- ACTIVISM ---");
         move(18,51);
         addstr("--- PLANNING ---");

         if(partysize>0&&!underattack)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(19,40);
         addstr("E - Equip Squad");
         if(vehicle.size()>0&&partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(19,60);
         addstr("V - Vehicles");
         if(pool.size()>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(20,40);
         addstr("R - Review Assets and Form Squads");


         if(partysize>1)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(8,30);
         if(partysize>0 && !sieged)
            addstr("O - Reorder");

         if (activesquad)
         {
            move(8,1);
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            addstr(activesquad->name);
            addstr("-"); //in case of overlap, at least make it clear where the name ends.
         }
         if(squad.size()>1||(activesquad==NULL&&squad.size()>0))set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(8,43);
         addstr("TAB - Next Squad");

         if(safenumber>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(8,62);
         addstr("Z - Next Location");

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(21,40);
         addstr("L - The Status of the Liberal Agenda");

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(21,1);
         addstr("A - Activate Liberals");

         
         set_color(COLOR_BLACK,COLOR_BLACK,1);
         for(int p=0;p < pool.size();p++)
         {
            if(pool[p]->alive==true&&
               pool[p]->flag & CREATUREFLAG_SLEEPER&&
               pool[p]->align==ALIGN_LIBERAL&&
               pool[p]->hiding==false&&
               pool[p]->clinic==false&&
               pool[p]->dating==false)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,0);
               break;
            }
         }
         move(21,25);
         addstr("B - Sleepers");

         if(partysize>0)
         {
            if(activesquad->activity.type!=ACTIVITY_NONE)set_color(COLOR_WHITE,COLOR_BLACK,0);
            else set_color(COLOR_BLACK,COLOR_BLACK,1);
         }
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(20,1);
         addstr("C - Cancel this Squad's Departure");

         if(sieged)
         {
            if(partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
            else
            {
               set_color(COLOR_BLACK,COLOR_BLACK,1);
               for(int p=0;p<pool.size();p++)
               {
                  if(pool[p]->location==selectedsiege)
                  {
                     set_color(COLOR_WHITE,COLOR_BLACK,0);
                     break;
                  }
               }
            }
            move(19,1);
            addstr("F - Escape/Engage");

            set_color(COLOR_WHITE,COLOR_BLACK,0);
            move(19,23);
            addstr("G - Give Up");
         }
         else
         {
            if(partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
            else set_color(COLOR_BLACK,COLOR_BLACK,1);
            move(19,1);
            addstr("F - Go forth to stop EVIL");
         }
         //if(partysize>0&&(party_status==-1||partysize>1))set_color(COLOR_WHITE,COLOR_BLACK,0);
         //else set_color(COLOR_BLACK,COLOR_BLACK,1);
         //move(19,40);
         //addstr("# - Check the status of a squad Liberal");
         //if(party_status!=-1)set_color(COLOR_WHITE,COLOR_BLACK,0);
         //else set_color(COLOR_BLACK,COLOR_BLACK,1);
         //move(18,40);
         //addstr("0 - Show the squad's Liberal status");
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(23,40);
         addstr("X - Live to fight EVIL another day");
         move(23,1);
         if(cannotwait)
         {
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            addstr("Cannot Wait until Siege Resolved");
         }
         else
         {
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            addstr("W - Wait a day");
            if(day==monthday())addstr(" (next month)");
         }

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(22,40);
         addstr("S - FREE SPEECH: the Liberal Slogan");
         move(22,1);
         if(haveflag)
         {
            
            if(sieged)
               set_color(COLOR_GREEN,COLOR_BLACK,1);
            else
               set_color(COLOR_WHITE,COLOR_BLACK,0);

            addstr("P - PROTEST: burn the flag");
         }
         else
         {
            if(ledger.get_funds()>=20&&!sieged&&
               (selectedsiege!=-1||activesquad!=NULL))set_color(COLOR_WHITE,COLOR_BLACK,0);
            else set_color(COLOR_BLACK,COLOR_BLACK,1);
            addstr("P - PATRIOTISM: fly a flag here ($20)");
         }

         length=strlen(slogan);
         set_color(COLOR_WHITE,COLOR_BLACK,1);
         if(haveflag)move(17,40-(length>>1));
         else move(13,40-(length>>1));
void mode_base(void)
{
   short buyer=0;

   char forcewait,canseethings;
   int nonsighttime=0;
   int oldforcemonth=month;

   int length=0;

   int l = 0;

   do
   {
      forcewait=1;
      canseethings=0;
      cantseereason=CANTSEE_OTHER;
      if(!disbanding)
      {
         for(int p=0;p<(int)pool.size();p++)
         {
            if(pool[p]->alive&&
               pool[p]->align==1&&
               pool[p]->dating==0&&
               pool[p]->hiding==0&&
               !(pool[p]->flag & CREATUREFLAG_SLEEPER))
            {
               if(!location[pool[p]->location]->part_of_justice_system())
               {
                  canseethings=1;
                  if(pool[p]->clinic==0){forcewait=0;break;}
               }
            }
            else
            {
               if(pool[p]->dating==1 && cantseereason>CANTSEE_DATING) cantseereason=CANTSEE_DATING;
               else if(pool[p]->hiding!=0 && cantseereason>CANTSEE_HIDING) cantseereason=CANTSEE_HIDING;
            }
         }
      }
      else
      {
         cantseereason=CANTSEE_DISBANDING;
      }

      if(disbanding)
      {
         disbanding = show_disbanding_screen(oldforcemonth);
      }

      if(!forcewait)
      {
         if(nonsighttime>=365*4)
         {
            erase();
            char str[100];
            if(nonsighttime>=365*16) {
               strcpy(str,"How long since you've heard these sounds...  times have changed.");
            } else if(nonsighttime>=365*8) {
               strcpy(str,"It has been a long time.  A lot must have changed...");
            } else {
               strcpy(str,"It sure has been a while.  Things might have changed a bit.");
            }
            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(12,39-((strlen(str)-1)>>1));
            addstr(str, gamelog);
            gamelog.nextMessage(); //Write out buffer to prepare for the next message.

            refresh();
            getch();
         }

         nonsighttime=0;
      }

      int partysize=0;
      int partydead=0;
      if(activesquad!=NULL)
      {
         for(int p=0;p<6;p++)
         {
            if(activesquad->squad[p]!=NULL)partysize++;
            else
            {
               if(p==buyer)buyer=0;
               continue;
            }
            if(!partysize)
            {
               delete activesquad;
               activesquad=NULL;
            }

            if(!activesquad->squad[p]->alive)partydead++;
         }
      }

      int safenumber=0;
      for(l=0;l<(int)location.size();l++)if(location[l]->is_lcs_safehouse())safenumber++;

      Location *loc=NULL;
      if(selectedsiege!=-1)loc = location[selectedsiege];
      if(activesquad!=NULL && activesquad->squad[0]->location!=-1)
         loc = location[activesquad->squad[0]->location];

      siegest *siege=NULL;
      if(loc) siege= &loc->siege;

      char sieged=0;
      char underattack=0;
      if(siege!=NULL)
      {
         sieged=siege->siege;
         if(sieged)
            underattack=siege->underattack;
      }

      char haveflag=0;
      if(loc) haveflag=loc->haveflag;

      // Count people at each location
      int* num_present = new int[location.size()];
      for(int i=0;i<(int)location.size();i++)num_present[i]=0;
      for(int p=0;p<(int)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
         num_present[pool[p]->location]++;
      }

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

         if(location[l]->siege.underattack)
         {
            // Allow siege if no liberals present
            if(num_present[l])cannotwait=1;
            break;
         }
      }
      delete[] num_present;

      if(!forcewait)
      {
         erase();

         if(activesquad!=NULL)selectedsiege=-1;

         locheader();
         if(selectedsiege!=-1)
         {
            printlocation(selectedsiege);

            if(location[selectedsiege]->can_be_upgraded()&&
               !location[selectedsiege]->siege.siege)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,0);
               move(8,1);
               addstr("I - Invest in this location");
            }
         }
         else if(activesquad!=NULL)printparty();
         else makedelimiter(8,0);

         if(sieged)
         {
            move(8,1);
            if(underattack)
            {
               set_color(COLOR_RED,COLOR_BLACK,1);
               addstr("Under Attack");
            }
            else
            {
               set_color(COLOR_YELLOW,COLOR_BLACK,1);
               addstr("Under Siege");
               int stock=1;
               if(loc)stock=loc->compound_stores;
               if(!stock)addstr(" (No Food)");
            }
         }

         if(haveflag)
         {
            for(int p=0;p<7;p++)
            {
               move(p+10,32);
               if(p<3)
               {
                  set_color(COLOR_WHITE,COLOR_BLUE,1);
                  move(p+10,32);
                  addstr("::::::");
                  set_color(COLOR_WHITE,COLOR_RED,1);
                  move(p+10,38);
                  for(int i=0;i<10;i++)addch(CH_LOWER_HALF_BLOCK);
               }
               else
               {
                  if(p<6)set_color(COLOR_WHITE,COLOR_RED,1);
                  else set_color(COLOR_RED,COLOR_BLACK,0);
                  for(int i=0;i<16;i++)
                  {
                     if(p==6)addch(CH_UPPER_HALF_BLOCK);
                     else addch(CH_LOWER_HALF_BLOCK);
                  }
               }
            }
         }

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(18,10);
         addstr("--- ACTIVISM ---");
         move(18,51);
         addstr("--- PLANNING ---");

         if(partysize>0&&!underattack)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(19,40);
         addstr("E - Equip Squad");
         if(vehicle.size()>0&&partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(19,60);
         addstr("V - Vehicles");
         if(pool.size()>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(20,40);
         addstr("R - Review Assets and Form Squads");


         if(partysize>1)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(8,30);
         if(partysize>0 && !sieged)
            addstr("O - Reorder");

         if (activesquad)
         {
            move(8,1);
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            addstr(activesquad->name);
            addstr("-"); //in case of overlap, at least make it clear where the name ends.
         }
         if(squad.size()>1||(activesquad==NULL&&squad.size()>0))set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(8,43);
         addstr("TAB - Next Squad");

         if(safenumber>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(8,62);
         addstr("Z - Next Location");

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(21,40);
         addstr("L - The Status of the Liberal Agenda");

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(21,1);
         addstr("A - Activate Liberals");


         set_color(COLOR_BLACK,COLOR_BLACK,1);
         for(int p=0;p < (int)pool.size();p++)
         {
            if(pool[p]->alive==true&&
               pool[p]->flag & CREATUREFLAG_SLEEPER&&
               pool[p]->align==ALIGN_LIBERAL&&
               pool[p]->hiding==false&&
               pool[p]->clinic==false&&
               pool[p]->dating==false)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,0);
               break;
            }
         }
         move(21,25);
         addstr("B - Sleepers");

         if(partysize>0)
         {
            if(activesquad->activity.type!=ACTIVITY_NONE)set_color(COLOR_WHITE,COLOR_BLACK,0);
            else set_color(COLOR_BLACK,COLOR_BLACK,1);
         }
         else set_color(COLOR_BLACK,COLOR_BLACK,1);
         move(20,1);
         addstr("C - Cancel this Squad's Departure");

         if(sieged)
         {
            if(partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
            else
            {
               set_color(COLOR_BLACK,COLOR_BLACK,1);
               for(int p=0;p<(int)pool.size();p++)
               {
                  if(pool[p]->location==selectedsiege)
                  {
                     set_color(COLOR_WHITE,COLOR_BLACK,0);
                     break;
                  }
               }
            }
            move(19,1);
            addstr("F - Escape/Engage");

            set_color(COLOR_WHITE,COLOR_BLACK,0);
            move(19,23);
            addstr("G - Give Up");
         }
         else
         {
            if(partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
            else set_color(COLOR_BLACK,COLOR_BLACK,1);
            move(19,1);
            addstr("F - Go forth to stop EVIL");
         }
         //if(partysize>0&&(party_status==-1||partysize>1))set_color(COLOR_WHITE,COLOR_BLACK,0);
         //else set_color(COLOR_BLACK,COLOR_BLACK,1);
         //move(19,40);
         //addstr("# - Check the status of a squad Liberal");
         //if(party_status!=-1)set_color(COLOR_WHITE,COLOR_BLACK,0);
         //else set_color(COLOR_BLACK,COLOR_BLACK,1);
         //move(18,40);
         //addstr("0 - Show the squad's Liberal status");
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(23,40);
         addstr("X - Live to fight EVIL another day");
         move(23,1);
         if(cannotwait)
         {
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            addstr("Cannot Wait until Siege Resolved");
         }
         else
         {
            set_color(COLOR_WHITE,COLOR_BLACK,0);
            if(sieged) addstr("W - Wait out the siege");
            else addstr("W - Wait a day");
            if(day==monthday())addstr(" (next month)");
         }

         set_color(COLOR_WHITE,COLOR_BLACK,0);
         move(22,40);
         addstr("S - FREE SPEECH: the Liberal Slogan");
         move(22,1);
         if(haveflag)
         {

            if(sieged)
               set_color(COLOR_GREEN,COLOR_BLACK,1);
            else
               set_color(COLOR_WHITE,COLOR_BLACK,0);

            addstr("P - PROTEST: burn the flag");
         }
         else
         {
            if(ledger.get_funds()>=20&&!sieged&&
               (selectedsiege!=-1||activesquad!=NULL))set_color(COLOR_WHITE,COLOR_BLACK,0);
            else set_color(COLOR_BLACK,COLOR_BLACK,1);
            addstr("P - PATRIOTISM: fly a flag here ($20)");
         }

         length=strlen(slogan);
         set_color(COLOR_WHITE,COLOR_BLACK,1);
         if(haveflag)move(17,40-(length>>1));
         else move(13,40-(length>>1));
/* monthly - LCS finances report */
void fundreport(char &clearformess)
{
   if(disbanding) return;
   music.play(MUSIC_FINANCES);

   clearformess=true;

   int page=0;
   bool showledger=false;
   std::string num;
   static const char dotdotdot[]=". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ";

   int expenselines = 0;
   for(int i=0;i<EXPENSETYPENUM;i++)
      if (ledger.expense[i])
         expenselines++;

   while(true)
   {
      erase();

      int y=2,totalmoney=0,dailymoney=0,numpages=1;

      set_color(COLOR_WHITE,COLOR_BLACK,1);
      mvaddstr(0,0,"Liberal Crime Squad: Funding Report");

      for(int i=0;i<INCOMETYPENUM;i++)
      {
         if(ledger.income[i])
         {
            showledger=true;
            if(page==numpages-1)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,0);
               mvaddstr(y,0,dotdotdot);
               set_color(COLOR_GREEN,COLOR_BLACK,0);
               num="+$"+tostring(ledger.income[i]);
               mvaddstr(y,60-len(num),num);
               if(ledger.dailyIncome[i])
                  num=" (+$"+tostring(ledger.dailyIncome[i])+")";
               else
               {
                  set_color(COLOR_WHITE,COLOR_BLACK,0);
                  num=" ($0)";
               }
               mvaddstr(y,73-len(num),num);
               set_color(COLOR_WHITE,COLOR_BLACK,0);
               switch(i)
               {
               case INCOME_BROWNIES: mvaddstr(y,0,"Brownies"); break;
               case INCOME_CARS: mvaddstr(y,0,"Car Sales"); break;
               case INCOME_CCFRAUD: mvaddstr(y,0,"Credit Card Fraud"); break;
               case INCOME_DONATIONS: mvaddstr(y,0,"Donations"); break;
               case INCOME_SKETCHES: mvaddstr(y,0,"Drawing Sales"); break;
               case INCOME_EMBEZZLEMENT: mvaddstr(y,0,"Embezzlement"); break;
               case INCOME_EXTORTION: mvaddstr(y,0,"Extortion"); break;
               case INCOME_HUSTLING: mvaddstr(y,0,"Hustling"); break;
               case INCOME_PAWN: mvaddstr(y,0,"Pawning Goods"); break;
               case INCOME_PROSTITUTION: mvaddstr(y,0,"Prostitution"); break;
               case INCOME_BUSKING: mvaddstr(y,0,"Street Music"); break;
               case INCOME_THIEVERY: mvaddstr(y,0,"Thievery"); break;
               case INCOME_TSHIRTS: mvaddstr(y,0,"T-Shirt Sales"); break;
               default: mvaddstr(y,0,"Other Income"); break;
               }
            }
            totalmoney+=ledger.income[i];
            dailymoney+=ledger.dailyIncome[i];

            if(++y>=23) y=2,numpages++;
         }
      }

      // If expenses are too long to fit on this page, start them on the next page so it isn't broken in half unnecessarily
      if(y+expenselines>=23 && y>2) y=2,numpages++;

      for(int i=0;i<EXPENSETYPENUM;i++)
      {
         if(ledger.expense[i])
         {
            showledger=true;
            if(page==numpages-1)
            {
               set_color(COLOR_WHITE,COLOR_BLACK,0);
               mvaddstr(y,0,dotdotdot);
               set_color(COLOR_RED,COLOR_BLACK,0);
               num="-$"+tostring(ledger.expense[i]);
               mvaddstr(y,60-len(num),num);
               if(ledger.dailyExpense[i])
                  num=" (-$"+tostring(ledger.dailyExpense[i])+")";
               else
               {
                  set_color(COLOR_WHITE,COLOR_BLACK,0);
                  num=" ($0)";
               }
               mvaddstr(y,73-len(num),num);
               set_color(COLOR_WHITE,COLOR_BLACK,0);
               switch(i)
               {
               case EXPENSE_TROUBLEMAKING: mvaddstr(y,0,"Activism"); break;
               case EXPENSE_CONFISCATED: mvaddstr(y,0,"Confiscated"); break;
               case EXPENSE_DATING: mvaddstr(y,0,"Dating"); break;
               case EXPENSE_SKETCHES: mvaddstr(y,0,"Drawing Materials"); break;
               case EXPENSE_FOOD: mvaddstr(y,0,"Groceries"); break;
               case EXPENSE_HOSTAGE: mvaddstr(y,0,"Hostage Tending"); break;
               case EXPENSE_LEGAL: mvaddstr(y,0,"Legal Fees"); break;
               case EXPENSE_MANUFACTURE: mvaddstr(y,0,"Manufacturing"); break;
               case EXPENSE_CARS: mvaddstr(y,0,"New Cars"); break;
               case EXPENSE_SHOPPING: mvaddstr(y,0,"Purchasing Goods"); break;
               case EXPENSE_RECRUITMENT: mvaddstr(y,0,"Recruitment"); break;
               case EXPENSE_RENT: mvaddstr(y,0,"Rent"); break;
               case EXPENSE_COMPOUND: mvaddstr(y,0,"Safehouse Investments"); break;
               case EXPENSE_TRAINING: mvaddstr(y,0,"Training"); break;
               case EXPENSE_TRAVEL: mvaddstr(y,0,"Travel"); break;
               case EXPENSE_TSHIRTS: mvaddstr(y,0,"T-Shirt Materials"); break;
               default: mvaddstr(y,0,"Other Expenses"); break;
               }
            }
            totalmoney-=ledger.expense[i];
            dailymoney-=ledger.dailyExpense[i];

            if(++y>=23) y=2,numpages++;
         }
      }

      if(showledger)
      {
         if(page==numpages-1) makedelimiter(y);

         if(++y>=23) y=2,numpages++;

         if(page==numpages-1)
         {
            set_color(COLOR_WHITE,COLOR_BLACK,1);
            mvaddstr(y,0,"Net Change This Month (Day):");
            if(totalmoney>0) { set_color(COLOR_GREEN,COLOR_BLACK,1); num="+"; }
            else if(totalmoney<0) { set_color(COLOR_RED,COLOR_BLACK,1); num="-"; }
            else { set_color(COLOR_WHITE,COLOR_BLACK,1); num=""; }
            num+="$"+tostring(abs(totalmoney));
            mvaddstr(y,60-len(num),num);
            if(dailymoney>0)
            {
               set_color(COLOR_GREEN,COLOR_BLACK,1);
               num=" (+$"+tostring(abs(dailymoney))+")";
            }
            else if(dailymoney<0)
            {
               set_color(COLOR_RED,COLOR_BLACK,1);
               num=" (-$"+tostring(abs(dailymoney))+")";
            }
            else
            {
               set_color(COLOR_WHITE,COLOR_BLACK,1);
               num=" ($0)";
            }
            mvaddstr(y,73-len(num),num);
         }

         if(++y>=23) y=2,numpages++;
      }

      if (y>2) y++; // Blank line between income/expenses and assets if not starting a new page
      if (y+7>=23) y=2, numpages++; //Start a new page if the liquid assets won't fit on the rest of the current page.
      // tally up liquid assets
      long weaponValue=0,armorValue=0,clipValue=0,lootValue=0;
      for(int j=0;j<len(location);j++)
         for(int i=0;i<len(location[j]->loot);i++)
         {
            Item* item=location[j]->loot[i];
            if(item->is_weapon()) weaponValue+=item->get_fencevalue()*item->get_number();
            if(item->is_armor()) armorValue+=item->get_fencevalue()*item->get_number();
            if(item->is_clip()) clipValue+=item->get_fencevalue()*item->get_number();
            if(item->is_loot()) lootValue+=item->get_fencevalue()*item->get_number();
         }

      if(page==numpages-1)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         mvaddstr(y,0,dotdotdot);
         mvaddstr(y,0,"Cash");
         set_color(ledger.get_funds()?COLOR_GREEN:COLOR_WHITE,COLOR_BLACK,0);
         num="$"+tostring(ledger.get_funds());
         mvaddstr(y,60-len(num),num);
      }

      if(++y>=23) y=2,numpages++;

      if(page==numpages-1)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         mvaddstr(y,0,dotdotdot);
         mvaddstr(y,0,"Tools and Weapons");
         set_color(weaponValue?COLOR_GREEN:COLOR_WHITE,COLOR_BLACK,0);
         num="$"+tostring(weaponValue);
         mvaddstr(y,60-len(num),num);
      }

      if(++y>=23) y=2,numpages++;

      if(page==numpages-1)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         mvaddstr(y,0,dotdotdot);
         mvaddstr(y,0,"Clothing and Armor");
         set_color(armorValue?COLOR_GREEN:COLOR_WHITE,COLOR_BLACK,0);
         num="$"+tostring(armorValue);
         mvaddstr(y,60-len(num),num);
      }

      if(++y>=23) y=2,numpages++;

      if(page==numpages-1)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         mvaddstr(y,0,dotdotdot);
         mvaddstr(y,0,"Ammunition");
         set_color(clipValue?COLOR_GREEN:COLOR_WHITE,COLOR_BLACK,0);
         num="$"+tostring(clipValue);
         mvaddstr(y,60-len(num),num);
      }

      if(++y>=23) y=2,numpages++;

      if(page==numpages-1)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         mvaddstr(y,0,dotdotdot);
         mvaddstr(y,0,"Miscellaneous Loot");
         set_color(lootValue?COLOR_GREEN:COLOR_WHITE,COLOR_BLACK,0);
         num="$"+tostring(lootValue);
         mvaddstr(y,60-len(num),num);
      }

      if(++y>=23) y=2,numpages++;

      if(page==numpages-1) makedelimiter(y);

      if(++y>=23) y=2,numpages++;

      if(page==numpages-1)
      {
         set_color(COLOR_WHITE,COLOR_BLACK,1);
         mvaddstr(y,0,"Total Liquid Assets:");
         long netWorth=ledger.get_funds()+weaponValue+armorValue+clipValue+lootValue;
         set_color(netWorth?COLOR_GREEN:COLOR_WHITE,COLOR_BLACK,1);
         num="$"+tostring(netWorth);
         mvaddstr(y,60-len(num),num);
      }

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      if(numpages>1)
      {
         mvaddstr(24,0,"Press Enter to reflect on the report.  ");
         addpagestr();

         while(true)
         {
            int c=getkey();

            if(c=='x'||c==ENTER||c==ESC||c==SPACEBAR)
            {
               music.play(MUSIC_PREVIOUS);
               return;
            }

            //PAGE UP
            if(c==interface_pgup||c==KEY_UP||c==KEY_LEFT) { page--; if(page<0) page=numpages-1; break; }
            //PAGE DOWN
            if(c==interface_pgdn||c==KEY_DOWN||c==KEY_RIGHT) { page++; if(page>=numpages) page=0; break; }
         }
      }
      else
      {
         mvaddstr(24,0,"Press any key to reflect on the report.");

         getkey();

         music.play(MUSIC_PREVIOUS);
         return;
      }
   }
}