- Added unlimited fountains and containers (Thanks Adam Scriven).

- Removed object types MISSILE and FIRE WEAPON.
--Rumble
This commit is contained in:
Rumble 2007-03-30 12:55:33 +00:00
parent 7f65248b2a
commit 140fcc2be1
16 changed files with 234 additions and 298 deletions

View file

@ -308,7 +308,7 @@ void look_at_char(struct char_data *i, struct char_data *ch)
void list_one_char(struct char_data *i, struct char_data *ch)
{
struct obj_data *chair;
struct obj_data *furniture;
const char *positions[] = {
" is lying here, dead.",
" is lying here, mortally wounded.",
@ -366,10 +366,10 @@ void list_one_char(struct char_data *i, struct char_data *ch)
if (!SITTING(i))
send_to_char(ch, "%s", positions[(int) GET_POS(i)]);
else {
chair = SITTING(i);
send_to_char(ch, " is %s upon %s.", ((GET_POS(i) == POS_SITTING) ?
"sitting" : "resting"), (CAN_SEE_OBJ(ch, chair) ?
chair->short_description : "something"));
furniture = SITTING(i);
send_to_char(ch, " is %s upon %s.", ((GET_POS(i) == POS_SLEEPING) ?
"sleeping" : "sitting"), (CAN_SEE_OBJ(ch, furniture) ?
furniture->short_description : "something"));
}
} else {
if (FIGHTING(i)) {
@ -564,9 +564,15 @@ void look_in_obj(struct char_data *ch, char *arg)
if (GET_OBJ_VAL(obj, 1) <= 0)
send_to_char(ch, "It is empty.\r\n");
else {
if (GET_OBJ_VAL(obj,0) <= 0 || GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0)) {
send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */
} else {
if (GET_OBJ_VAL(obj, 0) < 0)
{
char buf2[MAX_STRING_LENGTH];
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
send_to_char(ch, "It's full of a %s liquid.\r\n", buf2);
}
else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0))
send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */
else {
char buf2[MAX_STRING_LENGTH];
amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0);
sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2));
@ -822,8 +828,8 @@ ACMD(do_score)
if (!SITTING(ch))
send_to_char(ch, "You are sitting.\r\n");
else {
struct obj_data *chair = SITTING(ch);
send_to_char(ch, "You are sitting upon %s.\r\n", chair->short_description);
struct obj_data *furniture = SITTING(ch);
send_to_char(ch, "You are sitting upon %s.\r\n", furniture->short_description);
}
break;
case POS_FIGHTING:

View file

