Advertisement
Guest User

basemode.cpp - SVN-739 - modified

a guest
Nov 23rd, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 23.16 KB | None | 0 0
  1. /*
  2.  
  3. Copyright (c) 2002,2003,2004 by Tarn Adams                                            //
  4.                                                                                       //
  5. This file is part of Liberal Crime Squad.                                             //
  6.                                                                                     //
  7.     Liberal Crime Squad is free software; you can redistribute it and/or modify     //
  8.     it under the terms of the GNU General Public License as published by            //
  9.     the Free Software Foundation; either version 2 of the License, or               //
  10.     (at your option) any later version.                                             //
  11.                                                                                     //
  12.     Liberal Crime Squad is distributed in the hope that it will be useful,          //
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of                  //
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the                  //
  15.     GNU General Public License for more details.                                    //
  16.                                                                                     //
  17.     You should have received a copy of the GNU General Public License               //
  18.     along with Liberal Crime Squad; if not, write to the Free Software              //
  19.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307   USA     //
  20. */
  21.  
  22. /*
  23.         This file was created by Chris Johnson (grundee@users.sourceforge.net)
  24.         by copying code from game.cpp.
  25.         To see descriptions of files and functions, see the list at
  26.         the bottom of includes.h in the top src folder.
  27. */
  28.  
  29. //#include <includes.h>
  30. #include <externs.h>
  31.  
  32.  
  33.  
  34. bool show_disbanding_screen(int& oldforcemonth)
  35. {
  36.    if(oldforcemonth == month) return true;
  37.  
  38.    for(int p=pool.size()-1;p>=0;p--)
  39.    {
  40.       int targetjuice=0;
  41.       for(int i=0;i<(year-disbandtime)+1;i++)
  42.       {
  43.          targetjuice+=LCSrandom(100);
  44.       }
  45.       if(targetjuice>1000)
  46.       {
  47.          targetjuice=1000;
  48.       }
  49.       if(pool[p]->juice<targetjuice)
  50.       {
  51.          if(pool[p]->hireid!=-1 && !(pool[p]->flag & CREATUREFLAG_SLEEPER))
  52.             pool[p]->alive=0; // Kill for the purposes of disbanding all contacts below
  53.       }
  54.    }
  55.    oldforcemonth=month;
  56.    erase();
  57.    move(0,0);
  58.    char num[20];
  59.    itoa(year,num,10);
  60.    set_color(COLOR_WHITE,COLOR_BLACK,1);
  61.    addstr(getmonth(month));
  62.    addstr(" ");
  63.    addstr(num);
  64.  
  65.  
  66.    //int y=2;
  67.  
  68.    set_alignment_color(exec[EXEC_PRESIDENT], true);
  69.    mvaddstr(1,0,"President: ");
  70.    addstr(execname[EXEC_PRESIDENT]);addstr(", ");
  71.    switch(exec[EXEC_PRESIDENT])
  72.    {
  73.       case -2:addstr("Arch-Conservative");break;
  74.       case -1:addstr("Conservative");break;
  75.       case 0:addstr("moderate");break;
  76.       case 1:addstr("Liberal");break;
  77.       case 2:addstr("Elite Liberal");break;
  78.    }
  79.    if(execterm==1)addstr(", 1st Term");
  80.    else addstr(", 2nd Term");
  81.  
  82.    int housemake[5]={0,0,0,0,0};
  83.    for(int h=0;h<435;h++)
  84.       housemake[house[h]+2]++;
  85.    int lsum=housemake[3]+housemake[4]-housemake[0]-housemake[1];
  86.    if(lsum<=-145)set_color(COLOR_RED,COLOR_BLACK,1);
  87.    else if(lsum<0)set_color(COLOR_MAGENTA,COLOR_BLACK,1);
  88.    else if(lsum<145)set_color(COLOR_YELLOW,COLOR_BLACK,1);
  89.    else if(housemake[4]<290)set_color(COLOR_CYAN,COLOR_BLACK,1);
  90.    else set_color(COLOR_GREEN,COLOR_BLACK,1);
  91.    move(2,0);
  92.    addstr("House: ");
  93.    itoa(housemake[4],num,10);
  94.    addstr(num);addstr("Lib+, ");
  95.    itoa(housemake[3],num,10);
  96.    addstr(num);addstr("Lib, ");
  97.    itoa(housemake[2],num,10);
  98.    addstr(num);addstr("Mod, ");
  99.    itoa(housemake[1],num,10);
  100.    addstr(num);addstr("Cons, ");
  101.    itoa(housemake[0],num,10);
  102.    addstr(num);addstr("Cons+");
  103.  
  104.    int senatemake[5]={0,0,0,0,0};
  105.    for(int s=0;s<100;s++)
  106.       senatemake[senate[s]+2]++;
  107.    lsum=senatemake[3]+senatemake[4]-senatemake[0]-senatemake[1];
  108.    if(lsum<=-33)set_color(COLOR_RED,COLOR_BLACK,1);
  109.    else if(lsum<0)set_color(COLOR_MAGENTA,COLOR_BLACK,1);
  110.    else if(lsum<33)set_color(COLOR_YELLOW,COLOR_BLACK,1);
  111.    else if(senatemake[4]<67)set_color(COLOR_CYAN,COLOR_BLACK,1);
  112.    else set_color(COLOR_GREEN,COLOR_BLACK,1);
  113.    move(3,0);
  114.    addstr("Senate: ");
  115.    itoa(senatemake[4],num,10);
  116.    addstr(num);addstr("Lib+, ");
  117.    itoa(senatemake[3],num,10);
  118.    addstr(num);addstr("Lib, ");
  119.    itoa(senatemake[2],num,10);
  120.    addstr(num);addstr("Mod, ");
  121.    itoa(senatemake[1],num,10);
  122.    addstr(num);addstr("Cons, ");
  123.    itoa(senatemake[0],num,10);
  124.    addstr(num);addstr("Cons+");
  125.  
  126.    int courtmake[5]={0,0,0,0,0};
  127.    for(int s=0;s<9;s++)
  128.    {
  129.       courtmake[court[s]+2]++;
  130.    }
  131.    lsum=courtmake[3]+courtmake[4]
  132.          -courtmake[0]-courtmake[1];
  133.    if(courtmake[0]>=5)set_alignment_color(ALIGN_ARCHCONSERVATIVE, true);
  134.    else if(courtmake[0]+courtmake[1]>=5)set_alignment_color(ALIGN_CONSERVATIVE, true);
  135.    else if(courtmake[3]+courtmake[4]<5)set_alignment_color(ALIGN_MODERATE, true);
  136.    else if(courtmake[4]<5)set_alignment_color(ALIGN_LIBERAL, true);
  137.    else set_alignment_color(ALIGN_ELITELIBERAL, true);
  138.    mvaddstr(4,0,"Supreme Court: ");
  139.    itoa(courtmake[4],num,10);
  140.    addstr(num);addstr("Lib+, ");
  141.    itoa(courtmake[3],num,10);
  142.    addstr(num);addstr("Lib, ");
  143.    itoa(courtmake[2],num,10);
  144.    addstr(num);addstr("Mod, ");
  145.    itoa(courtmake[1],num,10);
  146.    addstr(num);addstr("Cons, ");
  147.    itoa(courtmake[0],num,10);
  148.    addstr(num);addstr("Cons+");
  149.  
  150.    //y=0;
  151.    for(int l=0;l<LAWNUM;l++)
  152.    {
  153.       set_alignment_color(law[l], true);
  154.       move(6+l/3,l%3*30);
  155.       char str[40];
  156.       getlaw(str,l);
  157.       addstr(str);
  158.    }
  159.  
  160.    set_color(COLOR_WHITE,COLOR_BLACK,0);
  161.    mvaddstr(19,33,"Public Mood");
  162.    mvaddstr(21,1,"Conservative");
  163.    mvaddstr(21,66,"Liberal");
  164.    mvaddstr(22,0,"<------------------------------------------------------------------------------>");
  165.    move(22,77*publicmood(-1)/100+1);
  166.    addstr("|");
  167.    mvaddstr(23,0,"R - Recreate the Liberal Crime Squad                  Any Other Key - Next Month");
  168.    refresh();
  169.    char c=getch();
  170.  
  171.    if(c=='r') return false;
  172.    else return true;
  173. }
  174.  
  175. enum CantSeeReason
  176. {
  177.    CANTSEE_DATING = 1,
  178.    CANTSEE_HIDING = 2,
  179.    CANTSEE_OTHER = 3,
  180.    CANTSEE_DISBANDING = 4
  181. };
  182.  
  183. void mode_base(void)
  184. {
  185.    short buyer=0;
  186.  
  187.    char forcewait,canseethings;
  188.    int nonsighttime=0;
  189.    int oldforcemonth=month;
  190.  
  191.    int length=0;
  192.  
  193.    int l = 0;
  194.  
  195.    do
  196.    {
  197.       forcewait=1;
  198.       canseethings=0;
  199.       cantseereason=CANTSEE_OTHER;
  200.       if(!disbanding)
  201.       {
  202.          for(int p=0;p<(int)pool.size();p++)
  203.          {
  204.             if(pool[p]->alive&&
  205.                pool[p]->align==1&&
  206.                pool[p]->dating==0&&
  207.                pool[p]->hiding==0&&
  208.                !(pool[p]->flag & CREATUREFLAG_SLEEPER))
  209.             {
  210.                if(!location[pool[p]->location]->part_of_justice_system())
  211.                {
  212.                   canseethings=1;
  213.                   if(pool[p]->clinic==0){forcewait=0;break;}
  214.                }
  215.             }
  216.             else
  217.             {
  218.                if(pool[p]->dating==1 && cantseereason>CANTSEE_DATING) cantseereason=CANTSEE_DATING;
  219.                else if(pool[p]->hiding!=0 && cantseereason>CANTSEE_HIDING) cantseereason=CANTSEE_HIDING;
  220.             }
  221.          }
  222.       }
  223.       else
  224.       {
  225.          cantseereason=CANTSEE_DISBANDING;
  226.       }
  227.  
  228.       if(disbanding)
  229.       {
  230.          disbanding = show_disbanding_screen(oldforcemonth);
  231.       }
  232.  
  233.       if(!forcewait)
  234.       {
  235.          if(nonsighttime>=365*4)
  236.          {
  237.             erase();
  238.             char str[100];
  239.             if(nonsighttime>=365*16) {
  240.                strcpy(str,"How long since you've heard these sounds...  times have changed.");
  241.             } else if(nonsighttime>=365*8) {
  242.                strcpy(str,"It has been a long time.  A lot must have changed...");
  243.             } else {
  244.                strcpy(str,"It sure has been a while.  Things might have changed a bit.");
  245.             }
  246.             set_color(COLOR_WHITE,COLOR_BLACK,1);
  247.             move(12,39-((strlen(str)-1)>>1));
  248.             addstr(str, gamelog);
  249.             gamelog.nextMessage(); //Write out buffer to prepare for the next message.
  250.  
  251.             refresh();
  252.             getch();
  253.          }
  254.  
  255.          nonsighttime=0;
  256.       }
  257.  
  258.       int partysize=0;
  259.       int partydead=0;
  260.       if(activesquad!=NULL)
  261.       {
  262.          for(int p=0;p<6;p++)
  263.          {
  264.             if(activesquad->squad[p]!=NULL)partysize++;
  265.             else
  266.             {
  267.                if(p==buyer)buyer=0;
  268.                continue;
  269.             }
  270.             if(!partysize)
  271.             {
  272.                delete activesquad;
  273.                activesquad=NULL;
  274.             }
  275.  
  276.             if(!activesquad->squad[p]->alive)partydead++;
  277.          }
  278.       }
  279.  
  280.       int safenumber=0;
  281.       for(l=0;l<(int)location.size();l++)if(location[l]->is_lcs_safehouse())safenumber++;
  282.  
  283.       Location *loc=NULL;
  284.       if(selectedsiege!=-1)loc = location[selectedsiege];
  285.       if(activesquad!=NULL && activesquad->squad[0]->location!=-1)
  286.          loc = location[activesquad->squad[0]->location];
  287.  
  288.       siegest *siege=NULL;
  289.       if(loc) siege= &loc->siege;
  290.  
  291.       char sieged=0;
  292.       char underattack=0;
  293.       if(siege!=NULL)
  294.       {
  295.          sieged=siege->siege;
  296.          if(sieged)
  297.             underattack=siege->underattack;
  298.       }
  299.  
  300.       char haveflag=0;
  301.       if(loc) haveflag=loc->haveflag;
  302.  
  303.       // Count people at each location
  304.       int* num_present = new int[location.size()];
  305.       for(int i=0;i<(int)location.size();i++)num_present[i]=0;
  306.       for(int p=0;p<(int)pool.size();p++)
  307.       {
  308.          if(!pool[p]->alive)continue; // Dead people don't count
  309.          if(pool[p]->align!=1)continue; // Non-liberals don't count
  310.          if(pool[p]->location==-1)continue; // Vacationers don't count
  311.          num_present[pool[p]->location]++;
  312.       }
  313.  
  314.       char cannotwait=0;
  315.       for(l=0;l<(int)location.size();l++)
  316.       {
  317.          if(!location[l]->siege.siege)continue;
  318.  
  319.          if(location[l]->siege.underattack)
  320.          {
  321.             // Allow siege if no liberals present
  322.             if(num_present[l])cannotwait=1;
  323.             break;
  324.          }
  325.       }
  326.       delete[] num_present;
  327.  
  328.       if(!forcewait)
  329.       {
  330.          erase();
  331.  
  332.          if(activesquad!=NULL)selectedsiege=-1;
  333.  
  334.          locheader();
  335.          if(selectedsiege!=-1)
  336.          {
  337.             printlocation(selectedsiege);
  338.  
  339.             if(location[selectedsiege]->can_be_upgraded()&&
  340.                !location[selectedsiege]->siege.siege)
  341.             {
  342.                set_color(COLOR_WHITE,COLOR_BLACK,0);
  343.                move(8,1);
  344.                addstr("I - Invest in this location");
  345.             }
  346.          }
  347.          else if(activesquad!=NULL)printparty();
  348.          else makedelimiter(8,0);
  349.  
  350.          if(sieged)
  351.          {
  352.             move(8,1);
  353.             if(underattack)
  354.             {
  355.                set_color(COLOR_RED,COLOR_BLACK,1);
  356.                addstr("Under Attack");
  357.             }
  358.             else
  359.             {
  360.                set_color(COLOR_YELLOW,COLOR_BLACK,1);
  361.                addstr("Under Siege");
  362.                int stock=1;
  363.                if(loc)stock=loc->compound_stores;
  364.                if(!stock)addstr(" (No Food)");
  365.             }
  366.          }
  367.  
  368.          if(haveflag)
  369.          {
  370.             for(int p=0;p<7;p++)
  371.             {
  372.                move(p+10,32);
  373.                if(p<3)
  374.                {
  375.                   set_color(COLOR_WHITE,COLOR_BLUE,1);
  376.                   move(p+10,32);
  377.                   addstr("::::::");
  378.                   set_color(COLOR_WHITE,COLOR_RED,1);
  379.                   move(p+10,38);
  380.                   for(int i=0;i<10;i++)addch(CH_LOWER_HALF_BLOCK);
  381.                }
  382.                else
  383.                {
  384.                   if(p<6)set_color(COLOR_WHITE,COLOR_RED,1);
  385.                   else set_color(COLOR_RED,COLOR_BLACK,0);
  386.                   for(int i=0;i<16;i++)
  387.                   {
  388.                      if(p==6)addch(CH_UPPER_HALF_BLOCK);
  389.                      else addch(CH_LOWER_HALF_BLOCK);
  390.                   }
  391.                }
  392.             }
  393.          }
  394.  
  395.          set_color(COLOR_WHITE,COLOR_BLACK,0);
  396.          move(18,10);
  397.          addstr("--- ACTIVISM ---");
  398.          move(18,51);
  399.          addstr("--- PLANNING ---");
  400.  
  401.          if(partysize>0&&!underattack)set_color(COLOR_WHITE,COLOR_BLACK,0);
  402.          else set_color(COLOR_BLACK,COLOR_BLACK,1);
  403.          move(19,40);
  404.          addstr("E - Equip Squad");
  405.          if(vehicle.size()>0&&partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
  406.          else set_color(COLOR_BLACK,COLOR_BLACK,1);
  407.          move(19,60);
  408.          addstr("V - Vehicles");
  409.          if(pool.size()>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
  410.          else set_color(COLOR_BLACK,COLOR_BLACK,1);
  411.          move(20,40);
  412.          addstr("R - Review Assets and Form Squads");
  413.  
  414.  
  415.          if(partysize>1)set_color(COLOR_WHITE,COLOR_BLACK,0);
  416.          else set_color(COLOR_BLACK,COLOR_BLACK,1);
  417.          move(8,30);
  418.          if(partysize>0 && !sieged)
  419.             addstr("O - Reorder");
  420.  
  421.          if (activesquad)
  422.          {
  423.             move(8,1);
  424.             set_color(COLOR_WHITE,COLOR_BLACK,0);
  425.             addstr(activesquad->name);
  426.             addstr("-"); //in case of overlap, at least make it clear where the name ends.
  427.          }
  428.          if(squad.size()>1||(activesquad==NULL&&squad.size()>0))set_color(COLOR_WHITE,COLOR_BLACK,0);
  429.          else set_color(COLOR_BLACK,COLOR_BLACK,1);
  430.          move(8,43);
  431.          addstr("TAB - Next Squad");
  432.  
  433.          if(safenumber>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
  434.          else set_color(COLOR_BLACK,COLOR_BLACK,1);
  435.          move(8,62);
  436.          addstr("Z - Next Location");
  437.  
  438.          set_color(COLOR_WHITE,COLOR_BLACK,0);
  439.          move(21,40);
  440.          addstr("L - The Status of the Liberal Agenda");
  441.  
  442.          set_color(COLOR_WHITE,COLOR_BLACK,0);
  443.          move(21,1);
  444.          if (party_status==-1)
  445.          {
  446.             addstr("A - Activate Liberals");
  447.          } else
  448.          {
  449.             addstr("A - Assign Task");
  450.          }
  451.  
  452.  
  453.          set_color(COLOR_BLACK,COLOR_BLACK,1);
  454.          for(int p=0;p < (int)pool.size();p++)
  455.          {
  456.             if(pool[p]->alive==true&&
  457.                pool[p]->flag & CREATUREFLAG_SLEEPER&&
  458.                pool[p]->align==ALIGN_LIBERAL&&
  459.                pool[p]->hiding==false&&
  460.                pool[p]->clinic==false&&
  461.                pool[p]->dating==false)
  462.             {
  463.                set_color(COLOR_WHITE,COLOR_BLACK,0);
  464.                break;
  465.             }
  466.          }
  467.          move(21,25);
  468.          addstr("B - Sleepers");
  469.  
  470.          if(partysize>0)
  471.          {
  472.             if(activesquad->activity.type!=ACTIVITY_NONE)set_color(COLOR_WHITE,COLOR_BLACK,0);
  473.             else set_color(COLOR_BLACK,COLOR_BLACK,1);
  474.          }
  475.          else set_color(COLOR_BLACK,COLOR_BLACK,1);
  476.          move(20,1);
  477.          addstr("C - Cancel this Squad's Departure");
  478.  
  479.          if(sieged)
  480.          {
  481.             if(partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
  482.             else
  483.             {
  484.                set_color(COLOR_BLACK,COLOR_BLACK,1);
  485.                for(int p=0;p<(int)pool.size();p++)
  486.                {
  487.                   if(pool[p]->location==selectedsiege)
  488.                   {
  489.                      set_color(COLOR_WHITE,COLOR_BLACK,0);
  490.                      break;
  491.                   }
  492.                }
  493.             }
  494.             move(19,1);
  495.             addstr("F - Escape/Engage");
  496.  
  497.             set_color(COLOR_WHITE,COLOR_BLACK,0);
  498.             move(19,23);
  499.             addstr("G - Give Up");
  500.          }
  501.          else
  502.          {
  503.             if(partysize>0)set_color(COLOR_WHITE,COLOR_BLACK,0);
  504.             else set_color(COLOR_BLACK,COLOR_BLACK,1);
  505.             move(19,1);
  506.             addstr("F - Go forth to stop EVIL");
  507.          }
  508.          //if(partysize>0&&(party_status==-1||partysize>1))set_color(COLOR_WHITE,COLOR_BLACK,0);
  509.          //else set_color(COLOR_BLACK,COLOR_BLACK,1);
  510.          //move(19,40);
  511.          //addstr("# - Check the status of a squad Liberal");
  512.          //if(party_status!=-1)set_color(COLOR_WHITE,COLOR_BLACK,0);
  513.          //else set_color(COLOR_BLACK,COLOR_BLACK,1);
  514.          //move(18,40);
  515.          //addstr("0 - Show the squad's Liberal status");
  516.          set_color(COLOR_WHITE,COLOR_BLACK,0);
  517.          move(23,40);
  518.          addstr("X - Live to fight EVIL another day");
  519.          move(23,1);
  520.          if(cannotwait)
  521.          {
  522.             set_color(COLOR_WHITE,COLOR_BLACK,0);
  523.             addstr("Cannot Wait until Siege Resolved");
  524.          }
  525.          else
  526.          {
  527.             set_color(COLOR_WHITE,COLOR_BLACK,0);
  528.             if(sieged) addstr("W - Wait out the siege");
  529.             else addstr("W - Wait a day");
  530.             if(day==monthday())addstr(" (next month)");
  531.          }
  532.  
  533.          set_color(COLOR_WHITE,COLOR_BLACK,0);
  534.          move(22,40);
  535.          addstr("S - FREE SPEECH: the Liberal Slogan");
  536.          move(22,1);
  537.          if(haveflag)
  538.          {
  539.  
  540.             if(sieged)
  541.                set_color(COLOR_GREEN,COLOR_BLACK,1);
  542.             else
  543.                set_color(COLOR_WHITE,COLOR_BLACK,0);
  544.  
  545.             addstr("P - PROTEST: burn the flag");
  546.          }
  547.          else
  548.          {
  549.             if(ledger.get_funds()>=20&&!sieged&&
  550.                (selectedsiege!=-1||activesquad!=NULL))set_color(COLOR_WHITE,COLOR_BLACK,0);
  551.             else set_color(COLOR_BLACK,COLOR_BLACK,1);
  552.             addstr("P - PATRIOTISM: fly a flag here ($20)");
  553.          }
  554.  
  555.          length=strlen(slogan);
  556.          set_color(COLOR_WHITE,COLOR_BLACK,1);
  557.          if(haveflag)move(17,40-(length>>1));
  558.          else move(13,40-(length>>1));
  559.          addstr(slogan);
  560.  
  561.          refresh();
  562.       }
  563.  
  564.       int c='w';
  565.       if(!forcewait)
  566.       {
  567.          c=getch();
  568.          translategetch(c);
  569.       }
  570.  
  571.       if(c=='x')break;
  572.  
  573.       if(c=='i'&&selectedsiege!=-1)
  574.       {
  575.          if(location[selectedsiege]->can_be_upgraded()&&
  576.             !location[selectedsiege]->siege.siege)
  577.          {
  578.             investlocation();
  579.          }
  580.       }
  581.  
  582.       if(c=='l')
  583.       {
  584.          disbanding=liberalagenda(0);
  585.       }
  586.  
  587.       if(c=='g'&&sieged)
  588.       {
  589.          giveup();
  590.          cleangonesquads();
  591.       }
  592.  
  593.       if(c=='f')
  594.       {
  595.          //NOTE THAT THERE ARE TWO MORE OF THESE
  596.             //IDENTICAL LINES BELOW
  597.          if(!sieged&&partysize>0)
  598.          {
  599.             stopevil();
  600.          }
  601.          else if(underattack)
  602.          {
  603.             escape_engage();
  604.             cleangonesquads();
  605.          }
  606.          else if(sieged)
  607.          {
  608.             sally_forth();
  609.             cleangonesquads();
  610.          }
  611.       }
  612.  
  613.       if(c=='o'&&partysize>1)
  614.      {
  615.         orderparty();
  616.      }
  617.  
  618.       if(c=='c'&&partysize>0)
  619.       {
  620.          activesquad->activity.type=ACTIVITY_NONE;
  621.       }
  622.  
  623.       if(c=='a')
  624.       {
  625.         if (party_status==-1)
  626.             activate();
  627.         else
  628.             activate(activesquad->squad[party_status]);
  629.       }
  630.  
  631.       if(c=='b')
  632.       {
  633.          activate_sleepers();
  634.       }
  635.  
  636.       if(c==9&&squad.size()>0)
  637.       {
  638.          if(activesquad==NULL)activesquad=squad[0];
  639.          else
  640.          {
  641.             for(int sq=0;sq<(int)squad.size();sq++)
  642.             {
  643.                if(squad[sq]==activesquad)
  644.                {
  645.                   if(sq==(int)squad.size()-1)activesquad=squad[0];
  646.                   else activesquad=squad[sq+1];
  647.                   break;
  648.                }
  649.             }
  650.          }
  651.       }
  652.  
  653.       if(c=='z'&&safenumber>0)
  654.       {
  655.          activesquad=NULL;
  656.          int sl;
  657.          if(selectedsiege==-1)sl=0;
  658.          else sl=selectedsiege+1;
  659.  
  660.          if(sl >= (int)location.size()) sl = 0;
  661.  
  662.          for(int l=sl;l<(int)location.size();l++)
  663.          {
  664.             if(location[l]->is_lcs_safehouse())
  665.             {
  666.                selectedsiege=l;
  667.                break;
  668.             }
  669.             else if(l==(int)location.size()-1)l=-1;
  670.          }
  671.       }
  672.  
  673.       if(c=='e'&&partysize>0&&!underattack&&activesquad->squad[0]->location!=-1)
  674.       {
  675.            party_status=-1;
  676.          equip(location[activesquad->squad[0]->location]->loot,-1);
  677.       }
  678.  
  679.       if(c=='r'&&pool.size()>0)review();
  680.  
  681.       if(c=='w'&&(forcewait||!cannotwait))
  682.       {
  683.          char clearformess=forcewait;
  684.          if(!canseethings)nonsighttime++;
  685.          advanceday(clearformess,canseethings);
  686.          if(day>monthday())passmonth(clearformess,canseethings);
  687.          advancelocations();
  688.          if(forcewait)
  689.          {
  690.             erase();
  691.             char num[10];
  692.             set_color(COLOR_WHITE,COLOR_BLACK,0);
  693.             move(7,5);
  694.             addstr("Time passes...", gamelog);
  695.             move(9,12);
  696.             addstr(getmonth(month,true),gamelog);
  697.             addstr(" ", gamelog);
  698.             move(9, 17);
  699.             itoa(day,num,10);
  700.             addstr(num, gamelog);
  701.             addstr(", ", gamelog);
  702.             move(9, 21);
  703.             itoa(year,num,10);
  704.             addstr(num, gamelog);
  705.             gamelog.nextMessage(); //Write out buffer to prepare for the next message.
  706.             refresh();
  707.          }
  708.       }
  709.  
  710.       if(c=='v'&&vehicle.size()>0&&partysize>0)setvehicles();
  711.  
  712.       if(c=='p'&&haveflag)
  713.       {
  714.          burnflag();
  715.          stat_burns++;
  716.          if(selectedsiege!=-1)
  717.          {
  718.             location[selectedsiege]->haveflag=0;
  719.             if (law[LAW_FLAGBURNING] < 1) {
  720.               criminalizepool(LAWFLAG_BURNFLAG,-1,selectedsiege);
  721.             }
  722.          }
  723.          if(activesquad!=NULL)
  724.          {
  725.             location[activesquad->squad[0]->base]->haveflag=0;
  726.             if (law[LAW_FLAGBURNING] < 1) {
  727.               criminalizepool(LAWFLAG_BURNFLAG,-1,activesquad->squad[0]->base);
  728.             }
  729.          }
  730.  
  731.          //PUBLICITY IF BURN FLAG DURING SIEGE
  732.             //ESPECIALLY IF IT IS REALLY ILLEGAL
  733.          if(sieged)
  734.          {
  735.             change_public_opinion(VIEW_LIBERALCRIMESQUAD,1);
  736.             change_public_opinion(VIEW_FREESPEECH,1,1,30);
  737.             if(law[LAW_FLAGBURNING]<=0)
  738.             {
  739.                change_public_opinion(VIEW_LIBERALCRIMESQUAD,1);
  740.                change_public_opinion(VIEW_FREESPEECH,1,1,50);
  741.             }
  742.             if(law[LAW_FLAGBURNING]<=-1)
  743.             {
  744.                change_public_opinion(VIEW_LIBERALCRIMESQUAD,5);
  745.                change_public_opinion(VIEW_FREESPEECH,2,1,70);
  746.             }
  747.             if(law[LAW_FLAGBURNING]==-2)
  748.             {
  749.                change_public_opinion(VIEW_LIBERALCRIMESQUAD,15);
  750.                change_public_opinion(VIEW_FREESPEECH,5,1,90);
  751.             }
  752.          }
  753.       }
  754.       else if(c=='p'&&ledger.get_funds()>=20&&!sieged&&loc)
  755.       {
  756.          ledger.subtract_funds(20,EXPENSE_COMPOUND);
  757.          if(loc)loc->haveflag=1;
  758.          stat_buys++;
  759.       }
  760.  
  761.       if(c=='s')getslogan();
  762.  
  763.       if(c=='0')party_status=-1;
  764.  
  765.       if(c>='1'&&c<='6'&&activesquad!=NULL)
  766.       {
  767.          if(activesquad->squad[c-'1']!=NULL)
  768.          {
  769.             if(party_status==c-'1')fullstatus(party_status);
  770.             else party_status=c-'1';
  771.          }
  772.       }
  773.  
  774.    }while(1);
  775. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement