Annotation of researchv10no/games/rogue/armor.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * This file contains misc functions for dealing with armor
                      3:  * @(#)armor.c 3.9 (Berkeley) 6/15/81
                      4:  */
                      5: 
                      6: #include <curses.h>
                      7: #include "rogue.h"
                      8: 
                      9: /*
                     10:  * wear:
                     11:  *     The player wants to wear something, so let him/her put it on.
                     12:  */
                     13: 
                     14: wear()
                     15: {
                     16:     register struct linked_list *item;
                     17:     register struct object *obj;
                     18: 
                     19:     if (cur_armor != NULL)
                     20:     {
                     21:        addmsg("You are already wearing some");
                     22:        if (!terse)
                     23:            addmsg(".  You'll have to take it off first");
                     24:        endmsg();
                     25:        after = FALSE;
                     26:        return;
                     27:     }
                     28:     if ((item = get_item("wear", ARMOR)) == NULL)
                     29:        return;
                     30:     obj = (struct object *) ldata(item);
                     31:     if (obj->o_type != ARMOR)
                     32:     {
                     33:        msg("You can't wear that.");
                     34:        return;
                     35:     }
                     36:     waste_time();
                     37:     if (!terse)
                     38:        addmsg("You are now w");
                     39:     else
                     40:        addmsg("W");
                     41:     msg("earing %s.", a_names[obj->o_which]);
                     42:     cur_armor = obj;
                     43:     obj->o_flags |= ISKNOW;
                     44: }
                     45: 
                     46: /*
                     47:  * take_off:
                     48:  *     Get the armor off of the players back
                     49:  */
                     50: 
                     51: take_off()
                     52: {
                     53:     register struct object *obj;
                     54: 
                     55:     if ((obj = cur_armor) == NULL)
                     56:     {
                     57:        if (terse)
                     58:                msg("Not wearing armor");
                     59:        else
                     60:                msg("You aren't wearing any armor");
                     61:        return;
                     62:     }
                     63:     if (!dropcheck(cur_armor))
                     64:        return;
                     65:     cur_armor = NULL;
                     66:     if (terse)
                     67:        addmsg("Was");
                     68:     else
                     69:        addmsg("You used to be ");
                     70:     msg(" wearing %c) %s", pack_char(obj), inv_name(obj, TRUE));
                     71: }
                     72: 
                     73: /*
                     74:  * waste_time:
                     75:  *     Do nothing but let other things happen
                     76:  */
                     77: 
                     78: waste_time()
                     79: {
                     80:     do_daemons(BEFORE);
                     81:     do_fuses(BEFORE);
                     82:     do_daemons(AFTER);
                     83:     do_fuses(AFTER);
                     84: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.