@ -10,7 +10,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -54,9 +53,7 @@ ACMD(do_wear);
ACMD(do_wield);
ACMD(do_grab);
void perform_put(struct char_data *ch, struct obj_data *obj,
struct obj_data *cont)
void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_data *cont)
{
if (!drop_otrigger(obj, ch))
@ -65,7 +62,8 @@ void perform_put(struct char_data *ch, struct obj_data *obj,
if (!obj) /* object might be extracted by drop_otrigger */
return;
if (GET_OBJ_WEIGHT(cont) + GET_OBJ_WEIGHT(obj) > GET_OBJ_VAL(cont, 0))
if ((GET_OBJ_VAL(cont, 0) > 0) &&
(GET_OBJ_WEIGHT(cont) + GET_OBJ_WEIGHT(obj) > GET_OBJ_VAL(cont, 0)))
act("$p won't fit in $P.", FALSE, ch, obj, cont, TO_CHAR);
else if (OBJ_FLAGGED(obj, ITEM_NODROP) && IN_ROOM(cont) != NOWHERE)
act("You can't get $p out of your hand.", FALSE, ch, obj, NULL, TO_CHAR);
@ -85,17 +83,12 @@ void perform_put(struct char_data *ch, struct obj_data *obj,
}
}
/* The following put modes are supported by the code below:
1) put <object> <container>
2) put all.<object> <container>
3) put all <container>
<container> must be in inventory or on ground.
all objects to be put into container must be in inventory.
*/
/* The following put modes are supported:
1) put <object> <container>
2) put all.<object> <container>
3) put all <container>
The <container> must be in inventory or on ground. All objects to be put
into container must be in inventory. */
ACMD(do_put)
{
char arg1[MAX_INPUT_LENGTH];
@ -169,8 +162,6 @@ ACMD(do_put)
}
}
int can_take_obj(struct char_data *ch, struct obj_data *obj)
{
if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)) {
@ -186,7 +177,6 @@ int can_take_obj(struct char_data *ch, struct obj_data *obj)
return (1);
}
void get_check_money(struct char_data *ch, struct obj_data *obj)
{
int value = GET_OBJ_VAL(obj, 0);
@ -204,7 +194,6 @@ void get_check_money(struct char_data *ch, struct obj_data *obj)
send_to_char(ch, "There were %d coins.\r\n", value);
}
void perform_get_from_container(struct char_data *ch, struct obj_data *obj,
struct obj_data *cont, int mode)
{
@ -221,7 +210,6 @@ void perform_get_from_container(struct char_data *ch, struct obj_data *obj,
}
}
void get_from_container(struct char_data *ch, struct obj_data *cont,
char *arg, int mode, int howmany)
{
@ -272,7 +260,6 @@ void get_from_container(struct char_data *ch, struct obj_data *cont,
}
}
int perform_get_from_room(struct char_data *ch, struct obj_data *obj)
{
if (can_take_obj(ch, obj) && get_otrigger(obj, ch)) {
@ -286,7 +273,6 @@ int perform_get_from_room(struct char_data *ch, struct obj_data *obj)
return (0);
}
void get_from_room(struct char_data *ch, char *arg, int howmany)
{
struct obj_data *obj, *next_obj;
@ -327,8 +313,6 @@ void get_from_room(struct char_data *ch, char *arg, int howmany)
}
}
ACMD(do_get)
{
char arg1[MAX_INPUT_LENGTH];
@ -351,8 +335,8 @@ ACMD(do_get)
int amount = 1;
if (is_number(arg1)) {
amount = atoi(arg1);
strcpy(arg1, arg2); /* strcpy: OK (sizeof: arg1 == arg2) */
strcpy(arg2, arg3); /* strcpy: OK (sizeof: arg2 == arg3) */
strcpy(arg1, arg2); /* strcpy: OK (sizeof: arg1 == arg2) */
strcpy(arg2, arg3); /* strcpy: OK (sizeof: arg2 == arg3) */
}
cont_dotmode = find_all_dots(arg2);
if (cont_dotmode == FIND_INDIV) {
@ -400,9 +384,7 @@ ACMD(do_get)
}
}
void perform_drop_gold(struct char_data *ch, int amount,
byte mode, room_rnum RDR)
void perform_drop_gold(struct char_data *ch, int amount, byte mode, room_rnum RDR)
{
struct obj_data *obj;
@ -412,7 +394,7 @@ void perform_drop_gold(struct char_data *ch, int amount,
send_to_char(ch, "You don't have that many coins!\r\n");
else {
if (mode != SCMD_JUNK) {
WAIT_STATE(ch, PULSE_VIOLENCE); /* to prevent coin-bombing */
WAIT_STATE(ch, PULSE_VIOLENCE); /* to prevent coin-bombing */
obj = create_money(amount);
if (mode == SCMD_DONATE) {
send_to_char(ch, "You throw some gold into the air where it disappears in a puff of smoke!\r\n");
@ -446,10 +428,8 @@ void perform_drop_gold(struct char_data *ch, int amount,
}
}
#define VANISH(mode) ((mode == SCMD_DONATE || mode == SCMD_JUNK) ? \
" It vanishes in a puff of smoke!" : "")
int perform_drop(struct char_data *ch, struct obj_data *obj,
byte mode, const char *sname, room_rnum RDR)
{
@ -493,18 +473,14 @@ int perform_drop(struct char_data *ch, struct obj_data *obj,
return (value);
default:
log("SYSERR: Incorrect argument %d passed to perform_drop.", mode);
/* SYSERR_DESC:
* This error comes from perform_drop() and is output when perform_drop()
* is called with an illegal 'mode' argument.
*/
/* SYSERR_DESC: This error comes from perform_drop() and is output when
* perform_drop() is called with an illegal 'mode' argument. */
break;
}
return (0);
}
ACMD(do_drop)
{
char arg[MAX_INPUT_LENGTH];
@ -618,7 +594,6 @@ ACMD(do_drop)
}
}
void perform_give(struct char_data *ch, struct char_data *vict,
struct obj_data *obj)
{
@ -664,7 +639,6 @@ struct char_data *give_find_vict(struct char_data *ch, char *arg)
return (NULL);
}
void perform_give_gold(struct char_data *ch, struct char_data *vict,
int amount)
{
@ -693,7 +667,6 @@ void perform_give_gold(struct char_data *ch, struct char_data *vict,
bribe_mtrigger(vict, ch, amount);
}
ACMD(do_give)
{
char arg[MAX_STRING_LENGTH];
@ -713,7 +686,7 @@ ACMD(do_give)
if ((vict = give_find_vict(ch, arg)) != NULL)
perform_give_gold(ch, vict, amount);
return;
} else if (!*arg) /* Give multiple code. */
} else if (!*arg) /* Give multiple code. */
send_to_char(ch, "What do you want to give %d of?\r\n", amount);
else if (!(vict = give_find_vict(ch, argument)))
return;
@ -756,8 +729,6 @@ ACMD(do_give)
}
}
void weight_change_object(struct obj_data *obj, int weight)
{
struct obj_data *tmp_obj;
@ -775,15 +746,12 @@ void weight_change_object(struct obj_data *obj, int weight)
obj_to_obj(obj, tmp_obj);
} else {
log("SYSERR: Unknown attempt to subtract weight from an object.");
/* SYSERR_DESC:
* weight_change_object() outputs this error when weight is attempted to
* be removed from an object that is not carried or in another object.
*/
/* SYSERR_DESC: weight_change_object() outputs this error when weight is
* attempted to be removed from an object that is not carried or in
* another object. */
}
}
void name_from_drinkcon(struct obj_data *obj)
{
char *new_name, *cur_name, *next;
@ -796,11 +764,9 @@ void name_from_drinkcon(struct obj_data *obj)
liqname = drinknames[GET_OBJ_VAL(obj, 2)];
if (!isname(liqname, obj->name)) {
log("SYSERR: Can't remove liquid '%s' from '%s' (%d) item.", liqname, obj->name, obj->item_number);
/* SYSERR_DESC:
* From name_from_drinkcon(), this error comes about if the object
* noted (by keywords and item vnum) does not contain the liquid string
* being searched for.
*/
/* SYSERR_DESC: From name_from_drinkcon(), this error comes about if the
* object noted (by keywords and item vnum) does not contain the liquid
* string being searched for. */
return;
}
@ -820,8 +786,8 @@ void name_from_drinkcon(struct obj_data *obj)
continue;
if (*new_name)
strcat(new_name, " "); /* strcat: OK (size precalculated) */
strncat(new_name, cur_name, cpylen); /* strncat: OK (size precalculated) */
strcat(new_name, " "); /* strcat: OK (size precalculated) */
strncat(new_name, cur_name, cpylen); /* strncat: OK (size precalculated) */
}
if (GET_OBJ_RNUM(obj) == NOTHING || obj->name != obj_proto[GET_OBJ_RNUM(obj)].name)
@ -829,8 +795,6 @@ void name_from_drinkcon(struct obj_data *obj)
obj->name = new_name;
}
void name_to_drinkcon(struct obj_data *obj, int type)
{
char *new_name;
@ -839,7 +803,7 @@ void name_to_drinkcon(struct obj_data *obj, int type)
return;
CREATE(new_name, char, strlen(obj->name) + strlen(drinknames[type]) + 2);
sprintf(new_name, "%s %s", obj->name, drinknames[type]); /* sprintf: OK */
sprintf(new_name, "%s %s", obj->name, drinknames[type]); /* sprintf: OK */
if (GET_OBJ_RNUM(obj) == NOTHING || obj->name != obj_proto[GET_OBJ_RNUM(obj)].name)
free(obj->name);
@ -847,8 +811,6 @@ void name_to_drinkcon(struct obj_data *obj, int type)
obj->name = new_name;
}
ACMD(do_drink)
{
char arg[MAX_INPUT_LENGTH];
@ -859,7 +821,7 @@ ACMD(do_drink)
one_argument(argument, arg);
if (IS_NPC(ch)) /* Cannot use GET_COND() on mobs. */
if (IS_NPC(ch)) /* Cannot use GET_COND() on mobs. */
return;
if (!*arg) {
@ -921,11 +883,12 @@ ACMD(do_drink)
amount = MIN(amount, GET_OBJ_VAL(temp, 1));
/* You can't subtract more than the object weighs */
weight = MIN(amount, GET_OBJ_WEIGHT(temp));
weight_change_object(temp, -weight); /* Subtract amount */
/* You can't subtract more than the object weighs, unless its unlimited. */
if (GET_OBJ_VAL(temp, 0) > 0) {
weight = MIN(amount, GET_OBJ_WEIGHT(temp));
weight_change_object(temp, -weight); /* Subtract amount */
}
gain_condition(ch, DRUNK, drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK] * amount / 4);
gain_condition(ch, HUNGER, drink_aff[GET_OBJ_VAL(temp, 2)][HUNGER] * amount / 4);
gain_condition(ch, THIRST, drink_aff[GET_OBJ_VAL(temp, 2)][THIRST] * amount / 4);
@ -939,7 +902,7 @@ ACMD(do_drink)
if (GET_COND(ch, HUNGER) > 20)
send_to_char(ch, "You are full.\r\n");
if (GET_OBJ_VAL(temp, 3)) { /* The crap was poisoned ! */
if (GET_OBJ_VAL(temp, 3)) { /* The crap was poisoned ! */
send_to_char(ch, "Oops, it tasted rather strange!\r\n");
act("$n chokes and utters some strange sounds.", TRUE, ch, 0, 0, TO_ROOM);
@ -950,18 +913,18 @@ ACMD(do_drink)
af.bitvector = AFF_POISON;
affect_join(ch, &af, FALSE, FALSE, FALSE, FALSE);
}
/* empty the container, and no longer poison. */
GET_OBJ_VAL(temp, 1) -= amount;
if (!GET_OBJ_VAL(temp, 1)) { /* The last bit */
name_from_drinkcon(temp);
GET_OBJ_VAL(temp, 2) = 0;
GET_OBJ_VAL(temp, 3) = 0;
/* Empty the container (unless unlimited), and no longer poison. */
if (GET_OBJ_VAL(temp, 0) > 0) {
GET_OBJ_VAL(temp, 1) -= amount;
if (!GET_OBJ_VAL(temp, 1)) { /* The last bit */
name_from_drinkcon(temp);
GET_OBJ_VAL(temp, 2) = 0;
GET_OBJ_VAL(temp, 3) = 0;
}
}
return;
}
ACMD(do_eat)
{
char arg[MAX_INPUT_LENGTH];
@ -971,7 +934,7 @@ ACMD(do_eat)
one_argument(argument, arg);
if (IS_NPC(ch)) /* Cannot use GET_COND() on mobs. */
if (IS_NPC(ch)) /* Cannot use GET_COND() on mobs. */
return;
if (!*arg) {
@ -991,12 +954,12 @@ ACMD(do_eat)
send_to_char(ch, "You can't eat THAT!\r\n");
return;
}
if (GET_COND(ch, HUNGER) > 20) {/* Stomach full */
if (GET_COND(ch, HUNGER) > 20) { /* Stomach full */
send_to_char(ch, "You are too full to eat more!\r\n");
return;
}
if (!consume_otrigger(food, ch, OCMD_EAT)) /* check trigger */
if (!consume_otrigger(food, ch, OCMD_EAT)) /* check trigger */
return;
if (subcmd == SCMD_EAT) {
@ -1036,17 +999,16 @@ ACMD(do_eat)
}
}
ACMD(do_pour)
{
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
struct obj_data *from_obj = NULL, *to_obj = NULL;
int amount;
int amount = 0;
two_arguments(argument, arg1, arg2);
if (subcmd == SCMD_POUR) {
if (!*arg1) { /* No arguments */
if (!*arg1) { /* No arguments */
send_to_char(ch, "From what do you want to pour?\r\n");
return;
}
@ -1060,7 +1022,7 @@ ACMD(do_pour)
}
}
if (subcmd == SCMD_FILL) {
if (!*arg1) { /* no arguments */
if (!*arg1) { /* no arguments */
send_to_char(ch, "What do you want to fill? And what are you filling it from?\r\n");
return;
}
@ -1072,7 +1034,7 @@ ACMD(do_pour)
act("You can't fill $p!", FALSE, ch, to_obj, 0, TO_CHAR);
return;
}
if (!*arg2) { /* no 2nd argument */
if (!*arg2) { /* no 2nd argument */
act("What do you want to fill $p from?", FALSE, ch, to_obj, 0, TO_CHAR);
return;
}
@ -1089,21 +1051,25 @@ ACMD(do_pour)
act("The $p is empty.", FALSE, ch, from_obj, 0, TO_CHAR);
return;
}
if (subcmd == SCMD_POUR) { /* pour */
if (subcmd == SCMD_POUR) { /* pour */
if (!*arg2) {
send_to_char(ch, "Where do you want it? Out or in what?\r\n");
return;
}
if (!str_cmp(arg2, "out")) {
act("$n empties $p.", TRUE, ch, from_obj, 0, TO_ROOM);
act("You empty $p.", FALSE, ch, from_obj, 0, TO_CHAR);
if (GET_OBJ_VAL(from_obj, 0) > 0) {
act("$n empties $p.", TRUE, ch, from_obj, 0, TO_ROOM);
act("You empty $p.", FALSE, ch, from_obj, 0, TO_CHAR);
weight_change_object(from_obj, -GET_OBJ_VAL(from_obj, 1)); /* Empty */
weight_change_object(from_obj, -GET_OBJ_VAL(from_obj, 1)); /* Empty */
name_from_drinkcon(from_obj);
GET_OBJ_VAL(from_obj, 1) = 0;
GET_OBJ_VAL(from_obj, 2) = 0;
GET_OBJ_VAL(from_obj, 3) = 0;
name_from_drinkcon(from_obj);
GET_OBJ_VAL(from_obj, 1) = 0;
GET_OBJ_VAL(from_obj, 2) = 0;
GET_OBJ_VAL(from_obj, 3) = 0;
}
else
send_to_char(ch, "You can't possibly pour that container out!\r\n");
return;
}
@ -1121,8 +1087,8 @@ ACMD(do_pour)
send_to_char(ch, "A most unproductive effort.\r\n");
return;
}
if ((GET_OBJ_VAL(to_obj, 1) != 0) &&
(GET_OBJ_VAL(to_obj, 2) != GET_OBJ_VAL(from_obj, 2))) {
if ((GET_OBJ_VAL(to_obj, 0) < 0) ||
(!(GET_OBJ_VAL(to_obj, 1) < GET_OBJ_VAL(to_obj, 0)))) {
send_to_char(ch, "There is already another liquid in it!\r\n");
return;
}
@ -1145,26 +1111,32 @@ ACMD(do_pour)
GET_OBJ_VAL(to_obj, 2) = GET_OBJ_VAL(from_obj, 2);
/* Then how much to pour */
GET_OBJ_VAL(from_obj, 1) -= (amount =
(GET_OBJ_VAL(to_obj, 0) - GET_OBJ_VAL(to_obj, 1)));
if (GET_OBJ_VAL(from_obj, 0) > 0) {
GET_OBJ_VAL(from_obj, 1) -= (amount =
(GET_OBJ_VAL(to_obj, 0) - GET_OBJ_VAL(to_obj, 1)));
GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0);
GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0);
if (GET_OBJ_VAL(from_obj, 1) < 0) { /* There was too little */
GET_OBJ_VAL(to_obj, 1) += GET_OBJ_VAL(from_obj, 1);
amount += GET_OBJ_VAL(from_obj, 1);
name_from_drinkcon(from_obj);
GET_OBJ_VAL(from_obj, 1) = 0;
GET_OBJ_VAL(from_obj, 2) = 0;
GET_OBJ_VAL(from_obj, 3) = 0;
if (GET_OBJ_VAL(from_obj, 1) < 0) { /* There was too little */
GET_OBJ_VAL(to_obj, 1) += GET_OBJ_VAL(from_obj, 1);
amount += GET_OBJ_VAL(from_obj, 1);
name_from_drinkcon(from_obj);
GET_OBJ_VAL(from_obj, 1) = 0;
GET_OBJ_VAL(from_obj, 2) = 0;
GET_OBJ_VAL(from_obj, 3) = 0;
}
}
/* Then the poison boogie */
GET_OBJ_VAL(to_obj, 3) =
(GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3));
else
GET_OBJ_VAL(to_obj, 1) = GET_OBJ_VAL(to_obj, 0);
/* And the weight boogie */
weight_change_object(from_obj, -amount);
weight_change_object(to_obj, amount); /* Add weight */
/* Poisoned? */
GET_OBJ_VAL(to_obj, 3) = (GET_OBJ_VAL(to_obj, 3) || GET_OBJ_VAL(from_obj, 3))
;
/* Weight change, except for unlimited. */
if (GET_OBJ_VAL(from_obj, 0) > 0) {
weight_change_object(from_obj, -amount);
}
weight_change_object(to_obj, amount); /* Add weight */
}
void wear_message(struct char_data *ch, struct obj_data *obj, int where)

View file

@ -529,8 +529,8 @@ ACMD(do_stand)
case POS_SITTING:
send_to_char(ch, "You stand up.\r\n");
act("$n clambers to $s feet.", TRUE, ch, 0, 0, TO_ROOM);
/* Were they sitting in a chair? */
char_from_chair(ch);
/* Were they sitting in something? */
char_from_furniture(ch);
/* Will be sitting after a successful bash and may still be fighting. */
GET_POS(ch) = FIGHTING(ch) ? POS_FIGHTING : POS_STANDING;
break;
@ -538,8 +538,8 @@ ACMD(do_stand)
send_to_char(ch, "You stop resting, and stand up.\r\n");
act("$n stops resting, and clambers on $s feet.", TRUE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_STANDING;
/* Were they sitting in the chair */
char_from_chair(ch);
/* Were they sitting in something. */
char_from_furniture(ch);
break;
case POS_SLEEPING:
send_to_char(ch, "You have to wake up first!\r\n");
@ -559,7 +559,7 @@ ACMD(do_stand)
ACMD(do_sit)
{
char arg[MAX_STRING_LENGTH];
struct obj_data *chair;
struct obj_data *furniture;
struct char_data *tempch;
int found;
@ -567,7 +567,7 @@ ACMD(do_sit)
if (!*arg)
found = 0;
if (!(chair = get_obj_in_list_vis(ch, arg, NULL, world[ch->in_room].contents)))
if (!(furniture = get_obj_in_list_vis(ch, arg, NULL, world[ch->in_room].contents)))
found = 0;
else
found = 1;
@ -579,30 +579,30 @@ ACMD(do_sit)
act("$n sits down.", FALSE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_SITTING;
} else {
if (GET_OBJ_TYPE(chair) != ITEM_CHAIR) {
if (GET_OBJ_TYPE(furniture) != ITEM_FURNITURE) {
send_to_char(ch, "You can't sit on that!\r\n");
return;
} else if (GET_OBJ_VAL(chair, 1) > GET_OBJ_VAL(chair, 0)) {
/* val 1 is current number in chair, 0 is max in chair */
act("$p looks like it's all full.", TRUE, ch, chair, 0, TO_CHAR);
log("SYSERR: chair %d holding too many people.", GET_OBJ_VNUM(chair));
} else if (GET_OBJ_VAL(furniture, 1) > GET_OBJ_VAL(furniture, 0)) {
/* Val 1 is current number sitting, 0 is max in sitting. */
act("$p looks like it's all full.", TRUE, ch, furniture, 0, TO_CHAR);
log("SYSERR: Furniture %d holding too many people.", GET_OBJ_VNUM(furniture));
return;
} else if (GET_OBJ_VAL(chair, 1) == GET_OBJ_VAL(chair, 0)) {
act("There is no where left to sit upon $p.", TRUE, ch, chair, 0, TO_CHAR);
} else if (GET_OBJ_VAL(furniture, 1) == GET_OBJ_VAL(furniture, 0)) {
act("There is no where left to sit upon $p.", TRUE, ch, furniture, 0, TO_CHAR);
return;
} else {
if (OBJ_SAT_IN_BY(chair) == NULL)
OBJ_SAT_IN_BY(chair) = ch;
for (tempch = OBJ_SAT_IN_BY(chair); tempch != ch ; tempch = NEXT_SITTING(tempch)) {
if (OBJ_SAT_IN_BY(furniture) == NULL)
OBJ_SAT_IN_BY(furniture) = ch;
for (tempch = OBJ_SAT_IN_BY(furniture); tempch != ch ; tempch = NEXT_SITTING(tempch)) {
if (NEXT_SITTING(tempch))
continue;
NEXT_SITTING(tempch) = ch;
}
act("You sit down upon $p.", TRUE, ch, chair, 0, TO_CHAR);
act("$n sits down upon $p.", TRUE, ch, chair, 0, TO_ROOM);
SITTING(ch) = chair;
act("You sit down upon $p.", TRUE, ch, furniture, 0, TO_CHAR);
act("$n sits down upon $p.", TRUE, ch, furniture, 0, TO_ROOM);
SITTING(ch) = furniture;
NEXT_SITTING(ch) = NULL;
GET_OBJ_VAL(chair, 1) += 1;
GET_OBJ_VAL(furniture, 1) += 1;
GET_POS(ch) = POS_SITTING;
}
}
@ -719,8 +719,8 @@ ACMD(do_wake)
else {
send_to_char(ch, "You awaken, and sit up.\r\n");
act("$n awakens.", TRUE, ch, 0, 0, TO_ROOM);
/* Were they asleep in a chair? */
char_from_chair(ch);
/* Were they asleep while sitting? */
char_from_furniture(ch);
GET_POS(ch) = POS_SITTING;
}
}

View file

@ -744,8 +744,8 @@ void do_stat_object(struct char_data *ch, struct obj_data *j)
case ITEM_MONEY:
send_to_char(ch, "Coins: %d\r\n", GET_OBJ_VAL(j, 0));
break;
case ITEM_CHAIR:
send_to_char(ch, "Can hold: [%d] Num. of People in Chair: [%d]\r\n", GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1));
case ITEM_FURNITURE:
send_to_char(ch, "Can hold: [%d] Num. of People in: [%d]\r\n", GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1));
send_to_char(ch, "Holding : ");
for (tempch = OBJ_SAT_IN_BY(j); tempch; tempch = NEXT_SITTING(tempch))
send_to_char(ch, "%s ", GET_NAME(tempch));

View file

@ -301,8 +301,8 @@ const char *item_types[] = {
"WAND",
"STAFF",
"WEAPON",
"FIRE WEAPON",
"MISSILE",
"FURNITURE",
"UNDEFINED",
"TREASURE",
"ARMOR",
"POTION",
@ -319,7 +319,6 @@ const char *item_types[] = {
"PEN",
"BOAT",
"FOUNTAIN",
"CHAIR",
"\n"
};

View file

@ -2667,7 +2667,7 @@ void reset_char(struct char_data *ch)
ch->next_fighting = NULL;
ch->next_in_room = NULL;
FIGHTING(ch) = NULL;
char_from_chair(ch);
char_from_furniture(ch);
ch->char_specials.position = POS_STANDING;
ch->mob_specials.default_pos = POS_STANDING;
ch->char_specials.carry_weight = 0;
@ -2922,7 +2922,8 @@ int check_object(struct obj_data *obj)
}
/* Fall through. */
case ITEM_FOUNTAIN:
if (GET_OBJ_VAL(obj, 1) > GET_OBJ_VAL(obj, 0) && (error = TRUE))
if ((GET_OBJ_VAL(obj,0) > 0) && (GET_OBJ_VAL(obj, 1) > GET_OBJ_VAL(obj, 0)
&& (error = TRUE)))
log("SYSERR: Object #%d (%s) contains (%d) more than maximum (%d).",
GET_OBJ_VNUM(obj), obj->short_description,
GET_OBJ_VAL(obj, 1), GET_OBJ_VAL(obj, 0));
@ -2957,7 +2958,7 @@ int check_object(struct obj_data *obj)
} while (onealias && *onealias);
}
break;
case ITEM_CHAIR:
case ITEM_FURNITURE:
if (GET_OBJ_VAL(obj, 1) > GET_OBJ_VAL(obj, 0) && (error = TRUE))
log("SYSERR: Object #%d (%s) contains (%d) more than maximum (%d).",
GET_OBJ_VNUM(obj), obj->short_description, GET_OBJ_VAL(obj, 1),

View file

@ -306,8 +306,8 @@ int valid_dg_target(struct char_data *ch, int bitvector)
void script_damage(struct char_data *vict, int dam)
{
if (GET_LEVEL(vict)>=LVL_IMMORT && (dam > 0)) {
send_to_char(vict, "Being the cool immortal you are, you sidestep a trap,\r\n"
"obviously placed to kill you.\r\n");
send_to_char(vict, "Being the cool immortal you are, you sidestep a trap, "
"obviously placed to kill you.\r\n");
return;
}
@ -320,7 +320,7 @@ void script_damage(struct char_data *vict, int dam)
if (GET_POS(vict) == POS_DEAD) {
if (!IS_NPC(vict))
mudlog( BRF, 0, TRUE, "%s killed by script at %s",
GET_NAME(vict), world[vict->in_room].name);
GET_NAME(vict), world[vict->in_room].name);
die(vict, NULL);
}
}

View file

@ -10,7 +10,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -51,7 +50,7 @@ char *fname(const char *namelist)
}
/* Stock isname(). Leave this here even if you put in a newer *
* isname(). Used for OasisOLC. */
* isname(). Used for OasisOLC. */
int is_name(const char *str, const char *namelist)
{
const char *curname, *curstr;
@ -107,8 +106,6 @@ int isname(const char *str, const char *namelist)
return 0;
}
void affect_modify(struct char_data *ch, byte loc, sbyte mod,
bitvector_t bitv, bool add)
{
@ -146,14 +143,11 @@ void affect_modify(struct char_data *ch, byte loc, sbyte mod,
/* ??? GET_CLASS(ch) += mod; */
break;
/*
* My personal thoughts on these two would be to set the person to the
* value of the apply. That way you won't have to worry about people
* making +1 level things to be imp (you restrict anything that gives
* immortal level of course). It also makes more sense to set someone
* to a class rather than adding to the class number. -gg
*/
/* My personal thoughts on these two would be to set the person to the value
* of the apply. That way you won't have to worry about people making +1
* level things to be imp (you restrict anything that gives immortal level of
* course). It also makes more sense to set someone to a class rather than
* adding to the class number. -gg */
case APPLY_LEVEL:
/* ??? GET_LEVEL(ch) += mod; */
break;
@ -227,10 +221,8 @@ void affect_modify(struct char_data *ch, byte loc, sbyte mod,
} /* switch */
}
/* This updates a character by subtracting everything he is affected by */
/* restoring original abilities, and then affecting all again */
/* This updates a character by subtracting everything he is affected by
* restoring original abilities, and then affecting all again. */
void affect_total(struct char_data *ch)
{
struct affected_type *af;
@ -258,12 +250,10 @@ void affect_total(struct char_data *ch)
GET_OBJ_AFFECT(GET_EQ(ch, i)), TRUE);
}
for (af = ch->affected; af; af = af->next)
affect_modify(ch, af->location, af->modifier, af->bitvector, TRUE);
/* Make certain values are between 0..25, not < 0 and not > 25! */
i = (IS_NPC(ch) || GET_LEVEL(ch) >= LVL_GRGOD) ? 25 : 18;
GET_DEX(ch) = MAX(0, MIN(GET_DEX(ch), i));
@ -284,10 +274,8 @@ void affect_total(struct char_data *ch)
}
}
/* Insert an affect_type in a char_data structure
Automatically sets apropriate bits and apply's */
/* Insert an affect_type in a char_data structure. Automatically sets
* apropriate bits and apply's */
void affect_to_char(struct char_data *ch, struct affected_type *af)
{
struct affected_type *affected_alloc;
@ -302,13 +290,9 @@ void affect_to_char(struct char_data *ch, struct affected_type *af)
affect_total(ch);
}
/*
* Remove an affected_type structure from a char (called when duration
* reaches zero). Pointer *af must never be NIL! Frees mem and calls
* affect_location_apply
*/
/* Remove an affected_type structure from a char (called when duration reaches
* zero). Pointer *af must never be NIL! Frees mem and calls
* affect_location_apply */
void affect_remove(struct char_data *ch, struct affected_type *af)
{
struct affected_type *temp;
@ -324,8 +308,6 @@ void affect_remove(struct char_data *ch, struct affected_type *af)
affect_total(ch);
}
/* Call affect_remove with every spell of spelltype "skill" */
void affect_from_char(struct char_data *ch, int type)
{
@ -338,12 +320,8 @@ void affect_from_char(struct char_data *ch, int type)
}
}
/*
* Return TRUE if a char is affected by a spell (SPELL_XXX),
* FALSE indicates not affected.
*/
/* Return TRUE if a char is affected by a spell (SPELL_XXX), FALSE indicates
* not affected. */
bool affected_by_spell(struct char_data *ch, int type)
{
struct affected_type *hjp;
@ -355,8 +333,6 @@ bool affected_by_spell(struct char_data *ch, int type)
return (FALSE);
}
void affect_join(struct char_data *ch, struct affected_type *af,
bool add_dur, bool avg_dur, bool add_mod, bool avg_mod)
{
@ -386,7 +362,6 @@ void affect_join(struct char_data *ch, struct affected_type *af,
affect_to_char(ch, af);
}
/* move a player out of a room */
void char_from_room(struct char_data *ch)
{
@ -410,7 +385,6 @@ void char_from_room(struct char_data *ch)
ch->next_in_room = NULL;
}
/* place a character in a room */
void char_to_room(struct char_data *ch, room_rnum room)
{
@ -435,8 +409,7 @@ void char_to_room(struct char_data *ch, room_rnum room)
}
}
/* give an object to a char */
/* Give an object to a char. */
void obj_to_char(struct obj_data *object, struct char_data *ch)
{
if (object && ch) {
@ -454,7 +427,6 @@ void obj_to_char(struct obj_data *object, struct char_data *ch)
log("SYSERR: NULL obj (%p) or char (%p) passed to obj_to_char.", object, ch);
}
/* take an object from a char */
void obj_from_char(struct obj_data *object)
{
@ -476,8 +448,6 @@ void obj_from_char(struct obj_data *object)
object->next_content = NULL;
}
/* Return the effect of a piece of armor in position eq_pos */
int apply_ac(struct char_data *ch, int eq_pos)
{
@ -573,8 +543,6 @@ void equip_char(struct char_data *ch, struct obj_data *obj, int pos)
affect_total(ch);
}
struct obj_data *unequip_char(struct char_data *ch, int pos)
{
int j;
@ -611,7 +579,6 @@ struct obj_data *unequip_char(struct char_data *ch, int pos)
return (obj);
}
int get_number(char **name)
{
int i;
@ -634,8 +601,6 @@ int get_number(char **name)
return (1);
}
/* Search a given list for an object number, and return a ptr to that obj */
struct obj_data *get_obj_in_list_num(int num, struct obj_data *list)
{
@ -648,8 +613,6 @@ struct obj_data *get_obj_in_list_num(int num, struct obj_data *list)
return (NULL);
}
/* search the entire world for an object number, and return a pointer */
struct obj_data *get_obj_num(obj_rnum nr)
{
@ -662,8 +625,6 @@ struct obj_data *get_obj_num(obj_rnum nr)
return (NULL);
}
/* search a room for a char, and return a pointer if found.. */
struct char_data *get_char_room(char *name, int *number, room_rnum room)
{
@ -686,8 +647,6 @@ struct char_data *get_char_room(char *name, int *number, room_rnum room)
return (NULL);
}
/* search all over the world for a char num, and return a pointer if found */
struct char_data *get_char_num(mob_rnum nr)
{
@ -700,8 +659,6 @@ struct char_data *get_char_num(mob_rnum nr)
return (NULL);
}
/* put an object in a room */
void obj_to_room(struct obj_data *object, room_rnum room)
{
@ -718,7 +675,6 @@ void obj_to_room(struct obj_data *object, room_rnum room)
}
}
/* Take an object from a room */
void obj_from_room(struct obj_data *object)
{
@ -738,7 +694,6 @@ void obj_from_room(struct obj_data *object)
object->next_content = NULL;
}
/* put an object in an object (quaint) */
void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to)
{
@ -753,17 +708,20 @@ void obj_to_obj(struct obj_data *obj, struct obj_data *obj_to)
obj->next_content = obj_to->contains;
obj_to->contains = obj;
obj->in_obj = obj_to;
tmp_obj = obj->in_obj;
for (tmp_obj = obj->in_obj; tmp_obj->in_obj; tmp_obj = tmp_obj->in_obj)
/* Add weight to container, unless unlimited. */
if (GET_OBJ_VAL(obj->in_obj, 0) > 0) {
for (tmp_obj = obj->in_obj; tmp_obj->in_obj; tmp_obj = tmp_obj->in_obj)
GET_OBJ_WEIGHT(tmp_obj) += GET_OBJ_WEIGHT(obj);
/* top level object. Subtract weight from inventory if necessary. */
GET_OBJ_WEIGHT(tmp_obj) += GET_OBJ_WEIGHT(obj);
/* top level object. Subtract weight from inventory if necessary. */
GET_OBJ_WEIGHT(tmp_obj) += GET_OBJ_WEIGHT(obj);
if (tmp_obj->carried_by)
IS_CARRYING_W(tmp_obj->carried_by) += GET_OBJ_WEIGHT(obj);
if (tmp_obj->carried_by)
IS_CARRYING_W(tmp_obj->carried_by) += GET_OBJ_WEIGHT(obj);
}
}
/* remove an object from an object */
void obj_from_obj(struct obj_data *obj)
{
@ -774,22 +732,23 @@ void obj_from_obj(struct obj_data *obj)
return;
}
obj_from = obj->in_obj;
temp = obj->in_obj;
REMOVE_FROM_LIST(obj, obj_from->contains, next_content);
/* Subtract weight from containers container */
for (temp = obj->in_obj; temp->in_obj; temp = temp->in_obj)
/* Subtract weight from containers container unless unlimited. */
if (GET_OBJ_VAL(obj->in_obj, 0) > 0) {
for (temp = obj->in_obj; temp->in_obj; temp = temp->in_obj)
GET_OBJ_WEIGHT(temp) -= GET_OBJ_WEIGHT(obj);
/* Subtract weight from char that carries the object */
GET_OBJ_WEIGHT(temp) -= GET_OBJ_WEIGHT(obj);
/* Subtract weight from char that carries the object */
GET_OBJ_WEIGHT(temp) -= GET_OBJ_WEIGHT(obj);
if (temp->carried_by)
IS_CARRYING_W(temp->carried_by) -= GET_OBJ_WEIGHT(obj);
if (temp->carried_by)
IS_CARRYING_W(temp->carried_by) -= GET_OBJ_WEIGHT(obj);
}
obj->in_obj = NULL;
obj->next_content = NULL;
}
/* Set all carried_by to point to new owner */
void object_list_new_owner(struct obj_data *list, struct char_data *ch)
{
@ -982,7 +941,6 @@ void extract_char_final(struct char_data *ch)
free_char(ch);
}
/* Why do we do this? Because trying to iterate over the character list with
* 'ch = ch->next' does bad things if the current character happens to die. The
* trivial workaround of 'vict = next_vict' doesn't work if the _next_ person
@ -991,7 +949,7 @@ void extract_char_final(struct char_data *ch)
* really confused otherwise. */
void extract_char(struct char_data *ch)
{
char_from_chair(ch);
char_from_furniture(ch);
if (IS_NPC(ch))
SET_BIT(MOB_FLAGS(ch), MOB_NOTDEADYET);

View file

@ -24,7 +24,7 @@
#define NUM_AFF_FLAGS 22
#define NUM_ATTACK_TYPES 15
#define NUM_ITEM_TYPES 25
#define NUM_ITEM_TYPES 24
#define NUM_ITEM_FLAGS 17
#define NUM_ITEM_WEARS 15
#define NUM_APPLIES 25
@ -36,8 +36,8 @@
#define NUM_SHOP_FLAGS 3
#define NUM_TRADERS 7
#define MAX_PEOPLE_IN_CHAIR 10 /* The maximum number of people you want
to sit in a chair at the same time. */
#define MAX_PEOPLE 10 /* Max # of people you want to sit in furniture. */
/* Limit information. */
#define MAX_ROOM_NAME 75
#define MAX_MOB_NAME 50

View file

@ -443,11 +443,11 @@ void oedit_disp_val1_menu(struct descriptor_data *d)
write_to_output(d, "Apply to AC : ");
break;
case ITEM_CONTAINER:
write_to_output(d, "Max weight to contain : ");
write_to_output(d, "Max weight to contain (-1 for unlimited) : ");
break;
case ITEM_DRINKCON:
case ITEM_FOUNTAIN:
write_to_output(d, "Max drink units : ");
write_to_output(d, "Max drink units (-1 for unlimited) : ");
break;
case ITEM_FOOD:
write_to_output(d, "Hours to fill stomach : ");
@ -457,8 +457,8 @@ void oedit_disp_val1_menu(struct descriptor_data *d)
break;
case ITEM_NOTE:
break;
case ITEM_CHAIR:
write_to_output(d, "Number of people the chair can hold : ");
case ITEM_FURNITURE:
write_to_output(d, "Number of people it can hold : ");
break;
default:
oedit_disp_menu(d);
@ -946,8 +946,8 @@ void oedit_parse(struct descriptor_data *d, char *arg)
case OEDIT_VALUE_1:
number = atoi(arg);
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
case ITEM_CHAIR:
if (number < 0 || number > MAX_PEOPLE_IN_CHAIR)
case ITEM_FURNITURE:
if (number < 0 || number > MAX_PEOPLE)
oedit_disp_val1_menu(d);
else {
GET_OBJ_VAL(OLC_OBJ(d), 0) = number;
@ -958,7 +958,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
GET_OBJ_VAL(OLC_OBJ(d), 0) = MIN(MAX(atoi(arg), -50), 50);
break;
case ITEM_CONTAINER:
GET_OBJ_VAL(OLC_OBJ(d), 0) = LIMIT(atoi(arg), 0, MAX_CONTAINER_SIZE);
GET_OBJ_VAL(OLC_OBJ(d), 0) = LIMIT(atoi(arg), -1, MAX_CONTAINER_SIZE);
break;
default:
GET_OBJ_VAL(OLC_OBJ(d), 0) = atoi(arg);

View file

@ -294,8 +294,8 @@
#define ITEM_WAND 3 /* Item is a wand */
#define ITEM_STAFF 4 /* Item is a staff */
#define ITEM_WEAPON 5 /* Item is a weapon */
#define ITEM_FIREWEAPON 6 /* Unimplemented */
#define ITEM_MISSILE 7 /* Unimplemented */
#define ITEM_FURNITURE 6 /* Sittable Furniture */
#define ITEM_UNDEFINED 7 /* Unimplemented */
#define ITEM_TREASURE 8 /* Item is a treasure, not gold */
#define ITEM_ARMOR 9 /* Item is armor */
#define ITEM_POTION 10 /* Item is a potion */
@ -312,7 +312,6 @@
#define ITEM_PEN 21 /* Item is a pen */
#define ITEM_BOAT 22 /* Item is a boat */
#define ITEM_FOUNTAIN 23 /* Item is a fountain */
#define ITEM_CHAIR 24 /* Item is a chair */
/* Take/Wear flags: used by obj_data.obj_flags.wear_flags */
#define ITEM_WEAR_TAKE (1 << 0) /* Item can be taken */
@ -747,8 +746,8 @@ struct char_special_data_saved {
struct char_special_data {
struct char_data *fighting; /* Opponent */
struct char_data *hunting; /* Char hunted by this char */
struct obj_data *chair; /* Object the char is sitting in */
struct char_data *next_in_chair; /* The next person in the chair */
struct obj_data *furniture; /* Object the char is sitting in */
struct char_data *next_in_furniture; /* The next person sitting */
byte position; /* Standing, fighting, sleeping, etc. */

View file

@ -611,6 +611,7 @@ int count_color_chars(char *string)
}
return num;
}
/* Rules (unless overridden by ROOM_DARK): Inside and City rooms are always
* lit. Outside rooms are dark at sunset and night. */
int room_is_dark(room_rnum room)
@ -663,24 +664,24 @@ int levenshtein_distance(char *s1, char *s2)
return k;
}
void char_from_chair(struct char_data *ch)
void char_from_furniture(struct char_data *ch)
{
struct obj_data *chair;
struct obj_data *furniture;
struct char_data *tempch;
int i, found = 0;
if (!SITTING(ch))
return;
if (!(chair = SITTING(ch))){
log("SYSERR: ACK, no chair for char in char from chair");
if (!(furniture = SITTING(ch))){
log("SYSERR: No furniture for char in char_from_furniture.");
SITTING(ch) = NULL;
NEXT_SITTING(ch) = NULL;
return;
}
if (!(tempch = OBJ_SAT_IN_BY(chair))){
log("SYSERR: Char from chair, but no chair!");
if (!(tempch = OBJ_SAT_IN_BY(furniture))){
log("SYSERR: Char from furniture, but no furniture!");
SITTING(ch) = NULL;
NEXT_SITTING(ch) = NULL;
return;
@ -688,28 +689,28 @@ void char_from_chair(struct char_data *ch)
if (tempch == ch){
if (!NEXT_SITTING(ch))
OBJ_SAT_IN_BY(chair) = NULL;
OBJ_SAT_IN_BY(furniture) = NULL;
else
OBJ_SAT_IN_BY(chair) = NEXT_SITTING(ch);
GET_OBJ_VAL(chair, 1) -= 1;
OBJ_SAT_IN_BY(furniture) = NEXT_SITTING(ch);
GET_OBJ_VAL(furniture, 1) -= 1;
SITTING(ch) = NULL;
NEXT_SITTING(ch) = NULL;
return;
}
for (i = 0; i < GET_OBJ_VAL(chair, 1) && found == 0; i++){
if (NEXT_SITTING(tempch) == ch){
for (i = 0; i < GET_OBJ_VAL(furniture, 1) && found == 0; i++){
if (NEXT_SITTING(tempch) != ch){
NEXT_SITTING(tempch) = NEXT_SITTING(ch);
found++;
}
}
if (found)
log("SYSERR: Char flagged as sitting, but not in chair");
log("SYSERR: Char flagged as sitting, but not in furniture.");
else
GET_OBJ_VAL(chair, 1) -= 1;
GET_OBJ_VAL(furniture, 1) -= 1;
SITTING(ch) = NULL;
NEXT_SITTING(ch) = NULL;
return;
}

View file

@ -91,9 +91,9 @@ void gain_condition(struct char_data *ch, int condition, int value);
void point_update(void);
void update_pos(struct char_data *victim);
void char_from_chair(struct char_data *ch);
#define SITTING(ch) ((ch)->char_specials.chair)
#define NEXT_SITTING(ch) ((ch)->char_specials.next_in_chair)
void char_from_furniture(struct char_data *ch);
#define SITTING(ch) ((ch)->char_specials.furniture)
#define NEXT_SITTING(ch) ((ch)->char_specials.next_in_furniture)
#define OBJ_SAT_IN_BY(obj) ((obj)->sitting_here)
/* various constants */