LCOV - code coverage report
Current view: top level - omega-rpg-0.90-pa9 - site1.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 83 784 10.6 %
Date: 2017-09-08 22:00:26 Functions: 2 17 11.8 %
Branches: 47 410 11.5 %

           Branch data     Line data    Source code
       1                 :            : /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
       2                 :            : /* site1.c */
       3                 :            : /* 1st half of site functions and aux functions to them */
       4                 :            : 
       5                 :            : #ifndef MSDOS_SUPPORTED_ANTIQUE
       6                 :            : #include <unistd.h>
       7                 :            : #endif
       8                 :            : 
       9                 :            : #include "glob.h"
      10                 :            : 
      11                 :          1 : void l_armorer(void)
      12                 :            : {
      13                 :          1 :   int done = FALSE;
      14                 :            :   char action;
      15         [ -  + ]:          1 :   if (hour() == 12) 
      16                 :          0 :     print3("Unfortunately, this is Julie's lunch hour -- try again later.");
      17         [ -  + ]:          1 :   else if (nighttime()) 
      18                 :          0 :     print3("It seems that Julie keeps regular business hours.");
      19                 :            :   else {
      20         [ +  + ]:          2 :     while (! done) {
      21                 :          1 :       clearmsg();
      22                 :          1 :       print1("Julie's: Buy Armor, Weapons, or Leave [a,w,ESCAPE] ");
      23                 :          1 :       action = mgetc();
      24         [ -  + ]:          1 :       if (action == 'a') 
      25                 :          0 :         buyfromstock(ARMORID,10);
      26         [ -  + ]:          1 :       else if (action == 'w') 
      27                 :          0 :         buyfromstock(WEAPONID,23);
      28                 :            :       else
      29                 :          1 :         done = TRUE;
      30                 :            :     }
      31                 :            :   }
      32                 :          1 :   xredraw();
      33                 :          1 : }
      34                 :            : 
      35                 :            : 
      36                 :          0 : void buyfromstock(int base, int numitems)
      37                 :            : {
      38                 :            :   int i;
      39                 :            :   char item;
      40                 :            :   pob newitem;
      41                 :            : 
      42                 :          0 :   print2("Purchase which item? [ESCAPE to quit] ");
      43                 :          0 :   menuclear();
      44         [ #  # ]:          0 :   for(i=0;i<numitems;i++) {
      45                 :          0 :     strcpy(Str4," :");
      46                 :          0 :     Str4[0] = i + 'a';
      47                 :          0 :     strcat(Str4,Objects[base+i].objstr);
      48                 :          0 :     menuprint(Str4);
      49                 :          0 :     menuprint("\n");
      50                 :            :   }
      51                 :          0 :   showmenu();
      52                 :          0 :   item = ' ';
      53 [ #  # ][ #  # ]:          0 :   while ((item != ESCAPE) &&
      54         [ #  # ]:          0 :          ((item < 'a') || (item >= 'a'+numitems)))
      55                 :          0 :     item = mgetc();
      56         [ #  # ]:          0 :   if (item != ESCAPE) {
      57                 :          0 :     i = item - 'a';
      58                 :          0 :     newitem = ((pob) checkmalloc(sizeof(objtype)));
      59                 :          0 :     *newitem = Objects[base+i];
      60                 :          0 :     newitem->known = 2;
      61                 :          0 :     clearmsg();
      62                 :          0 :     print1("I can let you have it for ");
      63                 :          0 :     mlongprint(2*true_item_value(newitem));
      64                 :          0 :     nprint1("Au. Buy it? [yn] ");
      65         [ #  # ]:          0 :     if (ynq1() == 'y') {
      66         [ #  # ]:          0 :       if (Player.cash < 2*true_item_value(newitem)) {
      67                 :          0 :         print2("Why not try again some time you have the cash?");
      68                 :          0 :         free_obj( newitem, TRUE );
      69                 :            :       }
      70                 :            :       else {
      71                 :          0 :         Player.cash -= 2*true_item_value(newitem);
      72                 :          0 :         dataprint();
      73                 :          0 :         gain_item(newitem);
      74                 :            :       }
      75                 :            :     }
      76                 :          0 :     else free_obj( newitem, TRUE );
      77                 :            :   }
      78                 :          0 : }
      79                 :            : 
      80                 :            : 
      81                 :          0 : void l_club(void)
      82                 :            : {
      83                 :            :   char response;
      84                 :            : 
      85                 :          0 :   print1("Rampart Explorers' Club.");
      86         [ #  # ]:          0 :   if (! gamestatusp(CLUB_MEMBER)) {
      87         [ #  # ]:          0 :     if (Player.level < 2) print3("Only reknowned adventurers need apply.");
      88                 :            :     else {
      89                 :          0 :       print2("Dues are 100Au. Pay it? [yn] ");
      90         [ #  # ]:          0 :       if (ynq2()=='y') {
      91         [ #  # ]:          0 :         if (Player.cash < 100)
      92                 :          0 :           print3("Beat it, or we'll blackball you!");
      93                 :            :         else {
      94                 :          0 :           print1("Welcome to the club! You are taught the spell of Return.");
      95                 :          0 :           print2("When cast on the first level of a dungeon it");
      96                 :          0 :           morewait();
      97                 :          0 :           clearmsg();
      98                 :          0 :           print1("will transport you down to the lowest level");
      99                 :          0 :           print2("you have explored, and vice versa.");
     100                 :          0 :           Spells[S_RETURN].known = TRUE;
     101                 :          0 :           Player.cash -= 100;
     102                 :          0 :           setgamestatus(CLUB_MEMBER);
     103                 :            :         }
     104                 :            :       }
     105                 :          0 :       else print2("OK, but you're missing out on our benefits....");
     106                 :            :     }
     107                 :            :   }
     108                 :            :   else {
     109                 :          0 :     print2("Shop at the club store or listen for rumors [sl] ");
     110                 :          0 :     do response = (char) mcigetc(); 
     111 [ #  # ][ #  # ]:          0 :     while ((response != 's') && (response != 'l') && (response != ESCAPE));
                 [ #  # ]
     112         [ #  # ]:          0 :     if (response == 'l') {
     113         [ #  # ]:          0 :       if (club_hinthour == hour()) print2("You don't hear anything useful.");
     114                 :            :       else {
     115                 :          0 :         print1("You overhear a conversation....");
     116                 :          0 :         hint();
     117                 :          0 :         club_hinthour = hour();
     118                 :            :       }
     119                 :            :     }
     120         [ #  # ]:          0 :     else if (response == 's') {
     121                 :          0 :       buyfromstock(OB_KEY,2);
     122                 :          0 :       xredraw();
     123                 :            :     }
     124         [ #  # ]:          0 :     else if (response == ESCAPE)
     125                 :          0 :       print2("Be seeing you, old chap!");
     126                 :            :   }
     127                 :          0 : }
     128                 :            : 
     129                 :          0 : void l_gym(void)
     130                 :            : {
     131                 :          0 :   int done=TRUE;
     132                 :          0 :   int trained=0;
     133                 :          0 :   clearmsg();
     134                 :            :   do {
     135                 :          0 :     print1("The Rampart Gymnasium");
     136 [ #  # ][ #  # ]:          0 :     if ((Gymcredit > 0) || (Player.rank[ARENA])) {
     137                 :          0 :       nprint1("-- Credit: ");
     138                 :          0 :       mlongprint(Gymcredit);
     139                 :          0 :       nprint1("Au.");
     140                 :            :     }
     141                 :          0 :     done = FALSE;
     142                 :          0 :     menuclear();
     143                 :          0 :     menuprint("Train for 2000 Au. Choose:\n");
     144                 :          0 :     menuprint("\na: work out in the weight room");
     145                 :          0 :     menuprint("\nb: use our gymnastics equipment");
     146                 :          0 :     menuprint("\nc: take our new anaerobics course");
     147                 :          0 :     menuprint("\nd: enroll in dance lessons.");
     148                 :          0 :     menuprint("\nESCAPE: Leave this place.");
     149                 :          0 :     showmenu();
     150   [ #  #  #  #  :          0 :     switch(mgetc()) {
                   #  # ]
     151                 :            :     case 'a': 
     152                 :          0 :       gymtrain(&(Player.maxstr),&(Player.str));
     153                 :          0 :       break;
     154                 :            :     case 'b': 
     155                 :          0 :       gymtrain(&(Player.maxdex),&(Player.dex));
     156                 :          0 :       break;
     157                 :            :     case 'c': 
     158                 :          0 :       gymtrain(&(Player.maxcon),&(Player.con));
     159                 :          0 :       break;
     160                 :            :     case 'd':
     161                 :          0 :       gymtrain(&(Player.maxagi),&(Player.agi));
     162                 :          0 :       break;
     163                 :            :     case ESCAPE:
     164                 :          0 :       clearmsg();
     165         [ #  # ]:          0 :       if (trained == 0)
     166                 :          0 :           print1("Well, it's your body you're depriving!"); 
     167         [ #  # ]:          0 :       else if (trained < 3)
     168                 :          0 :           print1("You towel yourself off, and find the exit.");
     169                 :            :       else
     170                 :          0 :           print1("A refreshing bath, and you're on your way.");
     171                 :          0 :       done = TRUE;
     172                 :          0 :       break;
     173                 :            :     default:
     174                 :          0 :       trained--;
     175                 :          0 :       break;
     176                 :            :     }
     177                 :          0 :     trained++;
     178         [ #  # ]:          0 :   } while (! done);
     179                 :          0 :   xredraw();
     180                 :          0 :   calc_melee();
     181                 :          0 : }
     182                 :            : 
     183                 :          0 : void l_healer(void)
     184                 :            : {
     185                 :          0 :   print1("Rampart Healers. Member RMA.");
     186                 :          0 :   morewait();
     187                 :          0 :   clearmsg();
     188                 :          0 :   print1("a: Heal injuries (50 crowns)");
     189                 :          0 :   print2("b: Cure disease (250 crowns)");
     190                 :          0 :   print3("ESCAPE: Leave these antiseptic alcoves.");
     191      [ #  #  # ]:          0 :   switch((char) mcigetc()) {
     192                 :          0 :     case 'a': healforpay(); break;
     193                 :          0 :     case 'b': cureforpay(); break;
     194                 :          0 :     default: print3("OK, but suppose you have Acute Satyriasis?"); break;
     195                 :            :   }           
     196                 :          0 : }
     197                 :            : 
     198                 :            : 
     199                 :          0 : void statue_random(int x, int y)
     200                 :            : {
     201                 :            :   pob item;
     202                 :            :   int i,j;
     203   [ #  #  #  #  :          0 :   switch(random_range(difficulty()+4)-1) {
          #  #  #  #  #  
                   #  # ]
     204                 :            :   case 0: 
     205                 :            :   case 1:
     206                 :          0 :     print1("The statue crumbles with a clatter of gravel.");
     207                 :          0 :     Level->site[x][y].locchar = RUBBLE;
     208                 :          0 :     Level->site[x][y].p_locf = L_RUBBLE;
     209                 :          0 :     plotspot(x, y, TRUE);
     210                 :          0 :     lset(x, y, CHANGED);
     211                 :          0 :     break;
     212                 :            :   case 2: 
     213                 :          0 :     print1("The statue stoutly resists your attack.");
     214                 :          0 :     break;
     215                 :            :   case 3: 
     216                 :          0 :     print1("The statue crumbles with a clatter of gravel.");
     217                 :          0 :     Level->site[x][y].locchar = RUBBLE;
     218                 :          0 :     Level->site[x][y].p_locf = L_RUBBLE;
     219                 :          0 :     plotspot(x, y, TRUE);
     220                 :          0 :     lset(x, y, CHANGED);
     221                 :          0 :     make_site_treasure(x,y,difficulty());
     222                 :          0 :     break;
     223                 :            :   case 4:
     224                 :          0 :     print1("The statue hits you back!");
     225                 :          0 :     p_damage(random_range(difficulty()*5),NORMAL_DAMAGE,"a statue");
     226                 :          0 :     break;
     227                 :            :   case 5:
     228                 :          0 :     print1("The statue looks slightly pained. It speaks:");
     229                 :          0 :     morewait();
     230                 :          0 :     clearmsg();
     231                 :          0 :     hint();
     232                 :          0 :     break;
     233                 :            :   case 6:
     234                 :            :     /* WDT MARK! Why is this testing for '==' city?  Shouldn't
     235                 :            :      * it be '!='? */
     236                 :            :     /* DAG reply: no, == CITY is fine.  A down staircase in Rampart is just 
     237                 :            :        an alternate entrance to the sewers.  But a down staircase elsewhere 
     238                 :            :        (like a village) is not valid, so is prevented by this check */
     239 [ #  # ][ #  # ]:          0 :     if ( ((Current_Environment == Current_Dungeon) && 
     240         [ #  # ]:          0 :          (Level->depth < MaxDungeonLevels)) ||
     241                 :          0 :          (Current_Environment == E_CITY)) {
     242                 :          0 :       print1("You hear the whirr of some mechanism.");
     243                 :          0 :       print2("The statue glides smoothly into the floor!");
     244                 :            :       /* WDT HACK: I shouldn't be making this choice on a level
     245                 :            :        * where no stairs can be (or perhaps I should, and I should
     246                 :            :        * implement a bonus level!). */
     247                 :            :       /* DAG -- added level test above, to skip this case if at bottom 
     248                 :            :        * might be cleaner to do something else... but this should prevent
     249                 :            :        * the chance of crashing at least.  Maybe stairs up as first rev?*/
     250                 :          0 :       Level->site[x][y].locchar = STAIRS_DOWN;
     251                 :          0 :       Level->site[x][y].p_locf = L_NO_OP;
     252                 :          0 :       lset(x, y, CHANGED|STOPS);
     253                 :            :     }
     254                 :          0 :     break;
     255                 :            :   case 7:
     256                 :          0 :     print1("The statue was covered with contact cement!");
     257                 :          0 :     print2("You can't move....");
     258                 :          0 :     Player.status[IMMOBILE]+=random_range(6)+2;
     259                 :          0 :     break;
     260                 :            :   case 8:
     261                 :          0 :     print1("A strange radiation emanates from the statue!");
     262                 :          0 :     dispel(-1);
     263                 :          0 :     break;
     264                 :            :   case 9: /* I think this is particularly evil. Heh heh. */
     265         [ #  # ]:          0 :     if (Player.possessions[O_WEAPON_HAND] != NULL) {
     266                 :          0 :       print1("Your weapon sinks deeply into the statue and is sucked away!");
     267                 :          0 :       item = Player.possessions[O_WEAPON_HAND];
     268                 :          0 :       conform_lost_object(Player.possessions[O_WEAPON_HAND]);
     269                 :          0 :       item->blessing = -1-abs(item->blessing);
     270                 :          0 :       drop_at(x,y,item);
     271                 :            :     }
     272                 :          0 :     break;
     273                 :            :   case 10:
     274                 :          0 :     print1("The statue extends an arm. Beams of light illuminate the level!");
     275         [ #  # ]:          0 :     for(j=0;j<Level->level_length;j++) 
     276         [ #  # ]:          0 :       for(i=0;i<Level->level_width;i++) {
     277                 :          0 :         lset(i,j,SEEN);
     278         [ #  # ]:          0 :         if (loc_statusp(i,j,SECRET)) {
     279                 :          0 :           lreset(i,j,SECRET);
     280                 :          0 :           lset(i,j,CHANGED);
     281                 :            :         }
     282                 :            :       }
     283                 :          0 :     show_screen();
     284                 :          0 :     break;
     285                 :            :   default: 
     286                 :          0 :     l_statue_wake(); 
     287                 :          0 :     break;
     288                 :            :   }
     289                 :          0 : }
     290                 :            : 
     291                 :          0 : void l_statue_wake(void)
     292                 :            : {
     293                 :            :   int i;
     294                 :          0 :   int x=Player.x,y=Player.y;
     295         [ #  # ]:          0 :   for(i=0;i<9;i++)
     296                 :          0 :     wake_statue(x+Dirs[0][i],y+Dirs[1][i],TRUE);
     297                 :          0 : }
     298                 :            : 
     299                 :          0 : void wake_statue(int x, int y, int first)
     300                 :            : {
     301                 :            :   int i;
     302                 :            :   pml tml;
     303         [ #  # ]:          0 :   if (Level->site[x][y].locchar == STATUE) {
     304         [ #  # ]:          0 :     if (! first) mprint("Another statue awakens!");
     305                 :          0 :     else mprint("A statue springs to life!");
     306                 :          0 :     Level->site[x][y].locchar = FLOOR;
     307                 :          0 :     lset(x, y, CHANGED);
     308                 :          0 :     tml = ((pml) checkmalloc(sizeof(mltype)));
     309                 :          0 :     tml->m =
     310                 :          0 :       (Level->site[x][y].creature = m_create(x,y,0,difficulty()+1));
     311                 :          0 :     m_status_set(Level->site[x][y].creature,HOSTILE);
     312                 :          0 :     tml->next = Level->mlist;
     313                 :          0 :     Level->mlist = tml;
     314         [ #  # ]:          0 :     for(i=0;i<8;i++) wake_statue(x+Dirs[0][i],y+Dirs[1][i],FALSE);
     315                 :            :   }
     316                 :          0 : }
     317                 :            : 
     318                 :            : 
     319                 :          0 : void l_casino(void)
     320                 :            : {
     321                 :          0 :   int i,done = FALSE,a,b,c,match;
     322                 :            :   char response;
     323                 :          0 :   print1("Rampart Mithril Nugget Casino.");
     324         [ #  # ]:          0 :   if (random_range(10)==1)
     325                 :          0 :     print2("Casino closed due to Grand Jury investigation.");
     326                 :            :   else {
     327         [ #  # ]:          0 :     while (! done) {
     328                 :          0 :       morewait();
     329                 :          0 :       clearmsg();
     330                 :          0 :       print1("a: Drop 100Au in the slots.");
     331                 :          0 :       print2("b: Risk 1000Au  at roulette.");
     332                 :          0 :       print3("ESCAPE: Leave this green baize hall.");
     333                 :          0 :       response = (char) mcigetc();
     334         [ #  # ]:          0 :       if (response == 'a') {
     335         [ #  # ]:          0 :         if (Player.cash < 100) print3("No credit, jerk.");
     336                 :            :         else {
     337                 :          0 :           Player.cash -= 100;
     338                 :          0 :           dataprint();
     339         [ #  # ]:          0 :           for(i=0;i<20;i++) {
     340         [ #  # ]:          0 :             if (i==19)
     341                 :          0 :               sleep(1);
     342                 :            :             else
     343                 :          0 :               usleep(250000);
     344                 :          0 :             a = random_range(10);
     345                 :          0 :             b = random_range(10);
     346                 :          0 :             c = random_range(10);
     347                 :          0 :             clearmsg1();
     348                 :          0 :             mprint(slotstr(a));
     349                 :          0 :             mprint(slotstr(b));
     350                 :          0 :             mprint(slotstr(c));
     351                 :            :           }
     352         [ #  # ]:          0 :           if (winnings > 0) do {
     353                 :          0 :             a = random_range(10);
     354                 :          0 :             b = random_range(10);
     355                 :          0 :             c = random_range(10);
     356 [ #  # ][ #  # ]:          0 :           } while ((a==b) || (a == c) || (b == c));
                 [ #  # ]
     357                 :            :           else {
     358                 :          0 :             a = random_range(10);
     359                 :          0 :             b = random_range(10);
     360                 :          0 :             c = random_range(10);
     361                 :            :           }
     362                 :          0 :           clearmsg();
     363                 :          0 :           mprint(slotstr(a));
     364                 :          0 :           mprint(slotstr(b));
     365                 :          0 :           mprint(slotstr(c));
     366 [ #  # ][ #  # ]:          0 :           if ((a==b) && (a==c)) {
     367                 :          0 :             print3("Jackpot Winner!");
     368                 :          0 :             winnings += (a+2)*(b+2)*(c+2)*5;
     369                 :          0 :             Player.cash += (a+2)*(b+2)*(c+2)*5;
     370                 :          0 :             dataprint();
     371                 :            :           }
     372         [ #  # ]:          0 :           else if (a==b) {
     373                 :          0 :             print3("Winner!");
     374                 :          0 :             Player.cash += (a+2)*(b+2)*5;
     375                 :          0 :             dataprint();
     376                 :          0 :             winnings += (a+2)*(b+2)*5;
     377                 :            :           }
     378         [ #  # ]:          0 :           else if (a==c) {
     379                 :          0 :             print3("Winner!");
     380                 :          0 :             Player.cash += (a+2)*(c+2)*5;
     381                 :          0 :             dataprint();
     382                 :          0 :             winnings += (a+2)*(c+2)*5;
     383                 :            :           }
     384         [ #  # ]:          0 :           else if (c==b) {
     385                 :          0 :             print3("Winner!");
     386                 :          0 :             Player.cash += (c+2)*(b+2)*5;
     387                 :          0 :             dataprint();
     388                 :          0 :             winnings += (c+2)*(b+2)*5;
     389                 :            :           }
     390                 :            :           else {
     391                 :          0 :             print3("Loser!");
     392                 :          0 :             winnings -= 100;
     393                 :            :           }
     394                 :            :         }
     395                 :            :       }
     396         [ #  # ]:          0 :       else if (response == 'b') {
     397         [ #  # ]:          0 :         if (Player.cash < 1000) mprint("No credit, jerk.");
     398                 :            :         else {
     399                 :          0 :           Player.cash -= 1000;
     400                 :          0 :           dataprint();
     401                 :          0 :           print1("Red or Black? [rb]");
     402                 :          0 :           do response = (char) mcigetc();
     403 [ #  # ][ #  # ]:          0 :           while ((response != 'r') && (response != 'b'));
     404                 :          0 :           match = (response == 'r' ? 0 : 1);
     405         [ #  # ]:          0 :           for(i=0;i<20;i++) {
     406         [ #  # ]:          0 :             if (i==19)
     407                 :          0 :               sleep(1);
     408                 :            :             else
     409                 :          0 :               usleep(250000);
     410                 :          0 :             a = random_range(37);
     411                 :          0 :             b = a % 2;
     412         [ #  # ]:          0 :             if (a == 0) print1(" 0 ");
     413         [ #  # ]:          0 :             else if (a==1) print1(" 0 - 0 ");
     414                 :            :             else {
     415         [ #  # ]:          0 :               print1(( b == 0) ? "Red ": "Black ");
     416                 :          0 :               mnumprint(a-1);
     417                 :            :             }
     418                 :            :           }
     419         [ #  # ]:          0 :           if (winnings > 0) do {
     420                 :          0 :             a = random_range(37);
     421                 :          0 :             b = a % 2;
     422         [ #  # ]:          0 :           } while (b == match);
     423                 :            :           else {
     424                 :          0 :             a = random_range(37);
     425                 :          0 :             b = a % 2;
     426                 :            :           }
     427         [ #  # ]:          0 :           if (a == 0) print1(" 0 ");
     428         [ #  # ]:          0 :           else if (a==1) print1(" 0 - 0 ");
     429                 :            :           else {
     430         [ #  # ]:          0 :             print1((b == 0) ? "Red ": "Black ");
     431                 :          0 :             mnumprint(a-1);
     432                 :            :           }
     433 [ #  # ][ #  # ]:          0 :           if ((a > 1) && (b == match)){
     434                 :          0 :             print3(" Winner!");
     435                 :          0 :             winnings += 1000;
     436                 :          0 :             Player.cash += 2000;
     437                 :          0 :             dataprint();
     438                 :            :           }
     439                 :            :           else {
     440                 :          0 :             print3(" Loser!");
     441                 :          0 :             winnings -= 1000;
     442                 :          0 :             dataprint();
     443                 :            :           }
     444                 :            :         }
     445                 :            :       }
     446                 :          0 :       else done = TRUE;
     447                 :            :     }
     448                 :            :   }
     449                 :          0 : }
     450                 :            : 
     451                 :            : 
     452                 :          0 : void l_commandant (void)
     453                 :            : {
     454                 :            :   int num;
     455                 :            :   pob food;
     456                 :            : 
     457                 :          0 :   print1("Commandant Sonder's Rampart-fried Lyzzard partes. Open 24 hrs.");
     458                 :          0 :   print2("Buy a bucket! Only 5 Au. Make a purchase? [yn] ");
     459                 :            : 
     460         [ #  # ]:          0 :   if ('y' == ynq2())
     461                 :            :     {
     462                 :          0 :       clearmsg();
     463                 :          0 :       num = (int)parsenum("How many?");
     464                 :            : 
     465         [ #  # ]:          0 :       if (num < 1)
     466                 :          0 :         print3("Cute. Real cute.");
     467         [ #  # ]:          0 :       else if (num*5 > Player.cash)
     468                 :          0 :         print3("No handouts here, mac!");
     469                 :            :       else
     470                 :            :         {
     471                 :          0 :           Player.cash -= num*5;
     472                 :          0 :           food = (pob)checkmalloc(sizeof(objtype));
     473                 :          0 :           *food = Objects[OB_RATION]; /* food ration */
     474                 :          0 :           food->number = num;
     475                 :            : 
     476         [ #  # ]:          0 :           if (1 == num)
     477                 :          0 :             print2("There you go, mac! One Lyzzard Bucket, coming up.");
     478         [ #  # ]:          0 :           else if (2 == num)
     479                 :          0 :             print2("Here you are! A couple of Lyzzard Buckets, steamin' hot.");
     480                 :            :           else
     481                 :          0 :             print2("A passel of Lyzzard Buckets, for your pleasure.");
     482                 :            : 
     483                 :          0 :           morewait();
     484                 :          0 :           gain_item(food);
     485                 :            :         }
     486                 :            :     }
     487                 :          0 :   else print2("Don't blame the Commandant if you starve!");
     488                 :          0 : }
     489                 :            : 
     490                 :            : 
     491                 :          0 : void l_diner(void)
     492                 :            : {
     493                 :          0 :   print1("The Rampart Diner. All you can eat, 25Au.");
     494                 :          0 :   print2("Place an order? [yn] ");
     495         [ #  # ]:          0 :   if (ynq2()=='y') {
     496         [ #  # ]:          0 :     if (Player.cash < 25)
     497                 :          0 :       mprint("TANSTAAFL! Now git!");
     498                 :            :     else {
     499                 :          0 :       Player.cash -= 25;
     500                 :          0 :       dataprint();
     501                 :          0 :       Player.food = 44;
     502                 :          0 :       foodcheck();
     503                 :            :     }
     504                 :            :   }
     505                 :          0 : }
     506                 :            : 
     507                 :          0 : void l_crap(void)
     508                 :            : {
     509                 :          0 :   print1("Les Crapeuleaux. (****) ");
     510 [ #  # ][ #  # ]:          0 :   if ((hour() < 17) || (hour() > 23))
     511                 :          0 :     print2 ("So sorry, we are closed 'til the morrow...");
     512                 :            :   else {
     513                 :          0 :     print2("May I take your order? [yn] ");
     514         [ #  # ]:          0 :     if (ynq2()=='y') {
     515         [ #  # ]:          0 :       if (Player.cash < 1000)
     516                 :          0 :         print2("So sorry, you have not the funds for dinner.");
     517                 :            :       else {
     518                 :          0 :         print2("Hope you enjoyed your tres expensive meal, m'sieur...");
     519                 :          0 :         Player.cash -= 1000;
     520                 :          0 :         dataprint();
     521                 :          0 :         Player.food += 8;
     522                 :          0 :         foodcheck();
     523                 :            :       }
     524                 :            :     }
     525                 :            :   }
     526                 :          0 : }
     527                 :            : 
     528                 :          0 : void l_tavern(void)
     529                 :            : {
     530                 :            :   char response;
     531                 :          0 :   print1("The Centaur and Nymph -- J. Riley, prop.");
     532         [ #  # ]:          0 :   if (nighttime()) {
     533                 :          0 :     menuclear();
     534                 :          0 :     menuprint("Riley says: Whataya have?\n\n");
     535                 :          0 :     menuprint("a: Pint of Riley's ultra-dark 1Au\n");
     536                 :          0 :     menuprint("b: Shot of Tullimore Dew 10Au\n");
     537                 :          0 :     menuprint("c: Round for the House. 100Au\n");
     538                 :          0 :     menuprint("d: Bed and Breakfast. 25Au\n");
     539                 :          0 :     menuprint("ESCAPE: Leave this comfortable haven.\n");
     540                 :          0 :     showmenu();
     541                 :          0 :     do response = (char) mcigetc();
     542         [ #  # ]:          0 :     while ((response != 'a') &&
     543         [ #  # ]:          0 :            (response != 'b') &&
     544         [ #  # ]:          0 :            (response != 'c') &&
     545         [ #  # ]:          0 :            (response != 'd') &&
     546         [ #  # ]:          0 :            (response != ESCAPE));
     547                 :            : /*    menuclear(); */
     548   [ #  #  #  #  :          0 :     switch (response) {
                      # ]
     549                 :            :     case 'a':
     550         [ #  # ]:          0 :       if (Player.cash < 1)
     551                 :          0 :         print2("Aw hell, have one on me.");
     552                 :            :       else {
     553                 :          0 :         Player.cash -= 1;
     554                 :          0 :         Time += 10;
     555                 :          0 :         timeprint();
     556                 :          0 :         dataprint();
     557         [ #  # ]:          0 :         if (tavern_hinthour == -1)  /* first time... */
     558                 :            :         {
     559                 :          0 :           print1("A seedy looking character approaches you.");
     560         [ #  # ]:          0 :           if (Player.rank[THIEVES] > 0 )
     561                 :            :           {
     562                 :          0 :              nprint1("  He appears to recognise you, somehow.");
     563         [ #  # ]:          0 :              if (! CitySiteList[L_BROTHEL-CITYSITEBASE][0])
     564                 :            :              {
     565                 :          0 :                print2("He nudge-nudges you, and says, 'You should visit the House of the Eclipse'");
     566                 :          0 :                CitySiteList[L_BROTHEL-CITYSITEBASE][0] = TRUE;
     567                 :            :              }
     568                 :            :              else 
     569                 :          0 :                print2("He says, 'Did you enjoy your visit to the House of the Eclipse?', wink-wink.");
     570                 :          0 :              morewait();
     571                 :            :           } 
     572                 :            :           else
     573                 :            :           {
     574                 :          0 :              print2("He offers to sell you some information for 10Au.");
     575                 :          0 :              nprint2("Do you pay him? [yn]");
     576         [ #  # ]:          0 :              if ( ynq2() == 'y' )
     577                 :            :              {
     578                 :            :                /*clearmsg();*/
     579         [ #  # ]:          0 :                if ( Player.cash < 10 )
     580                 :            :                {
     581                 :          0 :                  print1("'You loser.'");
     582                 :          0 :                  print2("He steals the rest of your money.");
     583                 :          0 :                  Player.cash = 0;
     584                 :            :                } 
     585                 :            :                else
     586                 :            :                {
     587                 :          0 :                  Player.cash -= 10;
     588                 :          0 :                  print1("He tells you how to find the thieves's guild");
     589                 :          0 :                  print2("and how to find the House of the Eclipse.");
     590                 :          0 :                  CitySiteList[L_BROTHEL-CITYSITEBASE][0] = TRUE;
     591                 :          0 :                  CitySiteList[L_THIEVES_GUILD-CITYSITEBASE][0] = TRUE;
     592                 :            :                }
     593                 :          0 :                dataprint();
     594                 :            :              }
     595                 :            :           }
     596                 :          0 :           tavern_hinthour = hour();
     597                 :            :         } else    /* not first time visit */
     598         [ #  # ]:          0 :         if (tavern_hinthour!=hour()) {
     599         [ #  # ]:          0 :           if (random_range(3)) {
     600                 :          0 :             print1("You overhear a rumor...");
     601                 :          0 :             hint();
     602                 :            :           }
     603                 :          0 :           else print1("You don't hear much of interest.");
     604                 :          0 :           tavern_hinthour = hour();
     605                 :            :         }
     606                 :          0 :         else print1("You just hear the same conversations again.");
     607                 :            :       }
     608                 :          0 :       Time += 20;
     609                 :          0 :       break;
     610                 :            :     case 'b':
     611         [ #  # ]:          0 :       if (Player.cash < 10)
     612                 :          0 :         print2("I don't serve the Dew on no tab, buddy!");
     613                 :            :       else {
     614                 :          0 :         Player.cash -= 10;
     615                 :          0 :         print1("Ahhhhh....");
     616 [ #  # ][ #  # ]:          0 :         if (Player.status[POISONED] || Player.status[DISEASED])
     617                 :          0 :           print2("Phew! That's, er, smooth stuff!");
     618                 :          0 :         Player.status[POISONED] = 0;
     619                 :          0 :         Player.status[DISEASED] = 0;
     620                 :          0 :         Time +=5;
     621                 :          0 :         showflags();
     622                 :            :       }
     623                 :          0 :       break;
     624                 :            :     case 'c':
     625         [ #  # ]:          0 :       if (Player.cash < 100) {
     626                 :          0 :         print1("Whatta feeb!");
     627                 :          0 :         print2("Outta my establishment.... Now!");
     628                 :          0 :         p_damage(random_range(20),UNSTOPPABLE,"Riley's right cross");
     629                 :          0 :         morewait();
     630                 :            :       }
     631                 :            :       else {
     632                 :          0 :         Player.cash -= 100;
     633                 :          0 :         dataprint();
     634                 :          0 :         print1("'What a guy!'"); morewait();
     635                 :          0 :         print2("'Hey, thanks, fella.'"); morewait();
     636                 :          0 :         print3("'Make mine a double...'"); morewait();
     637                 :          0 :         clearmsg();
     638   [ #  #  #  #  :          0 :         switch(random_range(4)) {
                      # ]
     639                 :            :         case 0:
     640                 :          0 :           print1("'You're a real pal. Say, have you heard.... ");
     641                 :          0 :           hint();
     642                 :          0 :           break;
     643                 :            :         case 1:
     644                 :          0 :           print1("A wandering priest of Dionysus blesses you...");
     645 [ #  # ][ #  # ]:          0 :           if ((Player.patron == ODIN) || (Player.patron == ATHENA))
     646                 :          0 :             Player.alignment++;
     647 [ #  # ][ #  # ]:          0 :           else if ((Player.patron == HECATE) || (Player.patron == SET))
     648                 :          0 :             Player.alignment--;
     649         [ #  # ]:          0 :           else if (Player.alignment > 0) Player.alignment--;
     650                 :          0 :           else Player.alignment++;
     651                 :          0 :           break;
     652                 :            :         case 2:
     653                 :          0 :           print1("A thirsty bard promises to put your name in a song!");
     654                 :          0 :           gain_experience(20);
     655                 :          0 :           break;
     656                 :            :         case 3:
     657                 :          0 :           print1("Riley draws you a shot of his 'special reserve'");
     658                 :          0 :           print2("Drink it [yn]?");
     659         [ #  # ]:          0 :           if (ynq2()=='y') {
     660         [ #  # ]:          0 :             if (Player.con < random_range(20)) {
     661                 :          0 :               print1("<cough> Quite a kick!");
     662                 :          0 :               print2("You feel a fiery warmth in your tummy....");
     663                 :          0 :               Player.con++;
     664                 :          0 :               Player.maxcon++;
     665                 :            :             }
     666                 :          0 :             else print2("You toss it back nonchalantly.");
     667                 :            :           }
     668                 :            :         }               
     669                 :            :       }
     670                 :          0 :       Time += 30;
     671                 :          0 :       break;
     672                 :            :     case 'd':
     673         [ #  # ]:          0 :       if (Player.cash < 25)
     674                 :          0 :         print2("Pay in advance, mac!");
     675                 :            :       else {
     676                 :          0 :         Player.cash -= 25;
     677                 :          0 :         print2("How about a shot o' the dew for a nightcap?");
     678                 :          0 :         morewait();
     679                 :          0 :         Time += (6+random_range(4)) * 60;
     680                 :          0 :         Player.status[POISONED] = 0;
     681                 :          0 :         Player.status[DISEASED] = 0;
     682                 :          0 :         Player.food = 40;
     683                 :            :         /* reduce temporary stat gains to max stat levels */
     684                 :          0 :         toggle_item_use(TRUE);
     685                 :          0 :         Player.str = min(Player.str,Player.maxstr);
     686                 :          0 :         Player.con = min(Player.con,Player.maxcon);
     687                 :          0 :         Player.agi = min(Player.agi,Player.maxagi);
     688                 :          0 :         Player.dex = min(Player.dex,Player.maxdex);
     689                 :          0 :         Player.iq = min(Player.iq,Player.maxiq);
     690                 :          0 :         Player.pow = min(Player.pow,Player.maxpow);
     691                 :          0 :         toggle_item_use(FALSE);
     692                 :          0 :         timeprint();
     693                 :          0 :         dataprint();
     694                 :          0 :         showflags();
     695                 :          0 :         print1("The next day.....");
     696         [ #  # ]:          0 :         if (hour() > 10) print2("Oh my! You overslept!");
     697                 :            :       }
     698                 :          0 :       break;
     699                 :            :     default:
     700                 :          0 :       print2("So? Just looking? Go on!");
     701                 :          0 :       break;
     702                 :            :     }
     703                 :            :   }
     704                 :          0 :   else print2("The pub don't open til dark, fella.");
     705                 :          0 :   xredraw();
     706                 :          0 : }
     707                 :            : 
     708                 :            : 
     709                 :          0 : void l_alchemist(void)
     710                 :            : {
     711                 :          0 :   int i,done=FALSE,mlevel;
     712                 :            :   char response;
     713                 :            :   pob obj;
     714                 :          0 :   print1("Ambrosias' Potions et cie.");
     715         [ #  # ]:          0 :   if (nighttime()) 
     716                 :          0 :     print2("Ambrosias doesn't seem to be in right now.");
     717         [ #  # ]:          0 :   else while (! done){
     718                 :          0 :     morewait();
     719                 :          0 :     clearmsg();
     720                 :          0 :     print1("a: Sell monster components.");
     721                 :          0 :     print2("b: Pay for transformation.");
     722                 :          0 :     print3("ESCAPE: Leave this place.");
     723                 :          0 :     response = (char) mcigetc();
     724         [ #  # ]:          0 :     if (response == 'a') {
     725                 :          0 :       clearmsg();
     726                 :          0 :       done = TRUE;
     727                 :          0 :       i = getitem(CORPSE);
     728 [ #  # ][ #  # ]:          0 :       if ((i != ABORT) && (Player.possessions[i] != NULL)){
     729                 :          0 :         obj = Player.possessions[i];
     730         [ #  # ]:          0 :         if (Monsters[obj->charge].transformid == -1) {
     731                 :          0 :           print1("I don't want such a thing.");
     732         [ #  # ]:          0 :           if (obj->basevalue > 0)
     733                 :          0 :             print2("You might be able to sell it to someone else, though.");
     734                 :            :         }
     735                 :            :         else {
     736                 :          0 :           clearmsg();
     737                 :          0 :           print1("I'll give you ");
     738                 :          0 :           mnumprint(obj->basevalue/3);
     739                 :          0 :           nprint1("Au for it. Take it? [yn] ");
     740         [ #  # ]:          0 :           if (ynq1()=='y') {
     741                 :          0 :             Player.cash += (obj->basevalue/3);
     742                 :          0 :             conform_lost_objects(1,obj);
     743                 :            :           }
     744                 :          0 :           else print2("Well, keep the smelly old thing, then!");
     745                 :            :         }
     746                 :            :       }
     747                 :          0 :       else print2("So nu?");
     748                 :            :     }
     749         [ #  # ]:          0 :     else if (response == 'b') {
     750                 :          0 :       clearmsg();
     751                 :          0 :       done = TRUE;
     752                 :          0 :       i = getitem(CORPSE);
     753 [ #  # ][ #  # ]:          0 :       if ((i != ABORT) && (Player.possessions[i] != NULL)){
     754                 :          0 :         obj = Player.possessions[i];
     755         [ #  # ]:          0 :         if (Monsters[obj->charge].transformid == -1)
     756                 :          0 :           print1("Oy vey! You want me to transform such a thing?");
     757                 :            :         else {
     758                 :          0 :           mlevel = Monsters[obj->charge].level;
     759                 :          0 :           print1("It'll cost you ");
     760                 :          0 :           mnumprint(max(10,obj->basevalue*2));
     761                 :          0 :           nprint1("Au for the transformation. Pay it? [yn] ");
     762         [ #  # ]:          0 :           if (ynq1()=='y') {
     763         [ #  # ]:          0 :             if (Player.cash < max(10,obj->basevalue*2))
     764                 :          0 :               print2("You can't afford it!");
     765                 :            :             else {
     766                 :          0 :               print1("Voila! A tap of the Philosopher's Stone...");
     767                 :          0 :               Player.cash -= max(10,obj->basevalue*2);
     768                 :          0 :               *obj = Objects[Monsters[obj->charge].transformid];
     769 [ #  # ][ #  # ]:          0 :               if ((obj->id >= STICKID) && (obj->id < STICKID+NUMSTICKS))
     770                 :          0 :                 obj->charge = 20;
     771         [ #  # ]:          0 :               if (obj->plus == 0) obj->plus = mlevel;
     772         [ #  # ]:          0 :               if (obj->blessing == 0) obj->blessing = 1;
     773                 :            :             }
     774                 :            :           }
     775                 :          0 :           else print2("I don't need your business, anyhow.");
     776                 :            :         }
     777                 :            :       }
     778                 :          0 :       else print2("So nu?");
     779                 :            :     }
     780                 :          0 :     else done = TRUE;
     781                 :            :   }
     782                 :          0 : }
     783                 :            : 
     784                 :          0 : void l_dpw(void)
     785                 :            : {
     786                 :          0 :   print1("Rampart Department of Public Works.");
     787                 :            : 
     788         [ #  # ]:          0 :   if (Date - LastDay < 7)
     789                 :          0 :     print2("G'wan! Get a job!");
     790         [ #  # ]:          0 :   else if (Player.cash < 100)
     791                 :            :     {
     792                 :          0 :       morewait();
     793         [ #  # ]:          0 :       if ('y' == cinema_confirm("The clerk hands you government aid applications."))
     794                 :            :         {
     795                 :          0 :           print1("Well, ok, but spend it wisely.");
     796                 :          0 :           morewait();
     797                 :          0 :           print1("Please enter your name for our records:");
     798                 :          0 :           strcpy(Str1, msgscanstring());
     799                 :            : 
     800 [ #  # ][ #  # ]:          0 :           if (Str1[0] >= 'a' && Str1[0] <= 'z')
     801                 :          0 :             Str1[0] += 'A' - 'a';
     802                 :            : 
     803         [ #  # ]:          0 :           if (Str1[0] == '\0')
     804                 :          0 :             print1("Maybe you should come back when you've learned to write.");
     805         [ #  # ]:          0 :           else if (strcmp(Player.name,Str1) != 0)
     806                 :            :             {
     807                 :          0 :               print3("Aha! Welfare Fraud! It's off to gaol for you, lout!");
     808                 :          0 :               morewait();
     809                 :          0 :               send_to_jail();
     810                 :            :             }
     811                 :            :           else
     812                 :            :             {
     813                 :          0 :               print2("Here's your handout, layabout!");
     814                 :          0 :               LastDay = Date;
     815                 :          0 :               Player.cash = 99;
     816                 :          0 :               dataprint();
     817                 :            :             }
     818                 :            :         }
     819                 :            :     }
     820                 :          0 :   else print2("You're too well off for us to help you!");
     821                 :          0 : }
     822                 :            : 
     823                 :          0 : void l_library(void)
     824                 :            : {
     825                 :            :   char response;
     826                 :          0 :   int studied=FALSE;
     827                 :          0 :   int done=FALSE,fee = 1000;
     828                 :          0 :   print1("Rampart Public Library.");
     829         [ #  # ]:          0 :   if (nighttime())
     830                 :          0 :     print2("CLOSED");
     831                 :            :   else {
     832                 :          0 :     morewait();
     833                 :          0 :     print1("Library Research Fee: 1000Au.");
     834         [ #  # ]:          0 :     if (Player.maxiq < 18) {
     835                 :          0 :       print2("The Rampart student aid system has arranged a grant!");
     836                 :          0 :       morewait();
     837                 :          0 :       clearmsg();
     838                 :          0 :       print1("Your revised fee is: ");
     839                 :          0 :       mnumprint(fee=max(50,1000-(18-Player.maxiq)*125));
     840                 :          0 :       nprint1("Au.");
     841                 :            :     }
     842                 :          0 :     morewait();
     843         [ #  # ]:          0 :     while(! done) {
     844                 :          0 :       print1("Pay the fee? [yn] ");
     845         [ #  # ]:          0 :       if (ynq1()=='y') {
     846         [ #  # ]:          0 :         if (Player.cash < fee) {
     847                 :          0 :           print2("No payee, No studee.");
     848                 :          0 :           done = TRUE;
     849                 :            :         }
     850                 :            :         else {
     851                 :          0 :           Player.cash -= fee;
     852                 :            :           do {
     853                 :          0 :             studied = TRUE;
     854                 :          0 :             dataprint();
     855                 :          0 :             menuclear();
     856                 :          0 :             menuprint("Peruse a scroll:\n");
     857                 :          0 :             menuprint("a: Omegan Theology\n");
     858                 :          0 :             menuprint("b: Guide to Rampart\n");
     859                 :          0 :             menuprint("c: High Magick\n");
     860                 :          0 :             menuprint("d: Odd Uncatalogued Document\n");
     861                 :          0 :             menuprint("e: Attempt Advanced Research\n");
     862                 :          0 :             menuprint("ESCAPE: Leave this font of learning.\n");
     863                 :          0 :             showmenu();
     864                 :          0 :             response = (char) mcigetc();
     865         [ #  # ]:          0 :             if (response == 'a') {
     866                 :          0 :               print1("You unfurl an ancient, yellowing scroll...");
     867                 :          0 :               morewait();
     868                 :          0 :               theologyfile();
     869                 :            :             }
     870         [ #  # ]:          0 :             else if (response == 'b') {
     871                 :          0 :               print1("You unroll a slick four-color document...");
     872                 :          0 :               morewait();
     873                 :          0 :               cityguidefile();
     874                 :            :             }
     875         [ #  # ]:          0 :             else if (response == 'c') {
     876                 :          0 :               print1("This scroll is written in a strange magical script...");
     877                 :          0 :               morewait();
     878                 :          0 :               wishfile();
     879                 :            :             }
     880         [ #  # ]:          0 :             else if (response == 'd') {
     881                 :          0 :               print1("You find a strange document, obviously misfiled");
     882                 :          0 :               print2("under the heading 'acrylic fungus painting technique'");
     883                 :          0 :               morewait();
     884                 :          0 :               adeptfile();
     885                 :            :             }
     886         [ #  # ]:          0 :             else if (response == 'e') {
     887         [ #  # ]:          0 :               if (random_range(30) > Player.iq)  {
     888                 :          0 :                 print2("You feel more knowledgeable!");
     889                 :          0 :                 Player.iq++;
     890                 :          0 :                 Player.maxiq++;
     891                 :          0 :                 dataprint();
     892 [ #  # ][ #  # ]:          0 :                 if (Player.maxiq < 19 &&
     893                 :          0 :                   fee != max(50,1000-(18-Player.maxiq)*125))
     894                 :            :                   {
     895                 :          0 :                     morewait();
     896                 :          0 :                     clearmsg();
     897                 :          0 :                     print1("Your revised fee is: ");
     898                 :          0 :                     mnumprint(fee=max(50,1000-(18-Player.maxiq)*125));
     899                 :          0 :                     nprint1("Au.");
     900                 :          0 :                     morewait();
     901                 :            :                   }
     902                 :            :               }
     903                 :            :               else {
     904                 :          0 :                 clearmsg1();
     905                 :          0 :                 print1("You find advice in an ancient tome: ");
     906                 :          0 :                 morewait();
     907                 :          0 :                 hint();
     908                 :          0 :                 morewait();
     909                 :            :               }
     910                 :            :             }
     911         [ #  # ]:          0 :             else if (response == ESCAPE) {
     912                 :          0 :               done = TRUE;
     913                 :          0 :               print1("That was an expensive browse...");
     914                 :            :             }
     915                 :            :             else
     916                 :          0 :               studied = FALSE;
     917         [ #  # ]:          0 :           } while (!studied);
     918                 :            :         }
     919                 :          0 :       xredraw();
     920                 :            :       }
     921                 :            :       else {
     922                 :          0 :         done = TRUE;
     923         [ #  # ]:          0 :         if (studied)
     924                 :          0 :           print2("Come back anytime we're open, 7am to 8pm.");
     925                 :            :         else
     926                 :          0 :           print2("You philistine!");
     927                 :            :       }
     928                 :            :     }
     929                 :            :   }
     930                 :          0 : }
     931                 :            : 
     932                 :            : 
     933                 :          1 : void l_pawn_shop(void)
     934                 :            : {
     935                 :          1 :   int i,j,k,limit,number,done = FALSE;
     936                 :            :   char item,action;
     937                 :            : 
     938         [ -  + ]:          1 :   if (nighttime())
     939                 :          0 :     print1("Shop Closed: Have a Nice (K)Night");
     940                 :            :   else {
     941                 :          1 :     limit = min(5,Date-Pawndate);
     942                 :          1 :     Pawndate = Date;
     943         [ +  + ]:          6 :     for(k=0;k<limit;k++) {
     944         [ +  - ]:          5 :       if (Pawnitems[0] != NULL) {
     945         [ -  + ]:          5 :         if (Objects[Pawnitems[0]->id].uniqueness > UNIQUE_UNMADE)
     946                 :          0 :           Objects[Pawnitems[0]->id].uniqueness = UNIQUE_UNMADE;
     947                 :            :           /* could turn up anywhere, really :) */
     948                 :          5 :         free_obj( Pawnitems[0], TRUE );
     949                 :          5 :         Pawnitems[0] = NULL;
     950                 :            :       }
     951         [ +  + ]:        100 :       for (i=0;i<PAWNITEMS-1;i++)
     952                 :         95 :         Pawnitems[i] = Pawnitems[i+1];
     953                 :          5 :       Pawnitems[PAWNITEMS-1] = NULL;
     954         [ +  + ]:        105 :       for (i=0;i<PAWNITEMS;i++)
     955         [ +  + ]:        100 :         if (Pawnitems[i] == NULL)
     956                 :            :           do {
     957         [ +  + ]:          6 :             if (Pawnitems[i] != NULL)
     958                 :          1 :               free_obj( Pawnitems[i], TRUE );
     959                 :          6 :             Pawnitems[i] = create_object(5);
     960                 :          6 :             Pawnitems[i]->known = 2;
     961         [ -  + ]:          6 :           } while ((Pawnitems[i]->objchar == CASH) ||
     962         [ +  + ]:          6 :                    (Pawnitems[i]->objchar == ARTIFACT) ||
     963         [ -  + ]:         12 :                    (true_item_value(Pawnitems[i]) <= 0));
     964                 :            :     }
     965         [ +  + ]:          7 :     while (! done) {
     966                 :          6 :       print1("Knight's Pawn Shop:");
     967                 :          6 :       print2("Buy item, Sell item, sell Pack contents, Leave [b,s,p,ESCAPE] ");
     968                 :          6 :       menuclear();
     969         [ +  + ]:        126 :       for(i=0;i<PAWNITEMS;i++) 
     970         [ +  - ]:        120 :         if (Pawnitems[i] != NULL) {
     971                 :        120 :           strcpy(Str3," :");
     972                 :        120 :           Str3[0] = i+'a';
     973                 :        120 :           strcat(Str3,itemid(Pawnitems[i]));
     974                 :        120 :           menuprint(Str3);
     975                 :        120 :           menuprint("\n");
     976                 :            :         }
     977                 :          6 :       showmenu();
     978                 :          6 :       action = (char) mcigetc();
     979         [ +  + ]:          6 :       if (action == ESCAPE) 
     980                 :          1 :         done = TRUE;
     981         [ +  + ]:          5 :       else if (action == 'b') {
     982                 :          1 :         print2("Purchase which item? [ESCAPE to quit] ");
     983                 :          1 :         item = ' ';
     984 [ +  + ][ +  - ]:          2 :         while ((item != ESCAPE) &&
     985         [ #  # ]:          0 :                ((item < 'a') || (item >= 'a' + PAWNITEMS)))
     986                 :          1 :           item = (char) mcigetc();
     987         [ -  + ]:          1 :         if (item != ESCAPE) {
     988                 :          0 :           i = item - 'a';
     989         [ #  # ]:          0 :           if (Pawnitems[i] == NULL) print3("No such item!");
     990         [ #  # ]:          0 :           else if (true_item_value(Pawnitems[i]) <= 0) {
     991                 :          0 :             print1("Hmm, how did that junk get on my shelves?");
     992                 :          0 :             print2("I'll just remove it.");
     993                 :          0 :             free_obj( Pawnitems[i], TRUE );
     994                 :          0 :             Pawnitems[i] = NULL;
     995                 :            :           }
     996                 :            :           else {
     997                 :          0 :             clearmsg();
     998                 :          0 :             print1("The low, low, cost is: ");
     999                 :          0 :             mlongprint(Pawnitems[i]->number*true_item_value(Pawnitems[i]));
    1000                 :          0 :             nprint1(" Buy it? [ynq] ");
    1001         [ #  # ]:          0 :             if (ynq1() == 'y') {
    1002         [ #  # ]:          0 :               if (Player.cash < 
    1003                 :          0 :                   Pawnitems[i]->number *
    1004                 :          0 :                   true_item_value(Pawnitems[i])) {
    1005                 :          0 :                 print2("No credit! Gwan, Beat it!");
    1006                 :          0 :                 morewait();
    1007                 :            :               }
    1008                 :            :               else {
    1009                 :          0 :                 Player.cash -= 
    1010                 :          0 :                   Pawnitems[i]->number*
    1011                 :          0 :                     true_item_value(Pawnitems[i]);
    1012                 :          0 :                 Objects[Pawnitems[i]->id].known = 1;
    1013                 :          0 :                 gain_item(Pawnitems[i]);
    1014                 :          1 :                 Pawnitems[i] = NULL;
    1015                 :            :               }
    1016                 :            :             }
    1017                 :            :           }
    1018                 :            :         }
    1019                 :            :       }
    1020         [ +  - ]:          4 :       else if (action == 's') {
    1021                 :          4 :         menuclear();
    1022                 :          4 :         i = getitem_prompt("Sell which item: ", NULL_ITEM);
    1023 [ +  - ][ +  - ]:          4 :         if ((i != ABORT) && (Player.possessions[i] != NULL)) {
    1024         [ -  + ]:          4 :           if (cursed(Player.possessions[i])) {
    1025                 :          0 :             print1("No loans on cursed items! I been burned before....");
    1026                 :          0 :             morewait();
    1027                 :            :           }
    1028         [ -  + ]:          4 :           else if (true_item_value(Player.possessions[i]) <= 0) {
    1029                 :          0 :             print1("That looks like a worthless piece of junk to me.");
    1030                 :          0 :             morewait();
    1031                 :            :           }
    1032                 :            :           else {
    1033                 :          4 :             clearmsg();
    1034                 :          4 :             print1("You can get ");
    1035                 :          4 :             mlongprint(item_value(Player.possessions[i]) / 2);
    1036                 :          4 :             nprint1("Au each. Sell [yn]? ");
    1037         [ +  + ]:          4 :             if (ynq1() == 'y') {
    1038                 :          3 :               number = getnumber(Player.possessions[i]->number);
    1039 [ +  - ][ -  + ]:          3 :               if ((number >= Player.possessions[i]->number) &&
    1040                 :          3 :                   Player.possessions[i]->used) {
    1041                 :          0 :                 Player.possessions[i]->used = FALSE;
    1042                 :          0 :                 item_use(Player.possessions[i]);
    1043                 :            :               }
    1044                 :          3 :               Player.cash += number * item_value(Player.possessions[i]) / 2;
    1045                 :          3 :               free_obj( Pawnitems[0], TRUE );
    1046         [ +  + ]:         60 :               for(j=0;j<PAWNITEMS - 1;j++)
    1047                 :         57 :                 Pawnitems[j] = Pawnitems[j+1];
    1048                 :          3 :               Pawnitems[PAWNITEMS - 1] = copy_obj( Player.possessions[i] );
    1049                 :          3 :               Pawnitems[PAWNITEMS - 1]->number = number;
    1050                 :          3 :               Pawnitems[PAWNITEMS - 1]->known = 2;   
    1051                 :          3 :               dispose_lost_objects(number,Player.possessions[i]);
    1052                 :          4 :               dataprint();
    1053                 :            :             }
    1054                 :            :           }
    1055                 :            :         }
    1056                 :            :       }
    1057         [ #  # ]:          0 :       else if (action == 'p') {
    1058         [ #  # ]:          0 :         for(i=0;i<Player.packptr;i++) {
    1059   [ #  #  #  # ]:          0 :           if (Player.pack[i]->blessing > -1 &&
    1060                 :          0 :               true_item_value(Player.pack[i]) > 0) {
    1061                 :          0 :             clearmsg();
    1062                 :          0 :             print1("Sell ");
    1063                 :          0 :             nprint1(itemid(Player.pack[i]));
    1064                 :          0 :             nprint1(" for ");
    1065                 :          0 :             mlongprint(item_value(Player.pack[i])/2);
    1066                 :          0 :             nprint1("Au each? [yn] ");
    1067         [ #  # ]:          0 :             if (ynq1()=='y') {
    1068                 :          0 :               number = getnumber(Player.pack[i]->number);
    1069         [ #  # ]:          0 :               if (number > 0) {
    1070                 :          0 :                 Player.cash += number * item_value(Player.pack[i]) / 2;
    1071                 :          0 :                 free_obj( Pawnitems[0], TRUE );
    1072         [ #  # ]:          0 :                 for(j=0;j<PAWNITEMS - 1;j++)
    1073                 :          0 :                   Pawnitems[j] = Pawnitems[j+1];
    1074                 :          0 :                 Pawnitems[PAWNITEMS - 1] = copy_obj( Player.pack[i] );
    1075                 :          0 :                 Pawnitems[PAWNITEMS - 1]->number = number;
    1076                 :          0 :                 Pawnitems[PAWNITEMS - 1]->known = 2;
    1077                 :          0 :                 Player.pack[i]->number -= number;
    1078         [ #  # ]:          0 :                 if (Player.pack[i]->number < 1) {
    1079                 :          0 :                   free_obj( Player.pack[i], TRUE );
    1080                 :          0 :                   Player.pack[i] = NULL;
    1081                 :            :                 }
    1082                 :          0 :                 dataprint();
    1083                 :            :               }
    1084                 :            :             }
    1085                 :            :           }
    1086                 :            :         }
    1087                 :          0 :         fixpack();
    1088                 :            :       }
    1089                 :            :     }
    1090                 :            :   }
    1091                 :          1 :   calc_melee();
    1092                 :          1 :   xredraw();
    1093                 :          1 : }

Generated by: LCOV version 1.11