void Shop::choose_buyer(squadst& customers, int& buyer) const
{
   party_status = -1;

   int partysize = 0;
   for(int p = 0; p < 6; p++)
      if(customers.squad[p] != NULL)
         partysize++;

   if(partysize <= 1)return;

   do
   {
      printparty();

      move(8,20);
      set_color(COLOR_WHITE,COLOR_BLACK,1);
      addstr("Choose a Liberal squad member to SPEND.");

      refresh();

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

      if (c == 10)
         return;

      if (c >= '1' && c <= partysize + '1' - 1)
      {
         buyer = c - '1';
         return;
      }
   } while (true);
}
/* choose buyer */
void choose_buyer(short &buyer)
{
   party_status=-1;

   int partysize=squadsize(activesquad);

   if(partysize<=1) return;

   while(true)
   {
      printparty();

      move(8,20);
      set_color(COLOR_WHITE,COLOR_BLACK,1);
      addstr("Choose a Liberal squad member to SPEND.");

      int c=getkey();

      if(c=='x'||c==ENTER||c==ESC||c==SPACEBAR) return;

      if(c>='1'&&c<=partysize+'1'-1)
      {
         buyer=c-'1';
         return;
      }
   }
}
/* active squad visits the hospital */
void hospital(int loc)
{
   music.play(MUSIC_SHOPPING);
   locatesquad(activesquad,loc);

   int partysize=squadsize(activesquad);

   while(true)
   {
      erase();

      locheader();
      printparty();

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(10,1);
      addstr("F - Go in and fix up Conservative wounds");

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(12,1);
      addstr("Enter - Leave");

      if(partysize>0&&(party_status==-1||partysize>1)) set_color(COLOR_WHITE,COLOR_BLACK,0);
      else set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(13,1);
      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(14,1);
      addstr("0 - Show the squad's Liberal status");

      int c=getkey();

      if(c=='x'||c==ENTER||c==ESC||c==SPACEBAR) break;

      if(c=='0') party_status=-1;

      if(c>='1'&&c<='6'&&activesquad!=NULL)
         if(activesquad->squad[c-'1']!=NULL)
         {
            if(party_status==c-'1')fullstatus(party_status);
            else party_status=c-'1';
         }

      if(c=='f')
      {
         for(int p=5;p>=0;p--)
         {
            if(activesquad->squad[p]==NULL)continue;
            hospitalize(loc,*activesquad->squad[p]);
         }
         break;
      }
   }
}
Example #4
0
/* haul dead/paralyzed */
void squadgrab_immobile(char dead) {
    int p;
    //DRAGGING PEOPLE OUT IF POSSIBLE
    int hostslots = 0;

    for(p = 0; p < 6; p++) {
        if(activesquad->squad[p] != NULL) {
            if(activesquad->squad[p]->alive &&
                    (activesquad->squad[p]->canwalk() ||
                     (activesquad->squad[p]->flag & CREATUREFLAG_WHEELCHAIR)) &&
                    activesquad->squad[p]->prisoner == NULL)
                hostslots++;
            else if((!activesquad->squad[p]->alive ||
                     (!activesquad->squad[p]->canwalk() &&
                      !(activesquad->squad[p]->flag & CREATUREFLAG_WHEELCHAIR))) &&
                    activesquad->squad[p]->prisoner != NULL) {
                clearmessagearea();
                set_color(COLOR_YELLOW, COLOR_BLACK, 1);
                move(16, 1);
                addstr(activesquad->squad[p]->name, gamelog);
                addstr(" can no longer handle ", gamelog);
                addstr(activesquad->squad[p]->prisoner->name, gamelog);
                addstr(".", gamelog);
                gamelog.newline(); //New line.
                refresh();
                getch();

                freehostage(*activesquad->squad[p]->prisoner, 1);
            }
        }
    }

    for(p = 5; p >= 0; p--) {
        if(activesquad->squad[p] != NULL) {
            if((!activesquad->squad[p]->alive && dead) ||
                    (activesquad->squad[p]->alive &&
                     !(activesquad->squad[p]->flag & CREATUREFLAG_WHEELCHAIR) &&
                     !activesquad->squad[p]->canwalk() && !dead)) {
                if(hostslots == 0) {
                    if(!activesquad->squad[p]->alive) {
                        clearmessagearea();
                        set_color(COLOR_YELLOW, COLOR_BLACK, 1);
                        move(16, 1);
                        addstr("Nobody can carry Martyr ", gamelog);
                        addstr(activesquad->squad[p]->name, gamelog);
                        addstr(".", gamelog);
                        gamelog.newline();

                        //DROP LOOT
                        makeloot(*activesquad->squad[p], groundloot);

                        //MUST DELETE PARTY MEMBER FROM POOL COMPLETELY
                        //(that may not be the case any longer -jds)
                        for(int pl = 0; pl < (int)pool.size(); pl++) {
                            if(pool[pl] == activesquad->squad[p]) {
                                pool[pl]->die();
                                pool[pl]->location = -1;
                                //delete_and_remove(pool,pl);
                                break;
                            }
                        }

                        //Check if that was the last living squad member.
                        //bool squad_dead = true;
                        for(int i = 5; i >= 0; --i) {
                            //This check to make sure we don't look at nonexistent
                            //data, causing segfaults and the like.
                            if(activesquad->squad[i] != NULL) {
                                //Check if alive.
                                if(activesquad->squad[i]->alive) {
                                    //IT LIVES! Squad is not dead.
                                    //squad_dead = false;
                                    break; //No reason to continue
                                }
                            }
                        }
                    } else {
                        clearmessagearea();
                        set_color(COLOR_YELLOW, COLOR_BLACK, 1);
                        move(16, 1);
                        addstr(activesquad->squad[p]->name, gamelog);
                        addstr(" is left to be captured.", gamelog);
                        gamelog.newline(); //New line.

                        capturecreature(*activesquad->squad[p]);
                    }
                } else {
                    for(int p2 = 0; p2 < 6; p2++) {
                        if(p2 == p)
                            continue;

                        if(activesquad->squad[p2] != NULL) {
                            if(activesquad->squad[p2]->alive &&
                                    (activesquad->squad[p2]->canwalk() ||
                                     (activesquad->squad[p2]->flag & CREATUREFLAG_WHEELCHAIR)) &&
                                    activesquad->squad[p2]->prisoner == NULL) {
                                activesquad->squad[p2]->prisoner = activesquad->squad[p];

                                clearmessagearea();
                                set_color(COLOR_YELLOW, COLOR_BLACK, 1);
                                move(16, 1);
                                addstr(activesquad->squad[p2]->name, gamelog);
                                addstr(" hauls ", gamelog);
                                addstr(activesquad->squad[p]->name, gamelog);
                                addstr(".", gamelog);
                                gamelog.newline(); //New line.
                                break;
                            }
                        }
                    }

                    hostslots--;
                }

                //SHUFFLE SQUAD
                char flipstart = 0;

                for(int pt = 0; pt < 6; pt++) {
                    if(pt == p - 1)
                        continue;

                    if(pt == p)
                        flipstart = 1;

                    if(flipstart && pt < 5)
                        activesquad->squad[pt] = activesquad->squad[pt + 1];
                }

                if(flipstart)
                    activesquad->squad[5] = NULL;

                printparty();
                refresh();
                getch();
            }
        }
    }
}
Example #5
0
/* hostage freed due to host unable to haul */
void freehostage(Creature &cr, char situation) {
    if(cr.prisoner == NULL)
        return;

    if(cr.prisoner->alive) {
        if(situation == 0) {
            if(cr.prisoner->squadid == -1)
                addstr(" and a hostage is freed", gamelog);
            else {
                addstr(" and ", gamelog);
                addstr(cr.prisoner->name, gamelog);

                if(cr.prisoner->flag & CREATUREFLAG_JUSTESCAPED)
                    addstr(" is recaptured", gamelog);
                else
                    addstr(" is captured", gamelog);
            }

            gamelog.newline(); //New line.
        } else if(situation == 1) {
            clearmessagearea();
            set_color(COLOR_WHITE, COLOR_BLACK, 1);
            move(16, 1);

            if(cr.prisoner->squadid == -1)
                addstr("A hostage escapes!", gamelog);
            else {
                addstr(cr.prisoner->name, gamelog);

                if(cr.prisoner->flag & CREATUREFLAG_JUSTESCAPED)
                    addstr(" is recaptured.", gamelog);
                else
                    addstr(" is captured.", gamelog);
            }

            gamelog.newline(); //New line.
        } else if(situation == 2) {
            //Don't print anything.
        }

        if(cr.prisoner->squadid == -1) {
            for(int e = 0; e < ENCMAX; e++) {
                if(encounter[e].exists == 0) {
                    encounter[e] = *cr.prisoner;
                    encounter[e].exists = 1;
                    conservatise(encounter[e]);
                    break;
                }
            }

            delete cr.prisoner;
        } else
            capturecreature(*cr.prisoner);
    } else {
        if(cr.prisoner->squadid != -1) {
            //MUST DELETE PARTY MEMBER FROM POOL COMPLETELY
            //(That may not be the case any longer -jds)
            for(int pl = 0; pl < (int)pool.size(); pl++) {
                if(pool[pl] == cr.prisoner) {
                    removesquadinfo(*pool[pl]);
                    pool[pl]->die();
                    pool[pl]->location = -1;
                    //delete_and_remove(pool,pl);
                    break;
                }
            }
        }
    }

    cr.prisoner = NULL;

    if(situation == 1) {
        printparty();

        if(mode == GAMEMODE_CHASECAR ||
                mode == GAMEMODE_CHASEFOOT)
            printchaseencounter();
        else
            printencounter();

        refresh();
        getch();
    }
}
Example #6
0
/* prompt after you've said you want to kidnap someone */
void kidnapattempt(void) {
    short kidnapper = -1;

    party_status = -1;

    int available = 0;
    char availslot[6] = {0, 0, 0, 0, 0, 0};

    for(int p = 0; p < 6; p++) {
        if(activesquad->squad[p] != NULL) {
            if(activesquad->squad[p]->alive && activesquad->squad[p]->prisoner == NULL) {
                available++;
                availslot[p] = 1;
            }
        }
    }

    if(!available) {
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        move(16, 1);
        addstr("No one can do the job.            ");
        move(17, 1);
        addstr("                                  ");

        refresh();
        getch();

        return;
    }

    do {
        printparty();

        move(8, 20);
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        addstr("Choose a Liberal squad member to do the job.");

        refresh();

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

        if(c == 10 || c == ESC)
            return;

        if(c >= '1' && c <= '6') {
            if(availslot[c - '1']) {
                kidnapper = c - '1';
                break;
            }
        }

    } while(1);

    if(kidnapper >= 0) {
        vector<int> target;

        for(int e = 0; e < ENCMAX; e++) {
            if(encounter[e].exists && encounter[e].alive && encounter[e].align == -1 &&
                    (encounter[e].animalgloss == ANIMALGLOSS_NONE || law[LAW_ANIMALRESEARCH] == 2)) {
                if((encounter[e].get_weapon().protects_against_kidnapping() &&
                        encounter[e].blood > 20) || encounter[e].animalgloss == ANIMALGLOSS_TANK)
                    continue;

                target.push_back(e);
            }
        }

        if(target.size() > 0) {
            int t = target[0];

            if(target.size() > 1) {
                do {
                    clearcommandarea();
                    clearmessagearea();
                    clearmaparea();

                    set_color(COLOR_WHITE, COLOR_BLACK, 1);
                    move(9, 1);
                    addstr("Kidnap whom?");

                    int x = 1, y = 11;

                    for(int t2 = 0; t2 < (int)target.size(); t2++) {
                        move(y, x);
                        addch(t2 + 'A');
                        addstr(" - ");
                        addstr(encounter[target[t2]].name);

                        y++;

                        if(y == 17) {
                            y = 11;
                            x += 30;
                        }
                    }

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

                    if(c >= 'a' && c <= 'z') {
                        t = c - 'a';

                        if(t >= (int)target.size())
                            t = -1;
                        else
                            t = target[t];

                        break;
                    }

                    if(c == 10 || c == ESC || c == 32) {
                        t = -1;
                        break;
                    }
                } while(1);
            }

            if(t != -1) {
                char amateur = 0;

                if(kidnap(*activesquad->squad[kidnapper], encounter[t], amateur)) {
                    delenc(t, 0);

                    int time = 20 + LCSrandom(10);

                    if(time < 1)
                        time = 1;

                    if(sitealarmtimer > time || sitealarmtimer == -1)
                        sitealarmtimer = time;
                } else
                    sitealarm = 1;

                if(amateur) {
                    char present = 0;

                    for(int e = 0; e < ENCMAX; e++) {
                        if(encounter[e].exists && encounter[e].alive) {
                            present = 1;
                            break;
                        }
                    }

                    if(present) {
                        alienationcheck(1);

                        if(!sitealarm)
                            sitealarm = 1;

                        sitecrime += 5;
                        criminalizeparty(LAWFLAG_KIDNAPPING);

                        if(activesquad->squad[kidnapper]->prisoner != NULL) {
                            if(activesquad->squad[kidnapper]->prisoner->type == CREATURE_RADIOPERSONALITY)
                                offended_amradio = 1;

                            if(activesquad->squad[kidnapper]->prisoner->type == CREATURE_NEWSANCHOR)
                                offended_cablenews = 1;
                        } else {
                            if(encounter[t].type == CREATURE_RADIOPERSONALITY)
                                offended_amradio = 1;

                            if(encounter[t].type == CREATURE_NEWSANCHOR)
                                offended_cablenews = 1;
                        }
                    }
                }

                if(sitealarm)
                    enemyattack();

                creatureadvance();
            }
        } else {
            set_color(COLOR_WHITE, COLOR_BLACK, 1);
            move(16, 1);
            addstr("All of the targets are too dangerous.                ");
            move(17, 1);
            addstr("                                                     ");

            refresh();
            getch();
        }
    } else {
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        move(16, 1);
        addstr("No one can do the job.                                  ");
        move(17, 1);
        addstr("                                                        ");

        refresh();
        getch();
    }
}
Example #7
0
/* prompt after you've said you want to release someone */
void releasehostage(void) {
    short kidnapper = -1;

    party_status = -1;

    int available = 0;
    char availslot[6] = {0, 0, 0, 0, 0, 0};

    for(int p = 0; p < 6; p++) {
        if(activesquad->squad[p] != NULL) {
            if(activesquad->squad[p]->alive && activesquad->squad[p]->prisoner != NULL && activesquad->squad[p]->prisoner->align != ALIGN_LIBERAL) {
                available++;
                availslot[p] = 1;
            }
        }
    }

    if(!available) {
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        move(16, 1);
        addstr("No hostages are being held.       ");
        move(17, 1);
        addstr("                                  ");

        refresh();
        getch();

        return;
    }

    do {
        printparty();

        move(8, 20);
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        addstr("Choose a Liberal squad member to release their hostage.");

        refresh();

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

        if(c == 10 || c == ESC)
            return;

        if(c >= '1' && c <= '6') {
            if(availslot[c - '1']) {
                kidnapper = c - '1';
                break;
            }
        }

    } while(1);

    activesquad->squad[kidnapper]->prisoner->cantbluff = 2;
    freehostage(*(activesquad->squad[kidnapper]), 2);

    if(!sitealarm) {
        set_color(COLOR_WHITE, COLOR_BLACK, 1);
        move(16, 1);
        addstr("The hostage shouts for help!      ", gamelog);
        gamelog.nextMessage(); //Next message.
        move(17, 1);
        addstr("                                  ");

        getch();
        sitealarm = 1;
        alienationcheck(1);
    }
}
/* rescues people held at the activeparty's current location */
void partyrescue(short special)
{
    int freeslots=0;
    int p, pl;
    for(p=0; p<6; p++)
    {
        if(activesquad->squad[p]==NULL)freeslots++;
    }
    int hostslots=0;
    for(p=0; p<6; p++)
    {
        if(activesquad->squad[p]!=NULL)
        {
            if(activesquad->squad[p]->alive&&activesquad->squad[p]->prisoner==NULL)
            {
                hostslots++;
            }
        }
    }

    vector<Creature*> waiting_for_rescue;
    for(pl=0; pl<(int)pool.size(); pl++)
    {
        if(pool[pl]->location==cursite&&
                !(pool[pl]->flag & CREATUREFLAG_SLEEPER)&&
                !(special==SPECIAL_PRISON_CONTROL_LOW&&!(pool[pl]->sentence>0&&!pool[pl]->deathpenalty))&& //Low is for normal time-limited sentences.
                !(special==SPECIAL_PRISON_CONTROL_MEDIUM&&!(pool[pl]->sentence<0&&!pool[pl]->deathpenalty))&& //Medium is for life sentences.
                !(special==SPECIAL_PRISON_CONTROL_HIGH&&!pool[pl]->deathpenalty)) //High is for death sentences.
            waiting_for_rescue.push_back(pool[pl]);
    }

    for(pl=0; pl<(int)waiting_for_rescue.size(); pl++)
    {
        if(LCSrandom(2)&&freeslots)
        {
            for(int p=0; p<6; p++)
            {
                if(activesquad->squad[p]==NULL)
                {
                    activesquad->squad[p]=waiting_for_rescue[pl];
                    activesquad->squad[p]->squadid=activesquad->id;
                    criminalize(*activesquad->squad[p],LAWFLAG_ESCAPED);
                    activesquad->squad[p]->flag|=CREATUREFLAG_JUSTESCAPED;
                    break;
                }
            }
            hostslots++;
            freeslots--;

            clearmessagearea();

            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(16,1);
            addstr("You've rescued ", gamelog);
            addstr(waiting_for_rescue[pl]->name, gamelog);
            addstr(" from the Conservatives.", gamelog);
            gamelog.newline();

            printparty();
            refresh();
            getch();

            waiting_for_rescue[pl]->location=-1;
            waiting_for_rescue[pl]->base=activesquad->squad[0]->base;

            waiting_for_rescue.erase(waiting_for_rescue.begin()+pl);
            --pl;
        }
    }
    for(pl=0; pl<(int)waiting_for_rescue.size(); pl++)
    {
        if(hostslots)
        {
            for(int p=0; p<6; p++)
            {
                if(activesquad->squad[p]!=NULL)
                {
                    if(activesquad->squad[p]->alive&&activesquad->squad[p]->prisoner==NULL)
                    {
                        activesquad->squad[p]->prisoner=waiting_for_rescue[pl];
                        waiting_for_rescue[pl]->squadid=activesquad->id;
                        criminalize(*waiting_for_rescue[pl],LAWFLAG_ESCAPED);
                        waiting_for_rescue[pl]->flag|=CREATUREFLAG_JUSTESCAPED;

                        clearmessagearea();

                        set_color(COLOR_WHITE,COLOR_BLACK,1);
                        move(16,1);
                        addstr("You've rescued ", gamelog);
                        addstr(waiting_for_rescue[pl]->name, gamelog);
                        addstr(" from the Conservatives.", gamelog);
                        gamelog.newline();

                        refresh();
                        getch();

                        clearmessagearea();
                        move(16,1);
                        addstr(waiting_for_rescue[pl]->name, gamelog);
                        addstr(" ", gamelog);
                        switch(LCSrandom(3))
                        {
                        case 0:
                            addstr("was tortured recently ", gamelog);
                            break;
                        case 1:
                            addstr("was beaten severely yesterday ", gamelog);
                            break;
                        case 2:
                            addstr("was on a hunger strike ", gamelog);
                            break;
                        }
                        move(17,1);
                        addstr("so ", gamelog);
                        addstr(activesquad->squad[p]->name, gamelog);
                        addstr(" will have to haul a Liberal.", gamelog);
                        gamelog.newline();

                        waiting_for_rescue[pl]->location=-1;
                        waiting_for_rescue[pl]->base=activesquad->squad[p]->base;

                        printparty();
                        refresh();
                        getch();

                        waiting_for_rescue.erase(waiting_for_rescue.begin()+pl);
                        --pl;
                        break;
                    }
                }
            }

            hostslots--;
        }
        if(!hostslots)break;
    }

    if(waiting_for_rescue.size()==1)
    {
        clearmessagearea();
        set_color(COLOR_YELLOW,COLOR_BLACK,1);
        move(16,1);
        addstr("There's nobody left to carry ", gamelog);
        addstr(waiting_for_rescue[0]->name, gamelog);
        addstr(".", gamelog);
        gamelog.newline();
        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(17,1);
        addstr("You'll have to come back later.", gamelog);
        gamelog.newline();
        refresh();
        getch();
    }
    else if(waiting_for_rescue.size()>1)
    {
        clearmessagearea();
        set_color(COLOR_YELLOW,COLOR_BLACK,1);
        move(16,1);
        addstr("There's nobody left to carry the others.", gamelog);
        gamelog.newline();
        set_color(COLOR_WHITE,COLOR_BLACK,1);
        move(17,1);
        addstr("You'll have to come back later.", gamelog);
        gamelog.newline();
        refresh();
        getch();
    }
}
Example #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));
/* active squad visits the car dealership */
void dealership(int loc)
{
   music.play(MUSIC_SHOPPING);
   short buyer=0;

   locatesquad(activesquad,loc);

   int partysize=squadsize(activesquad);

   while(true)
   {
      erase();

      locheader();
      printparty();

      Creature *sleepercarsalesman=NULL;
      for(int p=0;p<len(pool);p++)
         if(pool[p]->alive&&(pool[p]->flag & CREATUREFLAG_SLEEPER)&&
            pool[p]->type==CREATURE_CARSALESMAN&&location[pool[p]->location]->city==location[loc]->city)
            sleepercarsalesman=pool[p];

      Vehicle* car_to_sell=0;
      int price=0;

      for(int v=len(vehicle)-1;v>=0;v--)
         if(vehicle[v]->id()==activesquad->squad[buyer]->carid)
            car_to_sell = vehicle[v];

      if(!car_to_sell) set_color(COLOR_WHITE,COLOR_BLACK,0);
      else set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(10,1);
      addstr("G - Get a Liberal car");

      move(11,1);
      if(car_to_sell)
      {
         price = static_cast<int>(0.8*car_to_sell->price());

         if(car_to_sell->get_heat())
            price/=10;
         set_color(COLOR_WHITE,COLOR_BLACK,0);
         addstr("S - Sell the "+car_to_sell->fullname()+" ($"+tostring(price)+")");
      }
      else
      {
         set_color(COLOR_BLACK,COLOR_BLACK,1);
         addstr("S - Sell a car");
      }

      /*if(car_to_sell && car_to_sell->heat>1 && ledger.get_funds()>=500)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(12,1);
      addstr("P - Repaint car, replace plates and tags ($500)");*/

      if(partysize>=2)set_color(COLOR_WHITE,COLOR_BLACK,0);
      else set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(16,1);
      addstr("B - Choose a buyer");

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(16,40);
      addstr("Enter - Leave");

      if(party_status!=-1)set_color(COLOR_WHITE,COLOR_BLACK,0);
      else set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(15,1);
      addstr("0 - Show the squad's Liberal status");
      if(partysize>0&&(party_status==-1||partysize>1))set_color(COLOR_WHITE,COLOR_BLACK,0);
      else set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(15,40);
      addstr("# - Check the status of a squad Liberal");

      int c=getkey();

      // Leave
      if(c=='x'||c==ENTER||c==ESC||c==SPACEBAR)break;

      //Sell the car
      if(c=='s' && car_to_sell)
      {
         ledger.add_funds(price,INCOME_CARS);
         for(int v=len(vehicle)-1;v>=0;v--)
            if(vehicle[v]==car_to_sell)
            {
            	delete_and_remove(vehicle,v);
               break;
            }
      }

      // Get a car
      if(c=='g' && !car_to_sell)
      {
         int carchoice;

         vector<int> availablevehicle;
         vector<string> vehicleoption;
         for(int i=0;i<len(vehicletype);i++)
            if (vehicletype[i]->availableatshop())
            {
               availablevehicle.push_back(i);
               vehicleoption.push_back(vehicletype[i]->longname()+" ($"+
                  tostring(sleepercarsalesman?vehicletype[i]->sleeperprice():vehicletype[i]->price())+")");
            }
         while(true)
         {
            carchoice = choiceprompt("Choose a vehicle","",vehicleoption,"Vehicle",
                                     true,"We don't need a Conservative car");
            if (carchoice!=-1 && (sleepercarsalesman?vehicletype[availablevehicle[carchoice]]->sleeperprice():
                                  vehicletype[availablevehicle[carchoice]]->price()) > ledger.get_funds())
            {
               set_color(COLOR_RED,COLOR_BLACK,0);
               move(1,1);
               addstr("You don't have enough money!");

               getkey();
            }
            else break;
         }

         if(carchoice==-1) continue;

         //Picked a car, pick color
         int colorchoice;
         //if(len(vehicletype[availablevehicle[choice]]->color())>1) //Allow to back out if you don't like single colour? -XML
         //{
         colorchoice = choiceprompt("Choose a color","",vehicletype[availablevehicle[carchoice]]->color(),
                                    "Color",true,"These colors are Conservative");
         //}
         //else
         //   colorchoice = 0;

         if(colorchoice==-1) continue;

         Vehicle *v=new Vehicle(*vehicletype[availablevehicle[carchoice]],
                                vehicletype[availablevehicle[carchoice]]->color()[colorchoice],year);
         activesquad->squad[buyer]->pref_carid = v->id();
         vehicle.push_back(v);

         ledger.subtract_funds((sleepercarsalesman?v->sleeperprice():v->price()),EXPENSE_CARS);
      }

      // Reduce heat
      /*if(c=='p' && car_to_sell && car_to_sell->heat>1 && ledger.get_funds()>=500)
      {
         funds-=500;
         moneylost_goods+=500;
         car_to_sell->heat=1;
      }*/

      if(c=='b')choose_buyer(buyer);

      if(c=='0')party_status=-1;

      if(c>='1'&&c<='6'&&activesquad!=NULL)
         if(activesquad->squad[c-'1']!=NULL)
         {
            if(party_status==c-'1')fullstatus(party_status);
            else party_status=c-'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));
Example #12
0
int Shop::fenceselect(squadst& customers) const
{
   int ret=0;

   consolidateloot(location[customers.squad[0]->base]->loot);

   int page=0;

   vector<int> selected(location[customers.squad[0]->base]->loot.size(),0);

   do
   {
      erase();

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(0,0);
      addstr("What will you sell?");

      if (ret > 0)
      {
         move(0,30);
         addstr("Estimated Liberal Amount: $");
         addstr(tostring(ret).c_str());
      }

      printparty();

      int x = 1, y = 10;
      std::string outstr;
      std::string itemstr;

      for (int l = page * 18;
           l < (int)location[customers.squad[0]->base]->loot.size() && l < page * 18 + 18;
           l++)
      {
         if (selected[l])
            set_color(COLOR_GREEN,COLOR_BLACK,1);
         else
            set_color(COLOR_WHITE,COLOR_BLACK,0);
         itemstr = location[customers.squad[0]->base]->loot[l]->equip_title();
         if (location[customers.squad[0]->base]->loot[l]->get_number() > 1)
         {
            if(selected[l] > 0)
            {
               itemstr += " " + tostring(selected[l]) + "/";
            }
            else
               itemstr += " x";
            itemstr += tostring(location[customers.squad[0]->base]->loot[l]->get_number());
         }

         outstr = static_cast<char>(l - page * 18 + 'A');
         outstr += " - " + itemstr;

         move(y,x);
         addstr(outstr.c_str());

         x += 26;
         if (x > 53)
         {
            x = 1;
            y++;
         }
      }

      //PAGE UP
      set_color(COLOR_WHITE,COLOR_BLACK,0);
      if (page > 0)
      {
         move(17,1);
         addprevpagestr();
      }
      //PAGE DOWN
      if((page + 1) * 18 < (int)location[customers.squad[0]->base]->loot.size())
      {
         move(17,53);
         addnextpagestr();
      }

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(23,1);
      addstr("Press a letter to select an item to sell.");
      move(24,1);
      addstr("Enter - Done");

      refresh();

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

      if (c >= 'a' && c <= 'r')
      {
         int slot = c - 'a' + page * 18;

         if(slot >= 0 && slot < (int)location[customers.squad[0]->base]->loot.size())
         {
            if (selected[slot])
            {
               ret -= location[customers.squad[0]->base]->loot[slot]->get_fencevalue() * selected[slot];
               selected[slot] = 0;
            }
            else
            {
               if (!location[customers.squad[0]->base]->loot[slot]->is_good_for_sale())
               {
                  printparty();

                  move(8,15);
                  set_color(COLOR_WHITE,COLOR_BLACK,1);
                  addstr(" You can't sell damaged goods.");

                  refresh();
                  getch();
               }
               else
               {
                  if (location[customers.squad[0]->base]->loot[slot]->get_number() > 1)
                  {
                     selected[slot] = 1;

                     printparty();

                     move(8,15);
                     set_color(COLOR_WHITE,COLOR_BLACK,1);
                     addstr("       How many?          ");

                     refresh();

                     char str[100];

                     keypad(stdscr,FALSE);
                     raw_output(FALSE);
                     echo();
                     curs_set(1);
                     mvgetstr(8,32,str);
                     curs_set(0);
                     noecho();
                     raw_output(TRUE);
                     keypad(stdscr,TRUE);

                     selected[slot] = atoi(str);
                     if (selected[slot] < 0)
                        selected[slot] = 0;
                     else if (selected[slot] > location[customers.squad[0]->base]->loot[slot]->get_number())
                        selected[slot]=location[customers.squad[0]->base]->loot[slot]->get_number();
                  }
                  else
                     selected[slot]=1;
                  ret += location[customers.squad[0]->base]->loot[slot]->get_fencevalue() * selected[slot];
               }
            }
         }
      }

      if(c == 'x'||c==10||c==ESC)
         break;

      //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) * 18 < (int)location[customers.squad[0]->base]->loot.size())
         page++;

   } while (true);

   for(int l = location[customers.squad[0]->base]->loot.size() - 1; l >= 0; l--)
   {
      if(selected[l] > 0)
      {
         location[customers.squad[0]->base]->loot[l]->decrease_number(selected[l]);
         if(location[customers.squad[0]->base]->loot[l]->get_number() <= 0)
            delete_and_remove(location[customers.squad[0]->base]->loot,l);
      }
   }

   return ret;
}
Example #13
0
void Shop::sell_loot(squadst& customers) const
{
   int partysize=0;
   for(int p=0;p<6;p++)
   {
      if(customers.squad[p]!=NULL)
      {
         partysize++;
      }
   }

   do
   {
      erase();

      locheader();
      printparty();

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(10,1);
      addstr("E - Look over Equipment");

      if (location[customers.squad[0]->base]->loot.size() > 0)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(10,40);
      addstr("F - Pawn Selectively");

      if (location[customers.squad[0]->base]->loot.size() > 0)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(11,1);
      addstr("W - Pawn all Weapons");

      if (location[customers.squad[0]->base]->loot.size() > 0)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(11,40);
      addstr("A - Pawn all Ammunition");

      if (location[customers.squad[0]->base]->loot.size() > 0)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(12,1);
      addstr("C - Pawn all Clothes");

      if (location[customers.squad[0]->base]->loot.size() > 0)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(12,40);
      addstr("L - Pawn all Loot");

      if (party_status != -1)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(15,1);
      addstr("0 - Show the squad's Liberal status");

      if (partysize > 0 && (party_status == -1 || partysize > 1))
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(15,40);
      addstr("# - Check the status of a squad Liberal");

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(16,40);
      addstr("Enter - Done pawning");

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

      if (c == 10)
         break;

      if (c == 'e' && customers.squad[0]->base != -1)
         equip(location[customers.squad[0]->base]->loot, -1);

      if (c == 'w' || c == 'a' || c == 'c')
      {
         move(18,1);
         set_color(COLOR_WHITE,COLOR_BLACK,1);
         switch (c)
         {
            case 'w':
               addstr("Really sell all weapons? (Y)es to confirm.           ");
               break;
            case 'a':
               addstr("Really sell all ammo? (Y)es to confirm.              ");
               break;
            case 'c':
               addstr("Really sell all clothes? (Y)es to confirm.           ");
               break;
         }
         int c2 = getch();
         translategetch(c2);
         if (c2 != 'y')
         {
            c = 0;//no sale
         }
      }

      if((c == 'w' || c == 'c' || c == 'l' || c == 'a' || c == 'f') &&
         location[customers.squad[0]->base]->loot.size() > 0)
      {
         int fenceamount=0;

         if (c == 'f')
            fenceamount = fenceselect(customers);
         else
         {
            for (int l = location[customers.squad[0]->base]->loot.size() - 1; l >= 0; l--)
            {
               if (c == 'w' && location[customers.squad[0]->base]->loot[l]->is_weapon()
                   && location[customers.squad[0]->base]->loot[l]->is_good_for_sale())
               {
                  fenceamount += location[customers.squad[0]->base]->loot[l]->get_fencevalue()
                                 * location[customers.squad[0]->base]->loot[l]->get_number();
                  delete_and_remove(location[customers.squad[0]->base]->loot,l);
               }
               else if (c == 'c' && location[customers.squad[0]->base]->loot[l]->is_armor()
                        && location[customers.squad[0]->base]->loot[l]->is_good_for_sale())
               {
                  fenceamount += location[customers.squad[0]->base]->loot[l]->get_fencevalue()
                                 * location[customers.squad[0]->base]->loot[l]->get_number();
                  delete_and_remove(location[customers.squad[0]->base]->loot,l);
               }
               else if (c == 'a' && location[customers.squad[0]->base]->loot[l]->is_clip()
                        && location[customers.squad[0]->base]->loot[l]->is_good_for_sale())
               {
                  fenceamount += location[customers.squad[0]->base]->loot[l]->get_fencevalue()
                                 * location[customers.squad[0]->base]->loot[l]->get_number();
                  delete_and_remove(location[customers.squad[0]->base]->loot,l);
               }
               else if (c == 'l' && location[customers.squad[0]->base]->loot[l]->is_loot()
                        && location[customers.squad[0]->base]->loot[l]->is_good_for_sale())
               {
                  Loot* a = static_cast<Loot*>(location[customers.squad[0]->base]->loot[l]); //cast -XML
                  if(!a->no_quick_fencing())
                  {
                     fenceamount += location[customers.squad[0]->base]->loot[l]->get_fencevalue()
                                    * location[customers.squad[0]->base]->loot[l]->get_number();
                     delete_and_remove(location[customers.squad[0]->base]->loot,l);
                  }
               }
            }
         }

         if(fenceamount > 0)
         {
            set_color(COLOR_WHITE,COLOR_BLACK,1);
            move(8,1);
            addstr("You add $");
            addstr(tostring(fenceamount).c_str());
            addstr(" to Liberal Funds.");

            refresh();
            getch();

            ledger.add_funds(fenceamount,INCOME_PAWN);
         }
      }
   } while (true);
}
Example #14
0
void Shop::browse_halfscreen(squadst& customers, int& buyer) const
{
   unsigned page = 0;
   const unsigned max_entries_per_page = 20;

   std::vector<ShopOption*> available_options = options_;

   available_options.erase (remove_if (available_options.begin(),
				       available_options.end(),
				       not1 (mem_fun (&ShopOption::display))),
			    available_options.end());

   int partysize = 0;
   for (int p = 0; p < 6; ++p)
   {
      if(customers.squad[p] != NULL)
      {
         partysize++;
      }
   }

   do
   {
      erase();
      set_color(COLOR_WHITE,COLOR_BLACK,0);

      locheader();
      printparty();

      move(8,45);
      addstr("Buyer: ");
      addstr(customers.squad[buyer]->name);

      //Write wares and prices
      int yline = 10;
      int column = 1;
      int taken_letters = 0;
      for (unsigned p = page * (max_entries_per_page - 1);
           p < available_options.size() && p < page * (max_entries_per_page - 1) + max_entries_per_page;
           ++p)
      {
         if (available_options[p]->is_available())
            set_color(COLOR_WHITE,COLOR_BLACK,0);
         else
            set_color(COLOR_BLACK,COLOR_BLACK,1);
         if (column == 1)
            move(yline,1);
         else
            move(yline,40);

         if (available_options[p]->letter_defined_)
            addch(available_options[p]->showletter());
         else
         {
            // Find an available letter to use for this ware.
            bool done = false;
            while (taken_letters < 27 && !done)
            {
               done = true;
               if ('a' + taken_letters == 'b' || // Letters used by the shop UI are disallowed.
                   'a' + taken_letters == 'e' ||
                   ('a' + taken_letters == 's' && allow_selling_) ||
                   ('a' + taken_letters == 'm' && sell_masks_))
               {
                  ++taken_letters;
                  done = false;
                  continue;
               }
               for (unsigned i = 0; i < available_options.size(); ++i)
               {
                  if (available_options[i]->letter_defined_ &&
                      'a' + taken_letters == available_options[i]->letter_)
                  {
                     ++taken_letters;
                     done = false;
                     break;
                  }
               }
            }
            available_options[p]->letter_ = 'a' + taken_letters;
            addch('A' + taken_letters);
            ++taken_letters;
         }

         addstr(" - ");
         addstr(available_options[p]->get_description_halfscreen().c_str());
         if (column == 1)
            column = 2;
         else
         {
            ++yline;
            column = 1;
         }
      }
      if (sell_masks_)
      {
         move(yline,1+(column-1)*39);
         if (ledger.get_funds() >= 15)
            set_color(COLOR_WHITE,COLOR_BLACK,0);
         else
            set_color(COLOR_BLACK,COLOR_BLACK,1);
         addstr("M - Buy a Mask                ($15)");
      }
      if (column == 2)
         ++yline;

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(yline,1);
      addstr("E - Look over Equipment");
      ++yline;

      if (allow_selling_)
      {
         move(yline,1);
         if (location[customers.squad[0]->base]->loot.size() > 0)
            set_color(COLOR_WHITE,COLOR_BLACK,0);
         else
            set_color(COLOR_BLACK,COLOR_BLACK,1);
         addstr("S - Sell something");
         ++yline;
      }

      ++yline;

      if (party_status != -1)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(yline,1);
      addstr("0 - Show the squad's Liberal status");

      if (partysize > 0 && (party_status == -1 || partysize > 1))
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(yline++,40);
      addstr("# - Check the status of a squad Liberal");

      if (partysize >= 2)
         set_color(COLOR_WHITE,COLOR_BLACK,0);
      else
         set_color(COLOR_BLACK,COLOR_BLACK,1);
      move(yline,1);
      addstr("B - Choose a buyer");

      set_color(COLOR_WHITE,COLOR_BLACK,0);
      move(yline,40);
      addstr("Enter - ");
      addstr(exit_.c_str());



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

      for (unsigned i = 0; i < available_options.size(); ++i)
      {
         if (c == available_options[i]->letter_)
         {
            available_options[i]->choose(customers, buyer);
            break;
         }
      }

      if(c == 'e' && customers.squad[0]->base != -1)
         equip(location[customers.squad[0]->base]->loot, -1);
      else if (c == 's' && allow_selling_
               && location[customers.squad[0]->base]->loot.size() > 0)
         sell_loot(customers);
      else if (c == 'm' && sell_masks_ && ledger.get_funds() >= 15)
      {
         maskselect(*customers.squad[buyer]);
      }
      else if (c == 'b')
         choose_buyer(customers, buyer);
      else if (c == '0')
         party_status=-1;
      else if ( c >= '1' && c <= '6')
      {
         if (customers.squad[c-'1'] != NULL)
         {
            if (party_status == c - '1')
               fullstatus(party_status);
            else
               party_status = c - '1';
         }
      }
      else if (c == 10)
         break;

   } while (true);
}