26to27.patch
1stMUD/26to27.patch · 229.3 KB
From the archive 1stMud.tar.gz.1
Download the archive « Back to the archive contents
diff -ur src/act_comm.c new/act_comm.c
--- src/act_comm.c Sat Jan 11 16:24:00 2003
+++ new/act_comm.c Fri Jan 24 02:15:43 2003
@@ -305,7 +305,7 @@
chprintlnf(ch,
"" CTAG(_GOSSIP1) "You gossip '" CTAG(_GOSSIP2) "%s"
CTAG(_GOSSIP1) "'{x", argument);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *victim;
@@ -361,7 +361,7 @@
chprintlnf(ch,
"" CTAG(_GRATS1) "You grats '" CTAG(_GRATS2) "%s"
CTAG(_GRATS1) "'{x", argument);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *victim;
@@ -416,7 +416,7 @@
chprintlnf(ch,
"" CTAG(_QUOTE1) "You quote '" CTAG(_QUOTE2) "%s"
CTAG(_QUOTE1) "'{x", argument);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *victim;
@@ -471,7 +471,7 @@
chprintlnf(ch,
"" CTAG(_QA1) "You question '" CTAG(_QA2) "%s"
CTAG(_QA1) "'{x", argument);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *victim;
@@ -526,7 +526,7 @@
chprintlnf(ch,
"" CTAG(_QA1) "You answer '" CTAG(_QA2) "%s"
CTAG(_QA1) "'{x", argument);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *victim;
@@ -584,7 +584,7 @@
CTAG(_MUSIC1) "'" CTAG(_MUSIC3) "%s" CTAG(_MUSIC1)
"'{x", argument);
sprintf(buf, "$n MUSIC: '%s'", argument);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *victim;
@@ -639,7 +639,7 @@
chprintlnf(ch, "You clan '%s'", argument);
sprintf(buf, "$n clans '%s'", argument);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING && d->character != ch &&
is_same_clan(ch, d->character) &&
@@ -677,7 +677,7 @@
act_new("" CTAG(_IMMTALK1) "$n" CTAG(_IMMTALK2) ":"
CTAG(_IMMTALK3) " $t{x", ch, argument, NULL, TO_CHAR, POS_DEAD);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING && IS_IMMORTAL(d->character) &&
!IS_SET(d->character->comm, COMM_NOWIZ))
@@ -707,7 +707,7 @@
if (!IS_NPC(ch))
{
CHAR_DATA *mob, *mob_next;
- for (mob = ch->in_room->people; mob != NULL; mob = mob_next)
+ for (mob = ch->in_room->first_person; mob != NULL; mob = mob_next)
{
mob_next = mob->next_in_room;
if (IS_NPC(mob) && HAS_TRIGGER(mob, TRIG_SPEECH) &&
@@ -749,7 +749,7 @@
act("" CTAG(_SHOUT1) "You shout '" CTAG(_SHOUT2) "$T"
CTAG(_SHOUT1) "'{x", ch, NULL, argument, TO_CHAR);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *victim;
@@ -950,7 +950,7 @@
}
act("You yell '$t'", ch, argument, NULL, TO_CHAR);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING && d->character != ch &&
d->character->in_room != NULL &&
@@ -1006,7 +1006,7 @@
act("$n $t", ch, argument, NULL, TO_CHAR);
- for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room)
+ for (vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room)
{
if (vch->desc == NULL || vch == ch)
continue;
@@ -1150,7 +1150,7 @@
close_socket(d);
/* toast evil cheating bastards */
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
CHAR_DATA *tch;
@@ -1308,7 +1308,7 @@
ch->leader = NULL;
- for (fch = char_list; fch != NULL; fch = fch->next)
+ for (fch = char_first; fch != NULL; fch = fch->next)
{
if (fch->master == ch)
stop_follower(fch);
@@ -1379,7 +1379,7 @@
}
found = FALSE;
- for (och = ch->in_room->people; och != NULL; och = och_next)
+ for (och = ch->in_room->first_person; och != NULL; och = och_next)
{
och_next = och->next_in_room;
@@ -1418,7 +1418,7 @@
leader = (ch->leader != NULL) ? ch->leader : ch;
chprintlnf(ch, "%s's group:", PERS(leader, ch));
- for (gch = char_list; gch != NULL; gch = gch->next)
+ for (gch = char_first; gch != NULL; gch = gch->next)
{
if (is_same_group(gch, ch))
{
@@ -1531,7 +1531,7 @@
}
members = 0;
- for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
+ for (gch = ch->in_room->first_person; gch != NULL; gch = gch->next_in_room)
{
if (is_same_group(gch, ch) && !IS_AFFECTED(gch, AFF_CHARM))
members++;
@@ -1592,7 +1592,7 @@
amount_silver, amount_gold, share_silver, share_gold);
}
- for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
+ for (gch = ch->in_room->first_person; gch != NULL; gch = gch->next_in_room)
{
if (gch != ch && is_same_group(gch, ch) && !IS_AFFECTED(gch, AFF_CHARM))
{
@@ -1621,7 +1621,7 @@
return;
}
- for (gch = char_list; gch != NULL; gch = gch->next)
+ for (gch = char_first; gch != NULL; gch = gch->next)
{
if (is_same_group(gch, ch))
act_new("" CTAG(_GTELL1) "$n tells the group '"
@@ -1925,7 +1925,7 @@
if (!Private)
{
- for (d = descriptor_list; d; d = d->next)
+ for (d = descriptor_first; d; d = d->next)
{
CHAR_DATA *och;
@@ -1977,7 +1977,7 @@
return;
}
- if ((iValue = flag_value(info_flags, argument)) != NO_FLAG)
+ if ((iValue = flag_value(info_flags, argument)) != 0)
{
TOGGLE_BIT(ch->info_settings, iValue);
chprintln(ch, "Info channel set.");
diff -ur src/act_enter.c new/act_enter.c
--- src/act_enter.c Sat Jan 11 16:24:00 2003
+++ new/act_enter.c Fri Jan 24 02:15:43 2003
@@ -80,7 +80,7 @@
old_room = ch->in_room;
- portal = get_obj_list(ch, argument, ch->in_room->contents);
+ portal = get_obj_list(ch, argument, ch->in_room->first_content);
if (portal == NULL)
{
@@ -165,7 +165,7 @@
if (old_room == location)
return;
- for (fch = old_room->people; fch != NULL; fch = fch_next)
+ for (fch = old_room->first_person; fch != NULL; fch = fch_next)
{
fch_next = fch->next_in_room;
@@ -200,12 +200,12 @@
act("$p fades out of existence.", ch, portal, NULL, TO_CHAR);
if (ch->in_room == old_room)
act("$p fades out of existence.", ch, portal, NULL, TO_ROOM);
- else if (old_room->people != NULL)
+ else if (old_room->first_person != NULL)
{
act("$p fades out of existence.",
- old_room->people, portal, NULL, TO_CHAR);
+ old_room->first_person, portal, NULL, TO_CHAR);
act("$p fades out of existence.",
- old_room->people, portal, NULL, TO_ROOM);
+ old_room->first_person, portal, NULL, TO_ROOM);
}
extract_obj(portal);
}
diff -ur src/act_info.c new/act_info.c
--- src/act_info.c Sat Jan 11 16:24:00 2003
+++ new/act_info.c Fri Jan 24 02:15:43 2003
@@ -498,7 +498,7 @@
{
chprintln(ch, "\n\rYou peek at the inventory:");
check_improve(ch, gsn_peek, TRUE, 4);
- show_list_to_char(victim->carrying, ch, TRUE, TRUE);
+ show_list_to_char(victim->first_carrying, ch, TRUE, TRUE);
}
return;
@@ -1044,7 +1044,7 @@
room_is_dark(ch->in_room))
{
chprintln(ch, "It is pitch black ... ");
- show_char_to_char(ch->in_room->people, ch);
+ show_char_to_char(ch->in_room->first_person, ch);
return;
}
@@ -1090,8 +1090,8 @@
do_function(ch, &do_exits, "auto");
}
- show_list_to_char(ch->in_room->contents, ch, FALSE, FALSE);
- show_char_to_char(ch->in_room->people, ch);
+ show_list_to_char(ch->in_room->first_content, ch, FALSE, FALSE);
+ show_char_to_char(ch->in_room->first_person, ch);
return;
}
@@ -1143,7 +1143,7 @@
}
act("$p holds:", ch, obj, NULL, TO_CHAR);
- show_list_to_char(obj->contains, ch, TRUE, TRUE);
+ show_list_to_char(obj->first_content, ch, TRUE, TRUE);
break;
}
return;
@@ -1155,11 +1155,11 @@
return;
}
- for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj->next_content)
{
if (can_see_obj(ch, obj))
{ /* player can see object */
- pdesc = get_extra_descr(arg3, obj->extra_descr);
+ pdesc = get_extra_descr(arg3, obj->first_extra_descr);
if (pdesc != NULL)
{
if (++count == number)
@@ -1170,7 +1170,7 @@
else
continue;
}
- pdesc = get_extra_descr(arg3, obj->pIndexData->extra_descr);
+ pdesc = get_extra_descr(arg3, obj->pIndexData->first_extra_descr);
if (pdesc != NULL)
{
if (++count == number)
@@ -1191,11 +1191,11 @@
}
}
- for (obj = ch->in_room->contents; obj != NULL; obj = obj->next_content)
+ for (obj = ch->in_room->first_content; obj != NULL; obj = obj->next_content)
{
if (can_see_obj(ch, obj))
{
- pdesc = get_extra_descr(arg3, obj->extra_descr);
+ pdesc = get_extra_descr(arg3, obj->first_extra_descr);
if (pdesc != NULL)
if (++count == number)
{
@@ -1203,7 +1203,7 @@
return;
}
- pdesc = get_extra_descr(arg3, obj->pIndexData->extra_descr);
+ pdesc = get_extra_descr(arg3, obj->pIndexData->first_extra_descr);
if (pdesc != NULL)
if (++count == number)
{
@@ -1221,7 +1221,7 @@
}
}
- pdesc = get_extra_descr(arg3, ch->in_room->extra_descr);
+ pdesc = get_extra_descr(arg3, ch->in_room->first_extra_descr);
if (pdesc != NULL)
{
if (++count == number)
@@ -1715,10 +1715,10 @@
AFFECT_DATA *paf, *paf_last = NULL;
char buf[MAX_STRING_LENGTH];
- if (ch->affected != NULL)
+ if (ch->first_affect != NULL)
{
chprintln(ch, "You are affected by the following spells:");
- for (paf = ch->affected; paf != NULL; paf = paf->next)
+ for (paf = ch->first_affect; paf != NULL; paf = paf->next)
{
if (paf_last != NULL && paf->type == paf_last->type)
if (ch->level >= 20)
@@ -2095,7 +2095,7 @@
output = new_buf();
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *wch;
@@ -2258,7 +2258,7 @@
nMatch = 0;
buf[0] = '\0';
output = new_buf();
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *wch;
@@ -2309,7 +2309,7 @@
count = 0;
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
if (d->connected == CON_PLAYING && can_see(ch, d->character))
count++;
@@ -2327,7 +2327,7 @@
CH_CMD(do_inventory)
{
chprintln(ch, "You are carrying:");
- show_list_to_char(ch->carrying, ch, TRUE, TRUE);
+ show_list_to_char(ch->first_carrying, ch, TRUE, TRUE);
return;
}
@@ -2383,7 +2383,7 @@
if (arg2[0] == '\0')
{
- for (obj2 = ch->carrying; obj2 != NULL; obj2 = obj2->next_content)
+ for (obj2 = ch->first_carrying; obj2 != NULL; obj2 = obj2->next_content)
{
if (obj2->wear_loc != WEAR_NONE && can_see_obj(ch, obj2)
&& obj1->item_type == obj2->item_type
@@ -2476,7 +2476,7 @@
{
chprintln(ch, "Players near you:");
found = FALSE;
- for (d = descriptor_list; d; d = d->next)
+ for (d = descriptor_first; d; d = d->next)
{
if (d->connected == CON_PLAYING &&
(victim = d->character) != NULL && !IS_NPC(victim) &&
@@ -2497,7 +2497,7 @@
else
{
found = FALSE;
- for (victim = char_list; victim != NULL; victim = victim->next)
+ for (victim = char_first; victim != NULL; victim = victim->next)
{
if (victim->in_room != NULL &&
victim->in_room->area == ch->in_room->area &&
@@ -2752,7 +2752,8 @@
return;
}
- for (mob = ch->in_room->people; mob != NULL; mob = mob->next_in_room)
+ for (mob = ch->in_room->first_person; mob != NULL;
+ mob = mob->next_in_room)
{
if (IS_NPC(mob) && IS_SET(mob->act, ACT_PRACTICE))
break;
diff -ur src/act_move.c new/act_move.c
--- src/act_move.c Sat Jan 11 16:24:00 2003
+++ new/act_move.c Fri Jan 24 02:15:43 2003
@@ -152,7 +152,7 @@
if (IS_IMMORTAL(ch))
found = TRUE;
- for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj->next_content)
{
if (obj->item_type == ITEM_BOAT)
{
@@ -203,7 +203,7 @@
if (in_room == to_room) /* no circular follows */
return;
- for (fch = in_room->people; fch != NULL; fch = fch_next)
+ for (fch = in_room->first_person; fch != NULL; fch = fch_next)
{
fch_next = fch->next_in_room;
@@ -455,7 +455,8 @@
CHAR_DATA *rch;
REMOVE_BIT(pexit_rev->exit_info, EX_CLOSED);
- for (rch = to_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = to_room->first_person; rch != NULL;
+ rch = rch->next_in_room)
act("The $d opens.", rch, NULL, pexit_rev->keyword, TO_CHAR);
}
}
@@ -551,7 +552,8 @@
CHAR_DATA *rch;
SET_BIT(pexit_rev->exit_info, EX_CLOSED);
- for (rch = to_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = to_room->first_person; rch != NULL;
+ rch = rch->next_in_room)
act("The $d closes.", rch, NULL, pexit_rev->keyword, TO_CHAR);
}
}
@@ -563,7 +565,7 @@
{
OBJ_DATA *obj;
- for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj->next_content)
{
if (obj->pIndexData->vnum == key)
return TRUE;
@@ -856,7 +858,7 @@
WAIT_STATE(ch, skill_table[gsn_pick_lock].beats);
/* look for guards */
- for (gch = ch->in_room->people; gch; gch = gch->next_in_room)
+ for (gch = ch->in_room->first_person; gch; gch = gch->next_in_room)
{
if (IS_NPC(gch) && IS_AWAKE(gch) && ch->level + 5 < gch->level)
{
@@ -1000,7 +1002,7 @@
chprintln(ch, "Maybe you should finish fighting first?");
return;
}
- obj = get_obj_list(ch, argument, ch->in_room->contents);
+ obj = get_obj_list(ch, argument, ch->in_room->first_content);
if (obj == NULL)
{
chprintln(ch, "You don't see that here.");
@@ -1111,7 +1113,7 @@
/* okay, now that we know we can rest, find an object to rest on */
if (argument[0] != '\0')
{
- obj = get_obj_list(ch, argument, ch->in_room->contents);
+ obj = get_obj_list(ch, argument, ch->in_room->first_content);
if (obj == NULL)
{
chprintln(ch, "You don't see that here.");
@@ -1246,7 +1248,7 @@
/* okay, now that we know we can sit, find an object to sit on */
if (argument[0] != '\0')
{
- obj = get_obj_list(ch, argument, ch->in_room->contents);
+ obj = get_obj_list(ch, argument, ch->in_room->first_content);
if (obj == NULL)
{
chprintln(ch, "You don't see that here.");
@@ -1380,7 +1382,7 @@
if (argument[0] == '\0')
obj = ch->on;
else
- obj = get_obj_list(ch, argument, ch->in_room->contents);
+ obj = get_obj_list(ch, argument, ch->in_room->first_content);
if (obj == NULL)
{
@@ -1616,7 +1618,7 @@
/*
* Check for trainer.
*/
- for (mob = ch->in_room->people; mob; mob = mob->next_in_room)
+ for (mob = ch->in_room->first_person; mob; mob = mob->next_in_room)
{
if (IS_NPC(mob) && IS_SET(mob->act, ACT_TRAIN))
break;
diff -ur src/act_obj.c new/act_obj.c
--- src/act_obj.c Sat Jan 11 16:24:00 2003
+++ new/act_obj.c Fri Jan 24 02:15:43 2003
@@ -63,7 +63,7 @@
return TRUE;
owner = NULL;
- for (wch = char_list; wch != NULL; wch = wch->next)
+ for (wch = char_first; wch != NULL; wch = wch->next)
if (!str_cmp(wch->name, obj->owner))
owner = wch;
@@ -118,7 +118,8 @@
if (obj->in_room != NULL)
{
- for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room)
+ for (gch = obj->in_room->first_person; gch != NULL;
+ gch = gch->next_in_room)
if (gch->on == obj)
{
act("$N appears to be using $p.", ch, obj, gch, TO_CHAR);
@@ -158,7 +159,7 @@
if (IS_SET(ch->act, PLR_AUTOSPLIT))
{ /* AUTOSPLIT code */
members = 0;
- for (gch = ch->in_room->people; gch != NULL;
+ for (gch = ch->in_room->first_person; gch != NULL;
gch = gch->next_in_room)
{
if (!IS_AFFECTED(gch, AFF_CHARM) && is_same_group(gch, ch))
@@ -218,7 +219,7 @@
if (str_cmp(arg1, "all") && str_prefix("all.", arg1))
{
/* 'get obj' */
- obj = get_obj_list(ch, arg1, ch->in_room->contents);
+ obj = get_obj_list(ch, arg1, ch->in_room->first_content);
if (obj == NULL)
{
act("I see no $T here.", ch, NULL, arg1, TO_CHAR);
@@ -231,7 +232,7 @@
{
/* 'get all' or 'get all.obj' */
found = FALSE;
- for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
+ for (obj = ch->in_room->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
if ((arg1[3] == '\0'
@@ -296,7 +297,7 @@
if (str_cmp(arg1, "all") && str_prefix("all.", arg1))
{
/* 'get obj container' */
- obj = get_obj_list(ch, arg1, container->contains);
+ obj = get_obj_list(ch, arg1, container->first_content);
if (obj == NULL)
{
act("I see nothing like that in the $T.", ch,
@@ -309,7 +310,7 @@
{
/* 'get all container' or 'get all.obj container' */
found = FALSE;
- for (obj = container->contains; obj != NULL; obj = obj_next)
+ for (obj = container->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
if ((arg1[3] == '\0'
@@ -450,7 +451,7 @@
else
{
/* 'put all container' or 'put all.obj container' */
- for (obj = ch->carrying; obj != NULL; obj = obj_next)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
@@ -548,7 +549,7 @@
gold = amount;
}
- for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
+ for (obj = ch->in_room->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
@@ -618,7 +619,7 @@
{
/* 'drop all' or 'drop all.obj' */
found = FALSE;
- for (obj = ch->carrying; obj != NULL; obj = obj_next)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
@@ -854,7 +855,7 @@
return;
}
- obj = get_obj_list(ch, argument, ch->carrying);
+ obj = get_obj_list(ch, argument, ch->first_carrying);
if (obj == NULL)
{
@@ -977,7 +978,7 @@
}
found = FALSE;
- for (fountain = ch->in_room->contents; fountain != NULL;
+ for (fountain = ch->in_room->first_content; fountain != NULL;
fountain = fountain->next_content)
{
if (fountain->item_type == ITEM_FOUNTAIN)
@@ -1159,7 +1160,7 @@
if (arg[0] == '\0')
{
- for (obj = ch->in_room->contents; obj; obj = obj->next_content)
+ for (obj = ch->in_room->first_content; obj; obj = obj->next_content)
{
if (obj->item_type == ITEM_FOUNTAIN)
break;
@@ -1700,7 +1701,7 @@
{
OBJ_DATA *obj_next;
- for (obj = ch->carrying; obj != NULL; obj = obj_next)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
if (obj->wear_loc == WEAR_NONE && can_see_obj(ch, obj))
@@ -1739,7 +1740,7 @@
{
OBJ_DATA *obj_next;
- for (obj = ch->carrying; obj != NULL; obj = obj_next)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
if (obj->wear_loc != WEAR_NONE && can_see_obj(ch, obj)
@@ -1780,7 +1781,7 @@
return;
}
- obj = get_obj_list(ch, arg, ch->in_room->contents);
+ obj = get_obj_list(ch, arg, ch->in_room->first_content);
if (obj == NULL)
{
chprintln(ch, "You can't find it.");
@@ -1789,7 +1790,7 @@
if (obj->item_type == ITEM_CORPSE_PC)
{
- if (obj->contains)
+ if (obj->first_content)
{
chprintln(ch, "Mota wouldn't like that.");
return;
@@ -1804,7 +1805,8 @@
if (obj->in_room != NULL)
{
- for (gch = obj->in_room->people; gch != NULL; gch = gch->next_in_room)
+ for (gch = obj->in_room->first_person; gch != NULL;
+ gch = gch->next_in_room)
if (gch->on == obj)
{
act("$N appears to be using $p.", ch, obj, gch, TO_CHAR);
@@ -1831,7 +1833,8 @@
if (IS_SET(ch->act, PLR_AUTOSPLIT))
{ /* AUTOSPLIT code */
members = 0;
- for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
+ for (gch = ch->in_room->first_person; gch != NULL;
+ gch = gch->next_in_room)
{
if (is_same_group(gch, ch))
members++;
@@ -2006,7 +2009,7 @@
}
else
- for (vch = ch->in_room->people; vch; vch = vch_next)
+ for (vch = ch->in_room->first_person; vch; vch = vch_next)
{
vch_next = vch->next_in_room;
@@ -2332,7 +2335,8 @@
SHOP_DATA *pShop;
pShop = NULL;
- for (keeper = ch->in_room->people; keeper; keeper = keeper->next_in_room)
+ for (keeper = ch->in_room->first_person; keeper;
+ keeper = keeper->next_in_room)
{
if (IS_NPC(keeper) && (pShop = keeper->pIndexData->pShop) != NULL)
break;
@@ -2396,7 +2400,7 @@
OBJ_DATA *t_obj, *t_obj_next;
/* see if any duplicates are found */
- for (t_obj = ch->carrying; t_obj != NULL; t_obj = t_obj_next)
+ for (t_obj = ch->first_carrying; t_obj != NULL; t_obj = t_obj_next)
{
t_obj_next = t_obj->next_content;
@@ -2416,13 +2420,12 @@
if (t_obj == NULL)
{
- obj->next_content = ch->carrying;
- ch->carrying = obj;
+ LINK(obj, ch->first_carrying, ch->last_carrying, next_content,
+ prev_content);
}
else
{
- obj->next_content = t_obj->next_content;
- t_obj->next_content = obj;
+ INSERT(obj, t_obj, ch->first_carrying, next_content, prev_content);
}
obj->carried_by = ch;
@@ -2442,7 +2445,7 @@
number = number_argument(argument, arg);
count = 0;
- for (obj = keeper->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = keeper->first_carrying; obj != NULL; obj = obj->next_content)
{
if (obj->wear_loc == WEAR_NONE && can_see_obj(keeper, obj) &&
can_see_obj(ch, obj) && is_name(arg, obj->name))
@@ -2490,7 +2493,7 @@
if (!IS_OBJ_STAT(obj, ITEM_SELL_EXTRACT))
{
- for (obj2 = keeper->carrying; obj2; obj2 = obj2->next_content)
+ for (obj2 = keeper->first_carrying; obj2; obj2 = obj2->next_content)
{
if (obj->pIndexData == obj2->pIndexData &&
!str_cmp(obj->short_descr, obj2->short_descr))
@@ -2773,7 +2776,7 @@
}
found = FALSE;
- for (pet = pRoomIndexNext->people; pet; pet = pet->next_in_room)
+ for (pet = pRoomIndexNext->first_person; pet; pet = pet->next_in_room)
{
if (IS_SET(pet->act, ACT_PET))
{
@@ -2803,7 +2806,7 @@
one_argument(argument, arg);
found = FALSE;
- for (obj = keeper->carrying; obj; obj = obj->next_content)
+ for (obj = keeper->first_carrying; obj; obj = obj->next_content)
{
if (obj->wear_loc == WEAR_NONE && can_see_obj(ch, obj) &&
(cost = get_cost(keeper, obj, TRUE)) > 0 &&
diff -ur src/act_wiz.c new/act_wiz.c
--- src/act_wiz.c Sat Jan 11 16:24:00 2003
+++ new/act_wiz.c Fri Jan 24 02:15:43 2003
@@ -54,7 +54,7 @@
CH_CMD(do_wiznet)
{
- flag_t flag;
+ int flag;
char buf[MAX_STRING_LENGTH];
if (argument[0] == '\0')
@@ -129,7 +129,7 @@
flag = wiznet_lookup(argument);
- if (flag == -1 || get_trust(ch) < wiznet_table[flag].level)
+ if (flag == 0 || get_trust(ch) < wiznet_table[flag].level)
{
chprintln(ch, "No such option.");
return;
@@ -157,7 +157,7 @@
{
DESCRIPTOR_DATA *d;
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING && IS_IMMORTAL(d->character) &&
IS_SET(d->character->wiznet, WIZ_ON) && (!flag ||
@@ -363,7 +363,7 @@
chprintln(ch, argument);
- for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room)
+ for (vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room)
{
if (vch->desc == NULL || vch == ch)
continue;
@@ -540,7 +540,7 @@
int desc;
desc = atoi(arg);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->descriptor == desc)
{
@@ -563,7 +563,7 @@
return;
}
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d == victim->desc)
{
@@ -641,7 +641,7 @@
return;
}
- for (d = descriptor_list; d; d = d->next)
+ for (d = descriptor_first; d; d = d->next)
{
if (d->connected == CON_PLAYING)
{
@@ -665,7 +665,7 @@
return;
}
- for (d = descriptor_list; d; d = d->next)
+ for (d = descriptor_first; d; d = d->next)
{
if (d->connected == CON_PLAYING && d->character->in_room == ch->in_room)
{
@@ -688,7 +688,7 @@
return;
}
- for (d = descriptor_list; d; d = d->next)
+ for (d = descriptor_first; d; d = d->next)
{
if (d->connected == CON_PLAYING && d->character->in_room != NULL
&& ch->in_room != NULL
@@ -764,7 +764,7 @@
if (!str_cmp(arg1, "all"))
{
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING && d->character != ch &&
d->character->in_room != NULL && can_see(ch, d->character))
@@ -863,7 +863,7 @@
* See if 'ch' still exists before continuing!
* Handles 'at XXXX quit' case.
*/
- for (wch = char_list; wch != NULL; wch = wch->next)
+ for (wch = char_first; wch != NULL; wch = wch->next)
{
if (wch == ch)
{
@@ -896,7 +896,7 @@
}
count = 0;
- for (rch = location->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = location->first_person; rch != NULL; rch = rch->next_in_room)
count++;
if (!is_room_owner(ch, location) && room_is_private(location) &&
@@ -909,7 +909,7 @@
if (ch->fighting != NULL)
stop_fighting(ch, TRUE);
- for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = ch->in_room->first_person; rch != NULL; rch = rch->next_in_room)
{
if (get_trust(rch) >= ch->invis_level)
{
@@ -923,7 +923,7 @@
char_from_room(ch);
char_to_room(ch, location);
- for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = ch->in_room->first_person; rch != NULL; rch = rch->next_in_room)
{
if (get_trust(rch) >= ch->invis_level)
{
@@ -964,7 +964,7 @@
if (ch->fighting != NULL)
stop_fighting(ch, TRUE);
- for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = ch->in_room->first_person; rch != NULL; rch = rch->next_in_room)
{
if (get_trust(rch) >= ch->invis_level)
{
@@ -978,7 +978,7 @@
char_from_room(ch);
char_to_room(ch, location);
- for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = ch->in_room->first_person; rch != NULL; rch = rch->next_in_room)
{
if (get_trust(rch) >= ch->invis_level)
{
@@ -1094,12 +1094,12 @@
flag_string(room_flags, location->room_flags),
location->description);
- if (location->extra_descr != NULL)
+ if (location->first_extra_descr != NULL)
{
EXTRA_DESCR_DATA *ed;
chprint(ch, "Extra description keywords: '");
- for (ed = location->extra_descr; ed; ed = ed->next)
+ for (ed = location->first_extra_descr; ed; ed = ed->next)
{
chprint(ch, ed->keyword);
if (ed->next != NULL)
@@ -1109,7 +1109,7 @@
}
chprint(ch, "Characters:");
- for (rch = location->people; rch; rch = rch->next_in_room)
+ for (rch = location->first_person; rch; rch = rch->next_in_room)
{
if (can_see(ch, rch))
{
@@ -1120,7 +1120,7 @@
}
chprint(ch, ".\n\rObjects: ");
- for (obj = location->contents; obj; obj = obj->next_content)
+ for (obj = location->first_content; obj; obj = obj->next_content)
{
chprint(ch, " ");
one_argument(obj->name, buf);
@@ -1338,20 +1338,21 @@
break;
}
- if (obj->extra_descr != NULL || obj->pIndexData->extra_descr != NULL)
+ if (obj->first_extra_descr != NULL
+ || obj->pIndexData->first_extra_descr != NULL)
{
EXTRA_DESCR_DATA *ed;
chprint(ch, "Extra description keywords: '");
- for (ed = obj->extra_descr; ed != NULL; ed = ed->next)
+ for (ed = obj->first_extra_descr; ed != NULL; ed = ed->next)
{
chprint(ch, ed->keyword);
if (ed->next != NULL)
chprint(ch, " ");
}
- for (ed = obj->pIndexData->extra_descr; ed != NULL; ed = ed->next)
+ for (ed = obj->pIndexData->first_extra_descr; ed != NULL; ed = ed->next)
{
chprint(ch, ed->keyword);
if (ed->next != NULL)
@@ -1361,7 +1362,7 @@
chprintln(ch, "'");
}
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
chprintf(ch, "Affects %s by %d, level %d",
flag_string(apply_flags, paf->location), paf->modifier,
@@ -1408,7 +1409,7 @@
}
if (!obj->enchanted)
- for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->pIndexData->first_affect; paf != NULL; paf = paf->next)
{
chprintlnf(ch, "Affects %s by %d, level %d.",
flag_string(apply_flags, paf->location),
@@ -1657,7 +1658,7 @@
}
}
- for (paf = victim->affected; paf != NULL; paf = paf->next)
+ for (paf = victim->first_affect; paf != NULL; paf = paf->next)
{
chprintlnf(ch,
"Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.",
@@ -1823,7 +1824,7 @@
return;
}
- for (obj = object_list; obj != NULL; obj = obj->next)
+ for (obj = object_first; obj != NULL; obj = obj->next)
{
if (!can_see_obj(ch, obj) || !is_name(argument, obj->name) ||
ch->level < obj->level)
@@ -1878,7 +1879,7 @@
/* show characters logged */
buffer = new_buf();
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->character != NULL && d->connected == CON_PLAYING &&
d->character->in_room != NULL
@@ -1908,7 +1909,7 @@
found = FALSE;
buffer = new_buf();
- for (victim = char_list; victim != NULL; victim = victim->next)
+ for (victim = char_first; victim != NULL; victim = victim->next)
{
if (victim->in_room != NULL && is_name(argument, victim->name))
{
@@ -1954,7 +1955,7 @@
end_war();
merc_down = TRUE;
save_gquest_data();
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
vch = d->original ? d->original : d->character;
@@ -1991,7 +1992,7 @@
end_war();
merc_down = TRUE;
save_gquest_data();
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
vch = d->original ? d->original : d->character;
@@ -2065,7 +2066,7 @@
chprintln(ch, "Cancelling all snoops.");
wiznet("$N stops being such a snoop.", ch, NULL, WIZ_SNOOPS,
WIZ_SECURE, get_trust(ch));
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->snoop_by == ch->desc)
d->snoop_by = NULL;
@@ -2233,7 +2234,7 @@
{
OBJ_DATA *c_obj, *t_obj;
- for (c_obj = obj->contains; c_obj != NULL; c_obj = c_obj->next_content)
+ for (c_obj = obj->first_content; c_obj != NULL; c_obj = c_obj->next_content)
{
if (obj_check(ch, c_obj))
{
@@ -2341,7 +2342,7 @@
clone = create_mobile(mob->pIndexData);
clone_mobile(mob, clone);
- for (obj = mob->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = mob->first_carrying; obj != NULL; obj = obj->next_content)
{
if (obj_check(ch, obj))
{
@@ -2487,7 +2488,7 @@
CHAR_DATA *vnext;
OBJ_DATA *obj_next;
- for (victim = ch->in_room->people; victim != NULL; victim = vnext)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = vnext)
{
vnext = victim->next_in_room;
if (IS_NPC(victim) && !IS_SET(victim->act, ACT_NOPURGE) && victim != ch /* safety precaution */
@@ -2495,7 +2496,7 @@
extract_char(victim, TRUE);
}
- for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
+ for (obj = ch->in_room->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
if (!IS_OBJ_STAT(obj, ITEM_NOPURGE))
@@ -2682,7 +2683,8 @@
{
/* cure room */
- for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room)
+ for (vch = ch->in_room->first_person; vch != NULL;
+ vch = vch->next_in_room)
{
affect_strip(vch, gsn_plague);
affect_strip(vch, gsn_poison);
@@ -2709,7 +2711,7 @@
{
/* cure all */
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
victim = d->character;
@@ -3011,7 +3013,7 @@
{
CHAR_DATA *rch;
- for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = ch->in_room->first_person; rch != NULL; rch = rch->next_in_room)
{
if (rch->fighting != NULL)
stop_fighting(rch, TRUE);
@@ -3839,8 +3841,7 @@
ed->keyword = str_dup(arg3);
ed->description = str_dup(buf);
- ed->next = obj->extra_descr;
- obj->extra_descr = ed;
+ LINK(ed, obj->first_extra_descr, obj->last_extra_descr, next, prev);
return;
}
}
@@ -4038,7 +4039,7 @@
buf[0] = '\0';
one_argument(argument, arg);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->character != NULL && can_see(ch, d->character) &&
(arg[0] == '\0' || is_name(arg, d->character->name) ||
@@ -4101,7 +4102,7 @@
return;
}
- for (vch = char_list; vch != NULL; vch = vch_next)
+ for (vch = char_first; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
@@ -4123,7 +4124,7 @@
return;
}
- for (vch = char_list; vch != NULL; vch = vch_next)
+ for (vch = char_first; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
@@ -4146,7 +4147,7 @@
return;
}
- for (vch = char_list; vch != NULL; vch = vch_next)
+ for (vch = char_first; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
@@ -4395,7 +4396,7 @@
ch ? ch->name : "System");
/* For each playing descriptor, save its state */
- for (d = descriptor_list; d; d = d_next)
+ for (d = descriptor_first; d; d = d_next)
{
CHAR_DATA *och = CH(d);
d_next = d->next; /* We delete from the list , so need to save this */
@@ -4490,8 +4491,7 @@
d->descriptor = desc;
d->d_flags = dflags;
d->host = str_dup(host);
- d->next = descriptor_list;
- descriptor_list = d;
+ LINK(d, descriptor_first, descriptor_last, next, prev);
d->connected = CON_COPYOVER_RECOVER; /* -15, so close_socket frees the char */
init_telnet(d);
@@ -4522,12 +4522,11 @@
if (!d->character->in_room)
d->character->in_room = get_room_index(ROOM_VNUM_TEMPLE);
- /* Insert in the char_list */
- d->character->next = char_list;
- char_list = d->character;
+ /* Insert in the char_first */
+ LINK(d->character, char_first, char_last, next, prev);
- d->character->next_player = player_list;
- player_list = d->character;
+ LINK(d->character, player_first, player_last, next_player,
+ prev_player);
char_to_room(d->character, d->character->in_room);
do_look(d->character, "auto");
diff -ur src/auction.c new/auction.c
--- src/auction.c Sat Jan 11 16:24:00 2003
+++ new/auction.c Fri Jan 24 02:15:43 2003
@@ -39,13 +39,11 @@
#include "magic.h"
#include "recycle.h"
-AUCTION_DATA *auction_list;
-
AUCTION_DATA *auction_lookup(int num)
{
AUCTION_DATA *pAuc;
- for (pAuc = auction_list; pAuc != NULL; pAuc = pAuc->next)
+ for (pAuc = auction_first; pAuc != NULL; pAuc = pAuc->next)
{
if (pAuc->number == num)
return pAuc;
@@ -188,8 +186,7 @@
}
auc = new_auction();
- auc->next = auction_list;
- auction_list = auc;
+ LINK(auc, auction_first, auction_last, next, prev);
SET_BIT(obj->extra_flags, ITEM_AUCTIONED);
auc->owner = ch;
auc->item = obj;
@@ -212,7 +209,7 @@
{
AUCTION_DATA *auc, *auc_next;
- for (auc = auction_list; auc != NULL; auc = auc_next)
+ for (auc = auction_first; auc != NULL; auc = auc_next)
{
auc_next = auc->next;
@@ -339,26 +336,7 @@
auc->owner = NULL;
auc->status = 0;
auc->number = 0;
- if (auction_list == auc)
- {
- auction_list = auc->next;
- }
- else
- {
- AUCTION_DATA *prev;
- for (prev = auction_list; prev != NULL; prev = prev->next)
- {
- if (prev->next == auc)
- {
- prev->next = auc->next;
- break;
- }
- }
- if (prev == NULL)
- {
- bug("auc not found in auction_list.", 0);
- }
- }
+ UNLINK(auc, auction_first, auction_last, next, prev);
free_auction(auc);
return;
}
@@ -368,7 +346,7 @@
AUCTION_DATA *q;
int count;
- q = auction_list;
+ q = auction_first;
if (!q)
return 0;
@@ -505,7 +483,7 @@
argument = one_argument(argument, arg1);
argument = one_argument(argument, arg2);
- if (auction_list == NULL)
+ if (auction_first == NULL)
{
chprintln(ch, "There's nothing up for auction right now.");
return;
@@ -519,7 +497,7 @@
"{GNum Seller Item Description Lvl Last Bid Time{x");
chprintln(ch,
"{W--- ------------ ----------------------------------- --- ------------- ----{x");
- for (auc = auction_list; auc; auc = auc_next)
+ for (auc = auction_first; auc; auc = auc_next)
{
auc_next = auc->next;
@@ -595,7 +573,7 @@
return;
}
- bid = parsebet(auction_list->bid, arg2);
+ bid = parsebet(auction_first->bid, arg2);
if (bid < 0 || bid > 200000000)
{
@@ -656,7 +634,7 @@
{
AUCTION_DATA *auc;
- for (auc = auction_list; auc != NULL; auc = auc->next)
+ for (auc = auction_first; auc != NULL; auc = auc->next)
{
if (auc->owner == ch || auc->high_bidder == ch)
return TRUE;
@@ -669,7 +647,7 @@
{
AUCTION_DATA *auc, *auc_next;
- for (auc = auction_list; auc != NULL; auc = auc_next)
+ for (auc = auction_first; auc != NULL; auc = auc_next)
{
auc_next = auc->next;
diff -ur src/automap.c new/automap.c
--- src/automap.c Sat Jan 11 16:24:00 2003
+++ new/automap.c Fri Jan 24 02:15:43 2003
@@ -40,7 +40,7 @@
#define MAPX 10
#define MAPY 8
#define BOUNDARY(x, y) (((x) < 0) || ((y) < 0) || \
-((x) > MAPX) || ((y) > MAPY)) \
+((x) > MAPX) || ((y) > MAPY))
struct map_type
{
diff -ur src/ban.c new/ban.c
--- src/ban.c Sat Jan 11 16:24:00 2003
+++ new/ban.c Fri Jan 24 02:15:43 2003
@@ -37,8 +37,6 @@
#include "recycle.h"
#include "interp.h"
-BAN_DATA *ban_list;
-
bool check_ban(const char *site, int type)
{
BAN_DATA *pban;
@@ -47,7 +45,7 @@
strcpy(host, capitalize(site));
host[0] = LOWER(host[0]);
- for (pban = ban_list; pban != NULL; pban = pban->next)
+ for (pban = ban_first; pban != NULL; pban = pban->next)
{
if (!IS_SET(pban->ban_flags, type))
continue;
@@ -84,7 +82,7 @@
if (arg1[0] == '\0')
{
- if (ban_list == NULL)
+ if (ban_first == NULL)
{
chprintln(ch, "No sites banned at this time.");
return;
@@ -92,7 +90,7 @@
buffer = new_buf();
add_buf(buffer, "Banned sites level type status\n\r");
- for (pban = ban_list; pban != NULL; pban = pban->next)
+ for (pban = ban_first; pban != NULL; pban = pban->next)
{
sprintf(buf2, "%s%s%s",
IS_SET(pban->ban_flags, BAN_PREFIX) ? "*" : "",
@@ -146,8 +144,10 @@
}
prev = NULL;
- for (pban = ban_list; pban != NULL; prev = pban, pban = pban->next)
+ for (pban = ban_first; pban != NULL; pban = prev)
{
+ prev = pban->next;
+
if (!str_cmp(name, pban->name))
{
if (pban->level > get_trust(ch))
@@ -157,10 +157,7 @@
}
else
{
- if (prev == NULL)
- ban_list = pban->next;
- else
- prev->next = pban->next;
+ UNLINK(pban, ban_first, ban_last, next, prev);
free_ban(pban);
}
}
@@ -180,8 +177,7 @@
if (fPerm)
SET_BIT(pban->ban_flags, BAN_PERMANENT);
- pban->next = ban_list;
- ban_list = pban;
+ LINK(pban, ban_first, ban_last, next, prev);
save_bans();
sprintf(buf, "%s has been banned.\n\r", pban->name);
chprint(ch, buf);
@@ -213,8 +209,10 @@
}
prev = NULL;
- for (curr = ban_list; curr != NULL; prev = curr, curr = curr->next)
+ for (curr = ban_first; curr != NULL; curr = prev)
{
+ prev = curr->next;
+
if (!str_cmp(arg, curr->name))
{
if (curr->level > get_trust(ch))
@@ -222,10 +220,7 @@
chprintln(ch, "You are not powerful enough to lift that ban.");
return;
}
- if (prev == NULL)
- ban_list = ban_list->next;
- else
- prev->next = curr->next;
+ UNLINK(curr, ban_first, ban_last, next, prev);
free_ban(curr);
chprintlnf(ch, "Ban on %s lifted.", arg);
diff -ur src/bit.c new/bit.c
--- src/bit.c Sat Jan 11 16:24:00 2003
+++ new/bit.c Fri Jan 24 02:15:43 2003
@@ -138,7 +138,7 @@
if (is_stat(flag_table))
{
if ((f = flag_lookup(argument, flag_table)) == NULL)
- return NO_FLAG;
+ return 0;
return f->bit;
}
@@ -156,12 +156,12 @@
break;
if ((f = flag_lookup(word, flag_table)) == NULL)
- return NO_FLAG;
+ return 0;
SET_BIT(marked, f->bit);
}
- return marked == 0 ? NO_FLAG : marked;
+ return marked;
}
/*****************************************************************************
diff -ur src/board.c new/board.c
--- src/board.c Sat Jan 11 16:24:00 2003
+++ new/board.c Fri Jan 24 02:15:43 2003
@@ -34,6 +34,7 @@
#include <time.h>
#include "merc.h"
#include "interp.h"
+#include "recycle.h"
/*
@@ -91,7 +92,8 @@
long last_note_stamp = 0; /* To generate unique timestamps on notes */
-NOTE_DATA *note_list;
+NOTE_DATA *note_first;
+NOTE_DATA *note_last;
NOTE_DATA *note_free;
#define BOARD_NOACCESS -1
@@ -113,8 +115,7 @@
if (note->text)
free_string(note->text);
- note->next = note_free;
- note_free = note;
+ PUT_FREE(note, next, note_free);
}
/* allocate memory for a new note or recycle */
@@ -159,7 +160,6 @@
void finish_note(BOARD_DATA * board, NOTE_DATA * note)
{
FILE *fp;
- NOTE_DATA *p;
char filename[200];
/* The following is done in order to generate unique date_stamps */
@@ -173,15 +173,7 @@
}
if (board->note_first) /* are there any notes in there now? */
- {
- for (p = board->note_first; p->next; p = p->next)
- ; /* empty */
-
- p->next = note;
- }
- else /* nope. empty list. */
- board->note_first = note;
-
+ LINK(note, board->note_first, board->note_last, next, prev);
/* append note to note file */
sprintf(filename, "%s%s", NOTE_DIR, board->short_name);
@@ -225,18 +217,7 @@
/* Remove list from the list. Do not free note */
static void unlink_note(BOARD_DATA * board, NOTE_DATA * note)
{
- NOTE_DATA *p;
-
- if (board->note_first == note)
- board->note_first = note->next;
- else
- {
- for (p = board->note_first; p && p->next != note; p = p->next);
- if (!p)
- bug("unlink_note: could not find note.", 0);
- else
- p->next = note->next;
- }
+ UNLINK(note, board->note_first, board->note_last, next, prev);
}
/* Find the nth note on a board. Return NULL if ch has no access to that note */
@@ -308,7 +289,6 @@
static void load_board(BOARD_DATA * board)
{
FILE *fp, *fp_archive;
- NOTE_DATA *last_note;
char filename[200];
sprintf(filename, "%s/%s", NOTE_DIR, board->short_name);
@@ -321,8 +301,6 @@
/* Start note fetching. copy of db.c:load_notes() */
- last_note = NULL;
-
for (;;)
{
NOTE_DATA *pnote;
@@ -370,8 +348,6 @@
break;
pnote->text = fread_string(fp);
- pnote->next = NULL; /* jic */
-
/* Should this note be archived right now ? */
if (pnote->expire < current_time)
@@ -394,12 +370,7 @@
}
- if (board->note_first == NULL)
- board->note_first = pnote;
- else
- last_note->next = pnote;
-
- last_note = pnote;
+ LINK(pnote, board->note_first, board->note_last, next, prev);
}
bug("Load_notes: bad key word.", 0);
diff -ur src/board.h new/board.h
--- src/board.h Sat Jan 11 16:24:00 2003
+++ new/board.h Fri Jan 24 02:15:43 2003
@@ -63,6 +63,7 @@
/* Non-constant data */
NOTE_DATA *note_first; /* pointer to board's first note */
+ NOTE_DATA *note_last; /* pointer to board's last note */
bool changed; /* currently unused */
};
diff -ur src/comm.c new/comm.c
--- src/comm.c Sat Jan 11 16:24:00 2003
+++ new/comm.c Fri Jan 24 02:15:43 2003
@@ -80,14 +80,10 @@
/*
* Global variables.
*/
-DESCRIPTOR_DATA *descriptor_list; /* All open descriptors */
DESCRIPTOR_DATA *d_next; /* Next descriptor in loop */
-FILE *fpReserve; /* Reserved file handle */
bool god; /* All new chars are gods! */
bool merc_down; /* Shutdown */
char str_boot_time[MAX_INPUT_LENGTH];
-time_t current_time; /* time of this pulse */
-bool MOBtrigger = TRUE; /* act() switch */
/* Needs to be global because of do_copyover */
int port, control;
/* Global variable */
@@ -438,7 +434,7 @@
FD_ZERO(&exc_set);
FD_SET(ctrl, &in_set);
maxdesc = ctrl;
- for (d = descriptor_list; d; d = d->next)
+ for (d = descriptor_first; d; d = d->next)
{
maxdesc = UMAX(maxdesc, d->descriptor);
FD_SET(d->descriptor, &in_set);
@@ -464,7 +460,7 @@
/*
* Kick out the freaky folks.
*/
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
if (FD_ISSET(d->descriptor, &exc_set))
@@ -481,7 +477,7 @@
/*
* Process input.
*/
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
d->fcommand = FALSE;
@@ -545,7 +541,7 @@
/*
* Output.
*/
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
@@ -684,8 +680,7 @@
/*
* Init descriptor data.
*/
- dnew->next = descriptor_list;
- descriptor_list = dnew;
+ LINK(dnew, descriptor_first, descriptor_last, next, prev);
/*
* Send the greeting.
@@ -712,7 +707,7 @@
{
DESCRIPTOR_DATA *d;
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->snoop_by == dclose)
d->snoop_by = NULL;
@@ -744,21 +739,7 @@
if (d_next == dclose)
d_next = d_next->next;
- if (dclose == descriptor_list)
- {
- descriptor_list = descriptor_list->next;
- }
- else
- {
- DESCRIPTOR_DATA *d;
-
- for (d = descriptor_list; d && d->next != dclose; d = d->next)
- ;
- if (d != NULL)
- d->next = dclose->next;
- else
- bug("Close_socket: dclose not found.", 0);
- }
+ UNLINK(dclose, descriptor_first, descriptor_last, next, prev);
#if !defined(NO_MCCP)
if (dclose->out_compress)
@@ -833,6 +814,8 @@
#endif
))
{
+ SET_BIT(d->d_flags, DESC_COLOUR);
+ write_to_buffer(d, "{`Colour{c enabled Automatically...{x\n\r", 0);
show_greeting(d);
d->connected = CON_GET_NAME;
}
@@ -1344,7 +1327,27 @@
if (!merc_down)
{
if (d->showstr_point)
- write_to_buffer(d, "[Hit Return to continue]\n\r", 0);
+ {
+ char buf[MSL];
+ const char *ptr;
+ int shown_lines = 0;
+ int total_lines = 0;
+
+ for (ptr = d->showstr_head; ptr != d->showstr_point; ptr++)
+ if (*ptr == '\n')
+ shown_lines++;
+
+ total_lines = shown_lines;
+ for (ptr = d->showstr_point; *ptr != '\0'; ptr++)
+ if (*ptr == '\n')
+ total_lines++;
+
+ sprintf(buf,
+ "\n\r(%d%%) Please type (H)elp, (R)efresh, (B)ack, or (C)ontinue or hit ENTER.\n\r",
+ 100 * shown_lines / total_lines);
+ write_to_buffer(d, buf, 0);
+
+ }
else if (fPrompt && d->pString && d->connected == CON_PLAYING)
write_to_buffer(d, "> ", 2);
else if (fPrompt && d->connected == CON_NOTE_TEXT)
@@ -1815,7 +1818,7 @@
{
CHAR_DATA *ch;
- for (ch = char_list; ch != NULL; ch = ch->next)
+ for (ch = char_first; ch != NULL; ch = ch->next)
{
if (!IS_NPC(ch) && (!fConn || ch->desc == NULL) &&
!str_cmp(d->character->name, ch->name))
@@ -1860,7 +1863,7 @@
{
DESCRIPTOR_DATA *dold;
- for (dold = descriptor_list; dold; dold = dold->next)
+ for (dold = descriptor_first; dold; dold = dold->next)
{
if (dold != d && dold->character != NULL &&
dold->connected != CON_GET_NAME &&
@@ -1939,55 +1942,93 @@
/* string pager */
void show_string(struct descriptor_data *d, char *input)
{
- char buffer[4 * MAX_STRING_LENGTH];
+ char buffer[MAX_STRING_LENGTH * 3];
char buf[MAX_INPUT_LENGTH];
+ register const char *scan;
+ register char *scan2;
register const char *chk;
- register char *scan;
- int lines = 0, toggle = 1;
- int show_lines;
+ int lines = 0;
+ int toggle = 1;
one_argument(input, buf);
- if (buf[0] != '\0')
+
+ switch (UPPER(buf[0]))
{
+ case '\0':
+ case 'C':
+ lines = 0;
+ break;
+
+ case 'R': /* refresh current page of text */
+ lines = -1 - (d->character->lines);
+ break;
+
+ case 'B': /* scroll back a page of text */
+ lines = -(2 * (int) d->character->lines);
+ break;
+
+ case '?':
+ case 'H': /* Show some help */
+ write_to_buffer(d, "Pager help:\n\r" "C or Enter next page\n\r"
+ "R refresh this page\n\r", 0);
+ write_to_buffer(d,
+ "B previous page\n\r"
+ "H or ? help\n\r" "Any other keys exit.\n\r",
+ 0);
+ return;
+
+ default: /*otherwise, stop the text viewing */
if (d->showstr_head)
{
- free_mem(d->showstr_head);
- d->showstr_head = 0;
+ replace_string(d->showstr_head, "");
}
- d->showstr_point = 0;
+ d->showstr_point = NULL;
return;
- }
- if (d->character)
- show_lines = d->character->lines;
- else
- show_lines = 0;
+ }
- for (scan = buffer;; scan++, d->showstr_point++)
+ /* do any backing up necessary */
+ if (lines < 0)
{
- if (((*scan = *d->showstr_point) == '\n' || *scan == '\r') &&
- (toggle = -toggle) < 0)
- lines++;
+ for (scan = d->showstr_point; scan > d->showstr_head; scan--)
+ if ((*scan == '\n') || (*scan == '\r'))
+ {
+ toggle = -toggle;
+ if (toggle < 0)
+ if (!(++lines))
+ break;
+ }
+ d->showstr_point = scan;
+ }
- else if (!*scan || (show_lines > 0 && lines >= show_lines))
+ /* show a chunk */
+ lines = 0;
+ toggle = 1;
+ for (scan2 = buffer;; scan2++, d->showstr_point++)
+ if (((*scan2 = *d->showstr_point) == '\n' || *scan2 == '\r')
+ && (toggle = -toggle) < 0)
+ lines++;
+ else if (!*scan2
+ || (d->character && !IS_NPC(d->character)
+ && lines >= (int) d->character->lines))
{
- *scan = '\0';
+
+ *scan2 = '\0';
write_to_buffer(d, buffer, strlen(buffer));
+
+ /* See if this is the end (or near the end) of the string */
for (chk = d->showstr_point; isspace(*chk); chk++);
+ if (!*chk)
{
- if (!*chk)
+ if (d->showstr_head)
{
- if (d->showstr_head)
- {
- free_mem(d->showstr_head);
- d->showstr_head = 0;
- }
- d->showstr_point = 0;
+ replace_string(d->showstr_head, "");
}
+ d->showstr_point = 0;
}
return;
}
- }
+
return;
}
@@ -2025,7 +2066,7 @@
if (ch == NULL || ch->in_room == NULL)
return;
- to = ch->in_room->people;
+ to = ch->in_room->first_person;
if (IS_SET(type, TO_VICT))
{
if (vch == NULL)
@@ -2037,7 +2078,7 @@
if (vch->in_room == NULL)
return;
- to = vch->in_room->people;
+ to = vch->in_room->first_person;
}
for (; to != NULL; to = to->next_in_room)
@@ -2234,7 +2275,7 @@
"Please note any unusual circumstances to IMP and avoid using that command.\n\r",
0);
}
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
ch = CH(d);
@@ -2249,7 +2290,7 @@
}
// try to save all characters - save_char_obj has sanity checking
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
ch = CH(d);
@@ -2304,7 +2345,7 @@
{
crashed++;
- for (d = descriptor_list; d != NULL; d = d_next)
+ for (d = descriptor_first; d != NULL; d = d_next)
{
d_next = d->next;
ch = d->original ? d->original : d->character;
diff -ur src/const.c new/const.c
--- src/const.c Sat Jan 11 16:24:00 2003
+++ new/const.c Fri Jan 24 02:15:43 2003
@@ -151,50 +151,6 @@
{NULL, NULL, 0}
};
-struct race_type *race_table;
-
-struct class_type *class_table;
-
-/*
- * Class table.
-
-const struct class_type class_table[] = {
- {
- "mage", "Mag", STAT_INT, OBJ_VNUM_SCHOOL_DAGGER,
- {3018, 9618}, 75, 20, 6, 6, 8, TRUE,
- "mage basics", "mage default"},
-
- {
- "cleric", "Cle", STAT_WIS, OBJ_VNUM_SCHOOL_MACE,
- {3003, 9619}, 75, 20, 2, 7, 10, TRUE,
- "cleric basics", "cleric default"},
-
- {
- "thief", "Thi", STAT_DEX, OBJ_VNUM_SCHOOL_DAGGER,
- {3028, 9639}, 75, 20, -4, 8, 13, FALSE,
- "thief basics", "thief default"},
-
- {
- "warrior", "War", STAT_STR, OBJ_VNUM_SCHOOL_SWORD,
- {3022, 9633}, 75, 20, -10, 11, 15, FALSE,
- "warrior basics", "warrior default"},
-
- {
- "paladin", "Pal", STAT_WIS, OBJ_VNUM_SCHOOL_MACE,
- {3003, 9619}, 75, 20, 2, 7, 10, TRUE,
- "paladin basics", "paladin default"},
-
- {
- "ranger", "Ran", STAT_STR, OBJ_VNUM_SCHOOL_SWORD,
- {3022, 9633}, 75, 20, -10, 11, 15, FALSE,
- "ranger basics", "ranger default"},
-
- {
- NULL, "", -1, -1,
- {0, 0}, 0, 0, 0, 0, 0, FALSE,
- NULL, NULL}
-};
- */
/*
* Attribute bonus tables.
*/
@@ -394,7 +350,3 @@
{"cordial", "clear", {100, 1, 5, 0, 2}},
{NULL, NULL, {0, 0, 0, 0, 0}}
};
-
-struct skill_type *skill_table;
-
-struct group_type *group_table;
diff -ur src/db.c new/db.c
--- src/db.c Sat Jan 11 16:24:00 2003
+++ new/db.c Fri Jan 24 02:15:43 2003
@@ -64,31 +64,6 @@
#endif
/*
- * Globals.
- */
-HELP_DATA *help_first;
-HELP_DATA *help_last;
-
-HELP_AREA *had_list;
-
-SHOP_DATA *shop_first;
-SHOP_DATA *shop_last;
-
-MPROG_CODE *mprog_list;
-
-char bug_buf[2 * MAX_INPUT_LENGTH];
-CHAR_DATA *char_list;
-CHAR_DATA *player_list;
-const char *help_greeting;
-char log_buf[2 * MAX_INPUT_LENGTH];
-KILL_DATA kill_table[MAX_LEVEL];
-OBJ_DATA *object_list;
-TIME_INFO_DATA time_info;
-WEATHER_DATA weather_info;
-GQUEST gquest_info;
-WAR_DATA war_info;
-
-/*
* Locals.
*/
MOB_INDEX_DATA *mob_index_hash[MAX_KEY_HASH];
@@ -100,7 +75,6 @@
AREA_DATA *area_last;
AREA_DATA *current_area;
-char *string_space;
char *top_string;
char str_empty[1];
@@ -120,21 +94,13 @@
vnum_t top_vnum_obj; /* OLC */
int top_mprog_index; /* OLC */
int mobile_count = 0;
-int newmobs = 0;
-int newobjs = 0;
+const char *help_greeting;
-int maxClan;
-int maxCommands;
struct clan_type *clan_table;
-int maxSkill;
-int maxGroup;
-int maxRace;
-int maxClass;
/*
* Semi-locals.
*/
-bool fBootDb;
FILE *fpArea;
char strArea[MAX_INPUT_LENGTH];
@@ -144,7 +110,7 @@
void init_mm args((void));
void load_area args((FILE * fp));
void new_load_area args((FILE * fp)); /* OLC */
-void load_helps args((FILE * fp, char *fname));
+void load_helps args((FILE * fp));
void load_old_mob args((FILE * fp));
void load_old_obj args((FILE * fp));
void load_resets args((FILE * fp));
@@ -296,7 +262,7 @@
else if (!str_cmp(word, "AREADATA"))
new_load_area(fpArea);
else if (!str_cmp(word, "HELPS"))
- load_helps(fpArea, strArea);
+ load_helps(fpArea);
else if (!str_cmp(word, "MOBOLD"))
load_old_mob(fpArea);
else if (!str_cmp(word, "MOBILES"))
@@ -379,15 +345,7 @@
pArea->nplayer = 0;
pArea->empty = FALSE;
- if (!area_first)
- area_first = pArea;
- if (area_last)
- {
- area_last->next = pArea;
- REMOVE_BIT(area_last->area_flags, AREA_LOADING); /* OLC */
- }
- area_last = pArea;
- pArea->next = NULL;
+ LINK(pArea, area_first, area_last, next, prev);
current_area = pArea;
top_area++;
@@ -477,12 +435,7 @@
if (!str_cmp(word, "End"))
{
fMatch = TRUE;
- if (area_first == NULL)
- area_first = pArea;
- if (area_last != NULL)
- area_last->next = pArea;
- area_last = pArea;
- pArea->next = NULL;
+ LINK(pArea, area_first, area_last, next, prev);
current_area = pArea;
top_area++;
@@ -504,14 +457,14 @@
*/
void assign_area_vnum(vnum_t vnum)
{
- if (area_last->min_vnum == 0 || area_last->max_vnum == 0)
- area_last->min_vnum = area_last->max_vnum = vnum;
- if (vnum != URANGE(area_last->min_vnum, vnum, area_last->max_vnum))
+ if (current_area->min_vnum == 0 || current_area->max_vnum == 0)
+ current_area->min_vnum = current_area->max_vnum = vnum;
+ if (vnum != URANGE(current_area->min_vnum, vnum, current_area->max_vnum))
{
- if (vnum < area_last->min_vnum)
- area_last->min_vnum = vnum;
+ if (vnum < current_area->min_vnum)
+ current_area->min_vnum = vnum;
else
- area_last->max_vnum = vnum;
+ current_area->max_vnum = vnum;
}
return;
}
@@ -519,7 +472,7 @@
/*
* Snarf a help section.
*/
-void load_helps(FILE * fp, char *fname)
+void load_helps(FILE * fp)
{
HELP_DATA *pHelp;
int level;
@@ -527,36 +480,12 @@
for (;;)
{
- HELP_AREA *had;
-
level = fread_number(fp);
keyword = fread_string(fp);
if (keyword[0] == '$')
break;
- if (!had_list)
- {
- had = new_had();
- had->filename = str_dup(fname);
- had->area = current_area;
- if (current_area)
- current_area->helps = had;
- had_list = had;
- }
- else if (str_cmp(fname, had_list->filename))
- {
- had = new_had();
- had->filename = str_dup(fname);
- had->area = current_area;
- if (current_area)
- current_area->helps = had;
- had->next = had_list;
- had_list = had;
- }
- else
- had = had_list;
-
pHelp = new_help();
pHelp->level = level;
pHelp->keyword = keyword;
@@ -565,22 +494,7 @@
if (!str_cmp(pHelp->keyword, "greeting"))
help_greeting = pHelp->text;
- if (help_first == NULL)
- help_first = pHelp;
- if (help_last != NULL)
- help_last->next = pHelp;
-
- help_last = pHelp;
- pHelp->next = NULL;
-
- if (!had->first)
- had->first = pHelp;
- if (!had->last)
- had->last = pHelp;
-
- had->last->next_area = pHelp;
- had->last = pHelp;
- pHelp->next_area = NULL;
+ LINK(pHelp, help_first, help_last, next, prev);
top_help++;
}
@@ -598,7 +512,7 @@
int race;
char name[MAX_STRING_LENGTH];
- if (!area_last) /* OLC */
+ if (!current_area) /* OLC */
{
bug("Load_mobiles: no #AREA seen yet.", 0);
exit(1);
@@ -631,7 +545,7 @@
alloc_mem(pMobIndex, MOB_INDEX_DATA, 1);
pMobIndex->vnum = vnum;
- pMobIndex->area = area_last; /* OLC */
+ pMobIndex->area = current_area; /* OLC */
pMobIndex->new_format = FALSE;
pMobIndex->player_name = fread_string(fp);
pMobIndex->short_descr = fread_string(fp);
@@ -726,8 +640,7 @@
convert_mobile(pMobIndex); /* ROM OLC */
iHash = vnum % MAX_KEY_HASH;
- pMobIndex->next = mob_index_hash[iHash];
- mob_index_hash[iHash] = pMobIndex;
+ LINK_SINGLE(pMobIndex, next, mob_index_hash[iHash]);
top_mob_index++;
top_vnum_mob = top_vnum_mob < vnum ? vnum : top_vnum_mob; /* OLC */
assign_area_vnum(vnum); /* OLC */
@@ -744,7 +657,7 @@
{
OBJ_INDEX_DATA *pObjIndex;
- if (!area_last) /* OLC */
+ if (!current_area) /* OLC */
{
bug("Load_objects: no #AREA seen yet.", 0);
exit(1);
@@ -777,7 +690,7 @@
alloc_mem(pObjIndex, OBJ_INDEX_DATA, 1);
pObjIndex->vnum = vnum;
- pObjIndex->area = area_last; /* OLC */
+ pObjIndex->area = current_area; /* OLC */
pObjIndex->new_format = FALSE;
pObjIndex->reset_num = 0;
pObjIndex->name = fread_string(fp);
@@ -829,8 +742,8 @@
paf->location = fread_number(fp);
paf->modifier = fread_number(fp);
paf->bitvector = 0;
- paf->next = pObjIndex->affected;
- pObjIndex->affected = paf;
+ LINK(paf, pObjIndex->first_affect, pObjIndex->last_affect, next,
+ prev);
top_affect++;
}
@@ -841,8 +754,8 @@
alloc_mem(ed, EXTRA_DESCR_DATA, 1);
ed->keyword = fread_string(fp);
ed->description = fread_string(fp);
- ed->next = pObjIndex->extra_descr;
- pObjIndex->extra_descr = ed;
+ LINK(ed, pObjIndex->first_extra_descr,
+ pObjIndex->last_extra_descr, next, prev);
top_ed++;
}
@@ -876,8 +789,7 @@
}
iHash = vnum % MAX_KEY_HASH;
- pObjIndex->next = obj_index_hash[iHash];
- obj_index_hash[iHash] = pObjIndex;
+ LINK_SINGLE(pObjIndex, next, obj_index_hash[iHash]);
top_obj_index++;
top_vnum_obj = top_vnum_obj < vnum ? vnum : top_vnum_obj; /* OLC */
assign_area_vnum(vnum); /* OLC */
@@ -892,26 +804,10 @@
*/
void new_reset(ROOM_INDEX_DATA * pR, RESET_DATA * pReset)
{
- RESET_DATA *pr;
-
if (!pR)
return;
- pr = pR->reset_last;
-
- if (!pr)
- {
- pR->reset_first = pReset;
- pR->reset_last = pReset;
- }
- else
- {
- pR->reset_last->next = pReset;
- pR->reset_last = pReset;
- pR->reset_last->next = NULL;
- }
-
-/* top_reset++; no estamos asignando memoria!!!! */
+ LINK(pReset, pR->reset_first, pR->reset_last, next, prev);
return;
}
@@ -926,7 +822,7 @@
ROOM_INDEX_DATA *pRoomIndex;
vnum_t rVnum = -1;
- if (!area_last)
+ if (!current_area)
{
bug("Load_resets: no #AREA seen yet.", 0);
exit(1);
@@ -1023,7 +919,7 @@
{
ROOM_INDEX_DATA *pRoomIndex;
- if (area_last == NULL)
+ if (current_area == NULL)
{
bug("Load_resets: no #AREA seen yet.", 0);
exit(1);
@@ -1057,11 +953,11 @@
alloc_mem(pRoomIndex, ROOM_INDEX_DATA, 1);
pRoomIndex->owner = str_dup("");
- pRoomIndex->people = NULL;
+ pRoomIndex->first_person = NULL;
pRoomIndex->clan = -1;
- pRoomIndex->contents = NULL;
- pRoomIndex->extra_descr = NULL;
- pRoomIndex->area = area_last;
+ pRoomIndex->first_content = NULL;
+ pRoomIndex->first_extra_descr = NULL;
+ pRoomIndex->area = current_area;
pRoomIndex->vnum = vnum;
pRoomIndex->name = fread_string(fp);
pRoomIndex->description = fread_string(fp);
@@ -1159,8 +1055,8 @@
alloc_mem(ed, EXTRA_DESCR_DATA, 1);
ed->keyword = fread_string(fp);
ed->description = fread_string(fp);
- ed->next = pRoomIndex->extra_descr;
- pRoomIndex->extra_descr = ed;
+ LINK(ed, pRoomIndex->first_extra_descr,
+ pRoomIndex->last_extra_descr, next, prev);
top_ed++;
}
@@ -1184,8 +1080,7 @@
}
iHash = vnum % MAX_KEY_HASH;
- pRoomIndex->next = room_index_hash[iHash];
- room_index_hash[iHash] = pRoomIndex;
+ LINK_SINGLE(pRoomIndex, next, room_index_hash[iHash]);
top_room++;
if (!IS_SET(pRoomIndex->room_flags, ROOM_NOEXPLORE))
top_explored++;
@@ -1221,14 +1116,7 @@
fread_to_eol(fp);
pMobIndex = get_mob_index(pShop->keeper);
pMobIndex->pShop = pShop;
-
- if (shop_first == NULL)
- shop_first = pShop;
- if (shop_last != NULL)
- shop_last->next = pShop;
-
- shop_last = pShop;
- pShop->next = NULL;
+ LINK(pShop, shop_first, shop_last, next, prev);
top_shop++;
}
@@ -1416,7 +1304,7 @@
{
MPROG_CODE *pMprog;
- if (area_last == NULL)
+ if (current_area == NULL)
{
bug("Load_mobprogs: no #AREA seen yet.", 0);
exit(1);
@@ -1449,13 +1337,7 @@
alloc_mem(pMprog, MPROG_CODE, 1);
pMprog->vnum = vnum;
pMprog->code = fread_string(fp);
- if (mprog_list == NULL)
- mprog_list = pMprog;
- else
- {
- pMprog->next = mprog_list;
- mprog_list = pMprog;
- }
+ LINK(pMprog, mprog_first, mprog_last, next, prev);
top_mprog_index++;
}
return;
@@ -1476,10 +1358,10 @@
for (pMobIndex = mob_index_hash[iHash]; pMobIndex != NULL;
pMobIndex = pMobIndex->next)
{
- for (list = pMobIndex->mprogs; list != NULL; list = list->next)
+ for (list = pMobIndex->first_mprog; list != NULL; list = list->next)
{
if ((prog = get_mprog_index(list->vnum)) != NULL)
- list->code = prog->code;
+ replace_string(list->code, prog->code);
else
{
bug("Fix_mobprogs: code vnum %d not found.", list->vnum);
@@ -1600,7 +1482,8 @@
}
/* */
count = 0;
- for (mob = pRoomIndex->people; mob != NULL; mob = mob->next_in_room)
+ for (mob = pRoomIndex->first_person; mob != NULL;
+ mob = mob->next_in_room)
if (mob->pIndexData == pMobIndex)
{
count++;
@@ -1663,7 +1546,7 @@
}
if (pRoom->area->nplayer > 0 ||
- count_obj_list(pObjIndex, pRoom->contents) > 0)
+ count_obj_list(pObjIndex, pRoom->first_content) > 0)
{
last = FALSE;
break;
@@ -1700,7 +1583,7 @@
)
|| (count =
count_obj_list(pObjIndex,
- LastObj->contains)) > pReset->arg4)
+ LastObj->first_content)) > pReset->arg4)
{
last = FALSE;
break;
@@ -2116,8 +1999,7 @@
mob->position = mob->start_pos;
/* link the mob to the world list */
- mob->next = char_list;
- char_list = mob;
+ LINK(mob, char_first, char_last, next, prev);
pMobIndex->count++;
return mob;
}
@@ -2193,7 +2075,7 @@
clone->damage[i] = parent->damage[i];
/* now add the affects */
- for (paf = parent->affected; paf != NULL; paf = paf->next)
+ for (paf = parent->first_affect; paf != NULL; paf = paf->next)
affect_to_char(clone, paf);
}
@@ -2334,12 +2216,11 @@
break;
}
- for (paf = pObjIndex->affected; paf != NULL; paf = paf->next)
+ for (paf = pObjIndex->first_affect; paf != NULL; paf = paf->next)
if (paf->location == APPLY_SPELL_AFFECT)
affect_to_obj(obj, paf);
- obj->next = object_list;
- object_list = obj;
+ LINK(obj, object_first, object_last, next, prev);
pObjIndex->count++;
return obj;
@@ -2375,17 +2256,17 @@
/* affects */
clone->enchanted = parent->enchanted;
- for (paf = parent->affected; paf != NULL; paf = paf->next)
+ for (paf = parent->first_affect; paf != NULL; paf = paf->next)
affect_to_obj(clone, paf);
/* extended desc */
- for (ed = parent->extra_descr; ed != NULL; ed = ed->next)
+ for (ed = parent->first_extra_descr; ed != NULL; ed = ed->next)
{
ed_new = new_extra_descr();
ed_new->keyword = str_dup(ed->keyword);
ed_new->description = str_dup(ed->description);
- ed_new->next = clone->extra_descr;
- clone->extra_descr = ed_new;
+ LINK(ed_new, clone->first_extra_descr, clone->last_extra_descr, next,
+ prev);
}
}
@@ -2512,7 +2393,7 @@
MPROG_CODE *get_mprog_index(vnum_t vnum)
{
MPROG_CODE *prg;
- for (prg = mprog_list; prg; prg = prg->next)
+ for (prg = mprog_first; prg; prg = prg->next)
{
if (prg->vnum == vnum)
return (prg);
@@ -2589,7 +2470,8 @@
flag_t fread_flag(FILE * fp)
{
- flag_t number;
+ flag_t number, temp = 1;
+ flag_t flag;
char c;
bool negative = FALSE;
@@ -2599,39 +2481,59 @@
}
while (isspace(c));
- if (c == '-')
+ if (c != '+')
{
- negative = TRUE;
- c = getc(fp);
- }
+ if (c == '-')
+ {
+ negative = TRUE;
+ c = getc(fp);
+ }
- number = 0;
+ number = 0;
- if (!isdigit(c))
- {
- while (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z'))
+ if (!isdigit(c))
{
- number += flag_convert(c);
+ while (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z'))
+ {
+ number += flag_convert(c);
+ c = getc(fp);
+ }
+ }
+
+ while (isdigit(c))
+ {
+ number = number * 10 + c - '0';
c = getc(fp);
}
- }
- while (isdigit(c))
- {
- number = number * 10 + c - '0';
- c = getc(fp);
- }
+ if (c == '|')
+ number += fread_flag(fp);
- if (c == '|')
- number += fread_flag(fp);
+ else if (c != ' ')
+ ungetc(c, fp);
- else if (c != ' ')
- ungetc(c, fp);
+ if (negative)
+ return -1 * number;
- if (negative)
- return -1 * number;
+ return number;
+ }
+ else
+ {
+ number = 0;
+ flag = 0;
+ do
+ {
+ c = getc(fp);
+ flag += (temp << number) * (c == 'Y');
+ number++;
+ }
+ while (c == 'Y' || c == 'n');
- return number;
+ if (c == '\n' || c == '\r')
+ ungetc(c, fp);
+
+ return flag;
+ }
}
flag_t flag_convert(char letter)
@@ -2641,15 +2543,15 @@
if ('A' <= letter && letter <= 'Z')
{
- bitsum = 1;
+ bitsum = ((flag_t) 1 << 0);
for (i = letter; i > 'A'; i--)
- bitsum *= 2;
+ bitsum <<= 1;
}
else if ('a' <= letter && letter <= 'z')
{
- bitsum = 67108864; /* 2^26 */
+ bitsum = ((flag_t) 1 << 26);
for (i = letter; i > 'a'; i--)
- bitsum *= 2;
+ bitsum <<= 1;
}
return bitsum;
@@ -3035,12 +2937,12 @@
/* mobs */
count = 0;
count2 = 0;
- for (fch = char_list; fch != NULL; fch = fch->next)
+ for (fch = char_first; fch != NULL; fch = fch->next)
{
count++;
if (fch->pcdata != NULL)
num_pcs++;
- for (af = fch->affected; af != NULL; af = af->next)
+ for (af = fch->first_affect; af != NULL; af = af->next)
aff_count++;
}
for (fch = char_free; fch != NULL; fch = fch->next)
@@ -3060,7 +2962,7 @@
/* descriptors */
count = 0;
count2 = 0;
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
count++;
for (d = descriptor_free; d != NULL; d = d->next)
count2++;
@@ -3072,7 +2974,7 @@
for (vnum = 0; nMatch < top_obj_index; vnum++)
if ((pObjIndex = get_obj_index(vnum)) != NULL)
{
- for (af = pObjIndex->affected; af != NULL; af = af->next)
+ for (af = pObjIndex->first_affect; af != NULL; af = af->next)
aff_count++;
nMatch++;
}
@@ -3083,10 +2985,10 @@
/* objects */
count = 0;
count2 = 0;
- for (obj = object_list; obj != NULL; obj = obj->next)
+ for (obj = object_first; obj != NULL; obj = obj->next)
{
count++;
- for (af = obj->affected; af != NULL; af = af->next)
+ for (af = obj->first_affect; af != NULL; af = af->next)
aff_count++;
}
for (obj = obj_free; obj != NULL; obj = obj->next)
diff -ur src/db.h new/db.h
--- src/db.h Sat Jan 11 16:24:00 2003
+++ new/db.h Fri Jan 24 02:15:43 2003
@@ -29,30 +29,13 @@
#if !defined(DB_H)
#define DB_H
-/* vals from db.c */
-extern bool fBootDb;
-extern int newmobs;
-extern int newobjs;
-extern int maxSocial;
-
#define MAX_STRING 4000*1024
-extern char *string_space;
-extern int nAllocString;
-extern size_t sAllocString;
/* conversion from db.h */
void convert_mob(MOB_INDEX_DATA * mob);
void convert_obj(OBJ_INDEX_DATA * obj);
-/* externals for counting purposes */
-extern OBJ_DATA *obj_free;
-extern CHAR_DATA *char_free;
-extern DESCRIPTOR_DATA *descriptor_free;
-extern PC_DATA *pcdata_free;
-extern AFFECT_DATA *affect_free;
-
char *strspace_alloc();
-#define object_free obj_free
/* macro for flag swapping */
#define GET_UNSET(flag1,flag2) (~(flag1)&((flag1)|(flag2)))
diff -ur src/db2.c new/db2.c
--- src/db2.c Sat Jan 11 16:24:00 2003
+++ new/db2.c Fri Jan 24 02:15:43 2003
@@ -46,6 +46,8 @@
/* values for db2.c */
+extern AREA_DATA *current_area;
+
/*
* Snarf a mob section. new style
*/
@@ -53,7 +55,7 @@
{
MOB_INDEX_DATA *pMobIndex;
- if (!area_last) /* OLC */
+ if (!current_area) /* OLC */
{
bug("Load_mobiles: no #AREA seen yet.", 0);
exit(1);
@@ -86,7 +88,7 @@
alloc_mem(pMobIndex, MOB_INDEX_DATA, 1);
pMobIndex->vnum = vnum;
- pMobIndex->area = area_last; /* OLC */
+ pMobIndex->area = current_area; /* OLC */
pMobIndex->new_format = TRUE;
newmobs++;
pMobIndex->player_name = fread_string(fp);
@@ -202,7 +204,7 @@
alloc_mem(pMprog, MPROG_LIST, 1);
word = fread_word(fp);
- if ((trigger = flag_value(mprog_flags, word)) == NO_FLAG)
+ if ((trigger = flag_value(mprog_flags, word)) == 0)
{
bug("MOBprogs: invalid trigger.", 0);
exit(1);
@@ -211,8 +213,8 @@
pMprog->trig_type = trigger;
pMprog->vnum = fread_number(fp);
pMprog->trig_phrase = fread_string(fp);
- pMprog->next = pMobIndex->mprogs;
- pMobIndex->mprogs = pMprog;
+ LINK(pMprog, pMobIndex->first_mprog, pMobIndex->last_mprog,
+ next, prev);
}
else
{
@@ -222,8 +224,7 @@
}
iHash = vnum % MAX_KEY_HASH;
- pMobIndex->next = mob_index_hash[iHash];
- mob_index_hash[iHash] = pMobIndex;
+ LINK_SINGLE(pMobIndex, next, mob_index_hash[iHash]);
top_mob_index++;
top_vnum_mob = top_vnum_mob < vnum ? vnum : top_vnum_mob; /* OLC */
assign_area_vnum(vnum); /* OLC */
@@ -240,7 +241,7 @@
{
OBJ_INDEX_DATA *pObjIndex;
- if (!area_last) /* OLC */
+ if (!current_area) /* OLC */
{
bug("Load_objects: no #AREA seen yet.", 0);
exit(1);
@@ -273,7 +274,7 @@
alloc_mem(pObjIndex, OBJ_INDEX_DATA, 1);
pObjIndex->vnum = vnum;
- pObjIndex->area = area_last; /* OLC */
+ pObjIndex->area = current_area; /* OLC */
pObjIndex->new_format = TRUE;
pObjIndex->reset_num = 0;
newobjs++;
@@ -388,8 +389,8 @@
paf->location = fread_number(fp);
paf->modifier = fread_number(fp);
paf->bitvector = 0;
- paf->next = pObjIndex->affected;
- pObjIndex->affected = paf;
+ LINK(paf, pObjIndex->first_affect, pObjIndex->last_affect, next,
+ prev);
top_affect++;
}
@@ -423,8 +424,8 @@
paf->location = fread_number(fp);
paf->modifier = fread_number(fp);
paf->bitvector = fread_flag(fp);
- paf->next = pObjIndex->affected;
- pObjIndex->affected = paf;
+ LINK(paf, pObjIndex->first_affect, pObjIndex->last_affect, next,
+ prev);
top_affect++;
}
@@ -435,8 +436,8 @@
alloc_mem(ed, EXTRA_DESCR_DATA, 1);
ed->keyword = fread_string(fp);
ed->description = fread_string(fp);
- ed->next = pObjIndex->extra_descr;
- pObjIndex->extra_descr = ed;
+ LINK(ed, pObjIndex->first_extra_descr,
+ pObjIndex->last_extra_descr, next, prev);
top_ed++;
}
@@ -448,8 +449,7 @@
}
iHash = vnum % MAX_KEY_HASH;
- pObjIndex->next = obj_index_hash[iHash];
- obj_index_hash[iHash] = pObjIndex;
+ LINK_SINGLE(pObjIndex, next, obj_index_hash[iHash]);
top_obj_index++;
top_vnum_obj = top_vnum_obj < vnum ? vnum : top_vnum_obj; /* OLC */
assign_area_vnum(vnum); /* OLC */
@@ -817,25 +817,24 @@
* Increase MAX_STRING if you have too.
* Tune the others only if you understand what you're doing.
*/
-int nAllocString;
-size_t sAllocString;
#define IMP_COUNTER( type, start, px) \
int px##type(); \
int px##type() { type * p = start; int n = 0; while( p!=NULL ) { p= p->next; n++; } return n; }
#define IMP_LIST_COUNTERS( type, prefix ) \
- IMP_COUNTER( type, prefix##list, n ) \
+ IMP_COUNTER( type, prefix##first, n ) \
IMP_COUNTER( type, prefix##free, f )
// these object types have no global list
IMP_COUNTER(PC_DATA, pcdata_free, f) IMP_COUNTER(AFFECT_DATA, affect_free, f)
// these do
+#define object_free obj_free
IMP_LIST_COUNTERS(OBJ_DATA, object_);
IMP_LIST_COUNTERS(CHAR_DATA, char_);
IMP_LIST_COUNTERS(DESCRIPTOR_DATA, descriptor_);
-IMP_COUNTER(MPROG_CODE, mprog_list, n);
+IMP_COUNTER(MPROG_CODE, mprog_first, n);
int nNOTE_DATA(void)
{
diff -ur src/effects.c new/effects.c
--- src/effects.c Sat Jan 11 16:24:00 2003
+++ new/effects.c Fri Jan 24 02:15:43 2003
@@ -41,7 +41,7 @@
ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo;
OBJ_DATA *obj, *obj_next;
- for (obj = room->contents; obj != NULL; obj = obj_next)
+ for (obj = room->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
acid_effect(obj, level, dam, TARGET_OBJ);
@@ -55,7 +55,7 @@
OBJ_DATA *obj, *obj_next;
/* let's toast some gear */
- for (obj = victim->carrying; obj != NULL; obj = obj_next)
+ for (obj = victim->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
acid_effect(obj, level, dam, TARGET_OBJ);
@@ -119,8 +119,8 @@
if (obj->carried_by != NULL)
act(msg, obj->carried_by, obj, NULL, TO_ALL);
- else if (obj->in_room != NULL && obj->in_room->people != NULL)
- act(msg, obj->in_room->people, obj, NULL, TO_ALL);
+ else if (obj->in_room != NULL && obj->in_room->first_person != NULL)
+ act(msg, obj->in_room->first_person, obj, NULL, TO_ALL);
if (obj->item_type == ITEM_ARMOR) /* etch it */
{
@@ -130,7 +130,7 @@
affect_enchant(obj);
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
if (paf->location == APPLY_AC)
{
@@ -153,8 +153,7 @@
paf->location = APPLY_AC;
paf->modifier = 1;
paf->bitvector = 0;
- paf->next = obj->affected;
- obj->affected = paf;
+ LINK(paf, obj->first_affect, obj->last_affect, next, prev);
}
if (obj->carried_by != NULL && obj->wear_loc != WEAR_NONE)
@@ -164,9 +163,9 @@
}
/* get rid of the object */
- if (obj->contains) /* dump contents */
+ if (obj->first_content) /* dump contents */
{
- for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj)
+ for (t_obj = obj->first_content; t_obj != NULL; t_obj = n_obj)
{
n_obj = t_obj->next_content;
obj_from_obj(t_obj);
@@ -196,7 +195,7 @@
ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo;
OBJ_DATA *obj, *obj_next;
- for (obj = room->contents; obj != NULL; obj = obj_next)
+ for (obj = room->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
cold_effect(obj, level, dam, TARGET_OBJ);
@@ -232,7 +231,7 @@
gain_condition(victim, COND_HUNGER, dam / 20);
/* let's toast some gear */
- for (obj = victim->carrying; obj != NULL; obj = obj_next)
+ for (obj = victim->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
cold_effect(obj, level, dam, TARGET_OBJ);
@@ -283,8 +282,8 @@
if (obj->carried_by != NULL)
act(msg, obj->carried_by, obj, NULL, TO_ALL);
- else if (obj->in_room != NULL && obj->in_room->people != NULL)
- act(msg, obj->in_room->people, obj, NULL, TO_ALL);
+ else if (obj->in_room != NULL && obj->in_room->first_person != NULL)
+ act(msg, obj->in_room->first_person, obj, NULL, TO_ALL);
extract_obj(obj);
return;
@@ -298,7 +297,7 @@
ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo;
OBJ_DATA *obj, *obj_next;
- for (obj = room->contents; obj != NULL; obj = obj_next)
+ for (obj = room->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
fire_effect(obj, level, dam, TARGET_OBJ);
@@ -336,7 +335,7 @@
gain_condition(victim, COND_THIRST, dam / 20);
/* let's toast some gear! */
- for (obj = victim->carrying; obj != NULL; obj = obj_next)
+ for (obj = victim->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
@@ -404,14 +403,14 @@
if (obj->carried_by != NULL)
act(msg, obj->carried_by, obj, NULL, TO_ALL);
- else if (obj->in_room != NULL && obj->in_room->people != NULL)
- act(msg, obj->in_room->people, obj, NULL, TO_ALL);
+ else if (obj->in_room != NULL && obj->in_room->first_person != NULL)
+ act(msg, obj->in_room->first_person, obj, NULL, TO_ALL);
- if (obj->contains)
+ if (obj->first_content)
{
/* dump the contents */
- for (t_obj = obj->contains; t_obj != NULL; t_obj = n_obj)
+ for (t_obj = obj->first_content; t_obj != NULL; t_obj = n_obj)
{
n_obj = t_obj->next_content;
obj_from_obj(t_obj);
@@ -440,7 +439,7 @@
ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo;
OBJ_DATA *obj, *obj_next;
- for (obj = room->contents; obj != NULL; obj = obj_next)
+ for (obj = room->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
poison_effect(obj, level, dam, TARGET_OBJ);
@@ -472,7 +471,7 @@
}
/* equipment */
- for (obj = victim->carrying; obj != NULL; obj = obj_next)
+ for (obj = victim->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
poison_effect(obj, level, dam, TARGET_OBJ);
@@ -526,7 +525,7 @@
ROOM_INDEX_DATA *room = (ROOM_INDEX_DATA *) vo;
OBJ_DATA *obj, *obj_next;
- for (obj = room->contents; obj != NULL; obj = obj_next)
+ for (obj = room->first_content; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
shock_effect(obj, level, dam, TARGET_OBJ);
@@ -547,7 +546,7 @@
}
/* toast some gear */
- for (obj = victim->carrying; obj != NULL; obj = obj_next)
+ for (obj = victim->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
shock_effect(obj, level, dam, TARGET_OBJ);
@@ -598,8 +597,8 @@
if (obj->carried_by != NULL)
act(msg, obj->carried_by, obj, NULL, TO_ALL);
- else if (obj->in_room != NULL && obj->in_room->people != NULL)
- act(msg, obj->in_room->people, obj, NULL, TO_ALL);
+ else if (obj->in_room != NULL && obj->in_room->first_person != NULL)
+ act(msg, obj->in_room->first_person, obj, NULL, TO_ALL);
extract_obj(obj);
return;
diff -ur src/fight.c new/fight.c
--- src/fight.c Sat Jan 11 16:24:00 2003
+++ new/fight.c Fri Jan 24 02:15:43 2003
@@ -62,7 +62,7 @@
CHAR_DATA *ch_next;
CHAR_DATA *victim;
- for (ch = char_list; ch != NULL; ch = ch_next)
+ for (ch = char_first; ch != NULL; ch = ch_next)
{
ch_next = ch->next;
@@ -106,7 +106,7 @@
{
CHAR_DATA *rch, *rch_next;
- for (rch = ch->in_room->people; rch != NULL; rch = rch_next)
+ for (rch = ch->in_room->first_person; rch != NULL; rch = rch_next)
{
rch_next = rch->next_in_room;
@@ -169,7 +169,7 @@
target = NULL;
number = 0;
- for (vch = ch->in_room->people; vch; vch = vch->next)
+ for (vch = ch->in_room->first_person; vch; vch = vch->next)
{
if (can_see(rch, vch) &&
is_same_group(vch, victim) &&
@@ -277,7 +277,7 @@
if (IS_SET(ch->off_flags, OFF_AREA_ATTACK))
{
- for (vch = ch->in_room->people; vch != NULL; vch = vch_next)
+ for (vch = ch->in_room->first_person; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
if ((vch != victim && vch->fighting == ch))
@@ -618,7 +618,7 @@
int level;
AFFECT_DATA *poison, af;
- if ((poison = affect_find(wield->affected, gsn_poison)) == NULL)
+ if ((poison = affect_find(wield->first_affect, gsn_poison)) == NULL)
level = wield->level;
else
level = poison->level;
@@ -994,23 +994,23 @@
if (!IS_NPC(ch) &&
(corpse =
- get_obj_list(ch, "corpse", ch->in_room->contents)) != NULL
+ get_obj_list(ch, "corpse", ch->in_room->first_content)) != NULL
&& corpse->item_type == ITEM_CORPSE_NPC && can_see_obj(ch, corpse))
{
OBJ_DATA *coins;
- corpse = get_obj_list(ch, "corpse", ch->in_room->contents);
+ corpse = get_obj_list(ch, "corpse", ch->in_room->first_content);
- if (IS_SET(ch->act, PLR_AUTOLOOT) && corpse && corpse->contains) /* exists and not empty */
+ if (IS_SET(ch->act, PLR_AUTOLOOT) && corpse && corpse->first_content) /* exists and not empty */
{
do_function(ch, &do_get, "all corpse");
}
- if (IS_SET(ch->act, PLR_AUTOGOLD) && corpse && corpse->contains && /* exists and not empty */
+ if (IS_SET(ch->act, PLR_AUTOGOLD) && corpse && corpse->first_content && /* exists and not empty */
!IS_SET(ch->act, PLR_AUTOLOOT))
{
if ((coins =
- get_obj_list(ch, "gcash", corpse->contains)) != NULL)
+ get_obj_list(ch, "gcash", corpse->first_content)) != NULL)
{
do_function(ch, &do_get, "all.gcash corpse");
}
@@ -1018,7 +1018,8 @@
if (IS_SET(ch->act, PLR_AUTOSAC))
{
- if (IS_SET(ch->act, PLR_AUTOLOOT) && corpse && corpse->contains)
+ if (IS_SET(ch->act, PLR_AUTOLOOT) && corpse
+ && corpse->first_content)
{
return TRUE; /* leave if corpse has treasure */
}
@@ -1514,7 +1515,7 @@
{
CHAR_DATA *fch;
- for (fch = char_list; fch != NULL; fch = fch->next)
+ for (fch = char_first; fch != NULL; fch = fch->next)
{
if (fch == ch || (fBoth && fch->fighting == ch))
{
@@ -1584,7 +1585,7 @@
free_string(corpse->description);
corpse->description = str_dup(buf);
- for (obj = ch->carrying; obj != NULL; obj = obj_next)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj_next)
{
bool floating = FALSE;
@@ -1609,13 +1610,13 @@
{
if (IS_OBJ_STAT(obj, ITEM_ROT_DEATH)) /* get rid of it! */
{
- if (obj->contains != NULL)
+ if (obj->first_content != NULL)
{
OBJ_DATA *in, *in_next;
act("$p evaporates,scattering its contents.",
ch, obj, NULL, TO_ROOM);
- for (in = obj->contains; in != NULL; in = in_next)
+ for (in = obj->first_content; in != NULL; in = in_next)
{
in_next = in->next_content;
obj_from_obj(in);
@@ -1777,8 +1778,8 @@
}
extract_char(victim, FALSE);
- while (victim->affected)
- affect_remove(victim, victim->affected);
+ while (victim->first_affect)
+ affect_remove(victim, victim->first_affect);
victim->affected_by = race_table[victim->race].aff;
for (i = 0; i < 4; i++)
victim->armor[i] = 100;
@@ -1811,7 +1812,7 @@
members = 0;
group_levels = 0;
- for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
+ for (gch = ch->in_room->first_person; gch != NULL; gch = gch->next_in_room)
{
if (is_same_group(gch, ch))
{
@@ -1829,7 +1830,7 @@
lch = (ch->leader != NULL) ? ch->leader : ch;
- for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
+ for (gch = ch->in_room->first_person; gch != NULL; gch = gch->next_in_room)
{
OBJ_DATA *obj;
OBJ_DATA *obj_next;
@@ -1895,7 +1896,7 @@
"You are now ready to complete the global quest. Type 'GQUEST COMPLETE' to finish.");
}
- for (obj = ch->carrying; obj != NULL; obj = obj_next)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
if (obj->wear_loc == WEAR_NONE)
diff -ur src/flags.c new/flags.c
--- src/flags.c Sat Jan 11 16:24:00 2003
+++ new/flags.c Fri Jan 24 02:15:43 2003
@@ -201,7 +201,7 @@
pos = flag_value(flag_table, word);
- if (pos == NO_FLAG)
+ if (pos == 0)
{
chprintln(ch, "That flag doesn't exist!");
return;
Only in new/: globals.h
diff -ur src/gquest.c new/gquest.c
--- src/gquest.c Sat Jan 11 16:24:00 2003
+++ new/gquest.c Fri Jan 24 02:15:43 2003
@@ -38,11 +38,13 @@
struct gquest_hist
{
GQUEST_HIST *next;
+ GQUEST_HIST *prev;
const char *short_descr;
const char *text;
};
GQUEST_HIST *gqhist_first = NULL;
+GQUEST_HIST *gqhist_last = NULL;
bool save_gquest_data(void)
{
@@ -223,7 +225,7 @@
CHAR_DATA *registar = NULL;
int mobs, blevel, elevel, cost;
- for (registar = ch->in_room->people; registar != NULL;
+ for (registar = ch->in_room->first_person; registar != NULL;
registar = registar->next_in_room)
{
if (!IS_NPC(registar))
@@ -357,7 +359,7 @@
if (gquest_info.running != GQUEST_OFF)
return;
- for (wch = char_list; wch != NULL; wch = wch->next)
+ for (wch = char_first; wch != NULL; wch = wch->next)
{
if (!IS_NPC(wch) && !IS_IMMORTAL(wch))
{
@@ -381,7 +383,7 @@
minlvl = number_range(minlvl, middle - lbonus);
maxlvl = number_range(middle + lbonus, maxlvl);
/* find the registar mob if he exits, (not needed only put in for RP aspects) */
- for (registar = char_list; registar != NULL; registar = registar->next)
+ for (registar = char_first; registar != NULL; registar = registar->next)
{
if (!IS_NPC(registar))
continue;
@@ -431,7 +433,7 @@
add_buf(output, buf);
sprintf(buf, "Those Playing\n\r-------------\n\r");
add_buf(output, buf);
- for (wch = char_list; wch != NULL; wch = wch->next)
+ for (wch = char_first; wch != NULL; wch = wch->next)
if (!IS_NPC(ch) && ON_GQUEST(wch)
&& count_gqmobs(wch) != gquest_info.mob_count)
sprintf(buf, "%s [%d mobs left]\n\r", wch->name,
@@ -458,8 +460,7 @@
}
}
hist->text = str_dup(buf_string(output));
- hist->next = gqhist_first;
- gqhist_first = hist;
+ LINK(hist, gqhist_first, gqhist_last, next, prev);
free_buf(output);
return;
}
@@ -700,7 +701,7 @@
chprintln(ch, "The global quest hasn't started yet.");
return;
}
- for (wch = char_list; wch != NULL; wch = wch->next)
+ for (wch = char_first; wch != NULL; wch = wch->next)
{
if (!IS_NPC(wch) && ON_GQUEST(wch) && wch != ch)
{
@@ -800,7 +801,7 @@
reset_gqmob(NULL, 0);
gquest_info.last_registar = who;
- for (wch = char_list; wch != NULL; wch = wch->next)
+ for (wch = char_first; wch != NULL; wch = wch->next)
{
if (!IS_NPC(wch) && IS_SET(wch->act, PLR_GQUEST))
{
@@ -910,7 +911,7 @@
mob_count = 0;
alloc_mem(vnums, vnum_t, top_mob_index);
- for (victim = char_list; victim; victim = victim->next)
+ for (victim = char_first; victim; victim = victim->next)
{
if (!IS_NPC(victim))
{
diff -ur src/handler.c new/handler.c
--- src/handler.c Sat Jan 11 16:24:00 2003
+++ new/handler.c Fri Jan 24 02:15:43 2003
@@ -95,7 +95,7 @@
if (obj->in_room == NULL)
return 0;
- for (fch = obj->in_room->people; fch != NULL; fch = fch->next_in_room)
+ for (fch = obj->in_room->first_person; fch != NULL; fch = fch->next_in_room)
if (fch->on == obj)
count++;
@@ -173,7 +173,7 @@
/* returns a flag for wiznet */
int wiznet_lookup(const char *name)
{
- flag_t flag;
+ int flag;
for (flag = 0; wiznet_table[flag].name != NULL; flag++)
{
@@ -524,7 +524,8 @@
if (obj == NULL)
continue;
if (!obj->enchanted)
- for (af = obj->pIndexData->affected; af != NULL; af = af->next)
+ for (af = obj->pIndexData->first_affect; af != NULL;
+ af = af->next)
{
mod = af->modifier;
switch (af->location)
@@ -546,7 +547,7 @@
}
}
- for (af = obj->affected; af != NULL; af = af->next)
+ for (af = obj->first_affect; af != NULL; af = af->next)
{
mod = af->modifier;
switch (af->location)
@@ -609,7 +610,7 @@
ch->armor[i] -= apply_ac(obj, loc, i);
if (!obj->enchanted)
- for (af = obj->pIndexData->affected; af != NULL; af = af->next)
+ for (af = obj->pIndexData->first_affect; af != NULL; af = af->next)
{
mod = af->modifier;
switch (af->location)
@@ -672,7 +673,7 @@
}
}
- for (af = obj->affected; af != NULL; af = af->next)
+ for (af = obj->first_affect; af != NULL; af = af->next)
{
mod = af->modifier;
switch (af->location)
@@ -737,7 +738,7 @@
}
/* now add back spell effects */
- for (af = ch->affected; af != NULL; af = af->next)
+ for (af = ch->first_affect; af != NULL; af = af->next)
{
mod = af->modifier;
switch (af->location)
@@ -970,12 +971,11 @@
AFFECT_DATA *paf, *af_new;
obj->enchanted = TRUE;
- for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->pIndexData->first_affect; paf != NULL; paf = paf->next)
{
af_new = new_affect();
- af_new->next = obj->affected;
- obj->affected = af_new;
+ LINK(af_new, obj->first_affect, obj->last_affect, next, prev);
af_new->where = paf->where;
af_new->type = UMAX(0, paf->type);
@@ -1161,7 +1161,7 @@
if (where == TO_OBJECT || where == TO_WEAPON || vector == 0)
return;
- for (paf = ch->affected; paf != NULL; paf = paf->next)
+ for (paf = ch->first_affect; paf != NULL; paf = paf->next)
if (paf->where == where && paf->bitvector == vector)
{
switch (where)
@@ -1182,12 +1182,12 @@
return;
}
- for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj->next_content)
{
if (obj->wear_loc == -1)
continue;
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
if (paf->where == where && paf->bitvector == vector)
{
switch (where)
@@ -1211,7 +1211,7 @@
if (obj->enchanted)
continue;
- for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->pIndexData->first_affect; paf != NULL; paf = paf->next)
if (paf->where == where && paf->bitvector == vector)
{
switch (where)
@@ -1246,8 +1246,7 @@
*paf_new = *paf;
VALIDATE(paf_new); /* in case we missed it when we set up paf */
- paf_new->next = ch->affected;
- ch->affected = paf_new;
+ LINK(paf_new, ch->first_affect, ch->last_affect, next, prev);
affect_modify(ch, paf_new, TRUE);
return;
@@ -1263,8 +1262,7 @@
*paf_new = *paf;
VALIDATE(paf_new); /* in case we missed it when we set up paf */
- paf_new->next = obj->affected;
- obj->affected = paf_new;
+ LINK(paf_new, obj->first_affect, obj->last_affect, next, prev);
/* apply any affect vectors to the object's extra_flags */
if (paf->bitvector)
@@ -1290,7 +1288,7 @@
int where;
flag_t vector;
- if (ch->affected == NULL)
+ if (ch->first_affect == NULL)
{
bug("Affect_remove: no affect.", 0);
return;
@@ -1300,29 +1298,7 @@
where = paf->where;
vector = paf->bitvector;
- if (paf == ch->affected)
- {
- ch->affected = paf->next;
- }
- else
- {
- AFFECT_DATA *prev;
-
- for (prev = ch->affected; prev != NULL; prev = prev->next)
- {
- if (prev->next == paf)
- {
- prev->next = paf->next;
- break;
- }
- }
-
- if (prev == NULL)
- {
- bug("Affect_remove: cannot find paf.", 0);
- return;
- }
- }
+ UNLINK(paf, ch->first_affect, ch->last_affect, next, prev);
free_affect(paf);
@@ -1335,7 +1311,7 @@
int where;
flag_t vector;
- if (obj->affected == NULL)
+ if (obj->first_affect == NULL)
{
bug("Affect_remove_object: no affect.", 0);
return;
@@ -1360,29 +1336,7 @@
break;
}
- if (paf == obj->affected)
- {
- obj->affected = paf->next;
- }
- else
- {
- AFFECT_DATA *prev;
-
- for (prev = obj->affected; prev != NULL; prev = prev->next)
- {
- if (prev->next == paf)
- {
- prev->next = paf->next;
- break;
- }
- }
-
- if (prev == NULL)
- {
- bug("Affect_remove_object: cannot find paf.", 0);
- return;
- }
- }
+ UNLINK(paf, obj->first_affect, obj->last_affect, next, prev);
free_affect(paf);
@@ -1399,7 +1353,7 @@
AFFECT_DATA *paf;
AFFECT_DATA *paf_next;
- for (paf = ch->affected; paf != NULL; paf = paf_next)
+ for (paf = ch->first_affect; paf != NULL; paf = paf_next)
{
paf_next = paf->next;
if (paf->type == sn)
@@ -1416,7 +1370,7 @@
{
AFFECT_DATA *paf;
- for (paf = ch->affected; paf != NULL; paf = paf->next)
+ for (paf = ch->first_affect; paf != NULL; paf = paf->next)
{
if (paf->type == sn)
return TRUE;
@@ -1434,7 +1388,7 @@
bool found;
found = FALSE;
- for (paf_old = ch->affected; paf_old != NULL; paf_old = paf_old->next)
+ for (paf_old = ch->first_affect; paf_old != NULL; paf_old = paf_old->next)
{
if (paf_old->type == paf->type)
{
@@ -1471,26 +1425,8 @@
ch->in_room->light > 0)
--ch->in_room->light;
- if (ch == ch->in_room->people)
- {
- ch->in_room->people = ch->next_in_room;
- }
- else
- {
- CHAR_DATA *prev;
-
- for (prev = ch->in_room->people; prev; prev = prev->next_in_room)
- {
- if (prev->next_in_room == ch)
- {
- prev->next_in_room = ch->next_in_room;
- break;
- }
- }
-
- if (prev == NULL)
- bug("Char_from_room: ch not found.", 0);
- }
+ UNLINK(ch, ch->in_room->first_person, ch->in_room->last_person,
+ next_in_room, prev_in_room);
ch->in_room = NULL;
ch->next_in_room = NULL;
@@ -1518,8 +1454,8 @@
}
ch->in_room = pRoomIndex;
- ch->next_in_room = pRoomIndex->people;
- pRoomIndex->people = ch;
+ LINK(ch, pRoomIndex->first_person, pRoomIndex->last_person, next_in_room,
+ prev_in_room);
if (!IS_NPC(ch))
{
@@ -1542,7 +1478,7 @@
AFFECT_DATA *af, plague;
CHAR_DATA *vch;
- for (af = ch->affected; af != NULL; af = af->next)
+ for (af = ch->first_affect; af != NULL; af = af->next)
{
if (af->type == gsn_plague)
break;
@@ -1565,7 +1501,8 @@
plague.modifier = -5;
plague.bitvector = AFF_PLAGUE;
- for (vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room)
+ for (vch = ch->in_room->first_person; vch != NULL;
+ vch = vch->next_in_room)
{
if (!saves_spell(plague.level - 2, vch, DAM_DISEASE) &&
!IS_IMMORTAL(vch) && !IS_AFFECTED(vch, AFF_PLAGUE)
@@ -1586,8 +1523,8 @@
*/
void obj_to_char(OBJ_DATA * obj, CHAR_DATA * ch)
{
- obj->next_content = ch->carrying;
- ch->carrying = obj;
+ LINK(obj, ch->first_carrying, ch->last_carrying, next_content,
+ prev_content);
obj->carried_by = ch;
obj->in_room = NULL;
obj->in_obj = NULL;
@@ -1615,26 +1552,8 @@
if (obj->wear_loc != WEAR_NONE)
unequip_char(ch, obj);
- if (ch->carrying == obj)
- {
- ch->carrying = obj->next_content;
- }
- else
- {
- OBJ_DATA *prev;
-
- for (prev = ch->carrying; prev != NULL; prev = prev->next_content)
- {
- if (prev->next_content == obj)
- {
- prev->next_content = obj->next_content;
- break;
- }
- }
-
- if (prev == NULL)
- bug("Obj_from_char: obj not in list.", 0);
- }
+ UNLINK(obj, ch->first_carrying, ch->last_carrying, next_content,
+ prev_content);
obj->carried_by = NULL;
obj->next_content = NULL;
@@ -1696,7 +1615,7 @@
if (ch == NULL)
return NULL;
- for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj->next_content)
{
if (obj->wear_loc == iWear)
return obj;
@@ -1738,10 +1657,10 @@
obj->wear_loc = iWear;
if (!obj->enchanted)
- for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->pIndexData->first_affect; paf != NULL; paf = paf->next)
if (paf->location != APPLY_SPELL_AFFECT)
affect_modify(ch, paf, TRUE);
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
if (paf->location == APPLY_SPELL_AFFECT)
affect_to_char(ch, paf);
else
@@ -1776,10 +1695,10 @@
if (!obj->enchanted)
{
- for (paf = obj->pIndexData->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->pIndexData->first_affect; paf != NULL; paf = paf->next)
if (paf->location == APPLY_SPELL_AFFECT)
{
- for (lpaf = ch->affected; lpaf != NULL; lpaf = lpaf_next)
+ for (lpaf = ch->first_affect; lpaf != NULL; lpaf = lpaf_next)
{
lpaf_next = lpaf->next;
if ((lpaf->type == paf->type) &&
@@ -1797,11 +1716,11 @@
affect_check(ch, paf->where, paf->bitvector);
}
}
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
if (paf->location == APPLY_SPELL_AFFECT)
{
bug("Norm-Apply: %d", 0);
- for (lpaf = ch->affected; lpaf != NULL; lpaf = lpaf_next)
+ for (lpaf = ch->first_affect; lpaf != NULL; lpaf = lpaf_next)
{
lpaf_next = lpaf->next;
if ((lpaf->type == paf->type) &&
@@ -1860,33 +1779,11 @@
return;
}
- for (ch = in_room->people; ch != NULL; ch = ch->next_in_room)
+ for (ch = in_room->first_person; ch != NULL; ch = ch->next_in_room)
if (ch->on == obj)
ch->on = NULL;
- if (obj == in_room->contents)
- {
- in_room->contents = obj->next_content;
- }
- else
- {
- OBJ_DATA *prev;
-
- for (prev = in_room->contents; prev; prev = prev->next_content)
- {
- if (prev->next_content == obj)
- {
- prev->next_content = obj->next_content;
- break;
- }
- }
-
- if (prev == NULL)
- {
- bug("Obj_from_room: obj not found.", 0);
- return;
- }
- }
+ UNLINK(obj, in_room->first_content, in_room->last_content, next, prev);
obj->in_room = NULL;
obj->next_content = NULL;
@@ -1900,8 +1797,7 @@
{
if (IS_OBJ_STAT(obj, ITEM_AUCTIONED))
return;
- obj->next_content = pRoomIndex->contents;
- pRoomIndex->contents = obj;
+ LINK(obj, pRoomIndex->first_content, pRoomIndex->last_content, next, prev);
obj->in_room = pRoomIndex;
obj->carried_by = NULL;
obj->in_obj = NULL;
@@ -1919,8 +1815,8 @@
if (IS_OBJ_STAT(obj, ITEM_AUCTIONED))
return;
- obj->next_content = obj_to->contains;
- obj_to->contains = obj;
+ LINK(obj, obj_to->first_content, obj_to->last_content, next_content,
+ prev_content);
obj->in_obj = obj_to;
obj->in_room = NULL;
obj->carried_by = NULL;
@@ -1957,29 +1853,8 @@
return;
}
- if (obj == obj_from->contains)
- {
- obj_from->contains = obj->next_content;
- }
- else
- {
- OBJ_DATA *prev;
-
- for (prev = obj_from->contains; prev; prev = prev->next_content)
- {
- if (prev->next_content == obj)
- {
- prev->next_content = obj->next_content;
- break;
- }
- }
-
- if (prev == NULL)
- {
- bug("Obj_from_obj: obj not found.", 0);
- return;
- }
- }
+ UNLINK(obj, obj_from->first_content, obj_from->last_content, next_content,
+ prev_content);
obj->next_content = NULL;
obj->in_obj = NULL;
@@ -2013,35 +1888,13 @@
else if (obj->in_obj != NULL)
obj_from_obj(obj);
- for (obj_content = obj->contains; obj_content; obj_content = obj_next)
+ for (obj_content = obj->first_content; obj_content; obj_content = obj_next)
{
obj_next = obj_content->next_content;
extract_obj(obj_content);
}
- if (object_list == obj)
- {
- object_list = obj->next;
- }
- else
- {
- OBJ_DATA *prev;
-
- for (prev = object_list; prev != NULL; prev = prev->next)
- {
- if (prev->next == obj)
- {
- prev->next = obj->next;
- break;
- }
- }
-
- if (prev == NULL)
- {
- bug("Extract_obj: obj %d not found.", obj->pIndexData->vnum);
- return;
- }
- }
+ UNLINK(obj, object_first, object_last, next, prev);
--obj->pIndexData->count;
free_obj(obj);
@@ -2084,7 +1937,7 @@
stop_fighting(ch, TRUE);
- for (obj = ch->carrying; obj != NULL; obj = obj_next)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj_next)
{
obj_next = obj->next_content;
extract_obj(obj);
@@ -2112,7 +1965,7 @@
ch->desc = NULL;
}
- for (wch = char_list; wch != NULL; wch = wch->next)
+ for (wch = char_first; wch != NULL; wch = wch->next)
{
if (wch->reply == ch)
wch->reply = NULL;
@@ -2120,49 +1973,10 @@
wch->mprog_target = NULL;
}
- if (ch == char_list)
- {
- char_list = ch->next;
- }
- else
- {
- CHAR_DATA *prev;
-
- for (prev = char_list; prev != NULL; prev = prev->next)
- {
- if (prev->next == ch)
- {
- prev->next = ch->next;
- break;
- }
- }
-
- if (prev == NULL)
- {
- bug("Extract_char: char not found.", 0);
- return;
- }
- }
+ UNLINK(ch, char_first, char_last, next, prev);
if (!IS_NPC(ch))
- {
- if (ch == player_list)
- {
- player_list = ch->next_player;
- }
- else
- {
- CHAR_DATA *prev;
- for (prev = player_list; prev != NULL; prev = prev->next_player)
- {
- if (prev->next_player == ch)
- {
- prev->next_player = ch->next_player;
- break;
- }
- }
- }
- }
+ UNLINK(ch, player_first, player_last, next, prev);
if (ch->desc != NULL)
ch->desc->character = NULL;
@@ -2184,7 +1998,7 @@
count = 0;
if (!str_cmp(arg, "self"))
return ch;
- for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = ch->in_room->first_person; rch != NULL; rch = rch->next_in_room)
{
if (!can_see(ch, rch) || !is_name(arg, rch->name))
continue;
@@ -2210,7 +2024,7 @@
number = number_argument(argument, arg);
count = 0;
- for (wch = char_list; wch != NULL; wch = wch->next)
+ for (wch = char_first; wch != NULL; wch = wch->next)
{
if (wch->in_room == NULL || !can_see(ch, wch) ||
!is_name(arg, wch->name))
@@ -2230,7 +2044,7 @@
{
OBJ_DATA *obj;
- for (obj = object_list; obj != NULL; obj = obj->next)
+ for (obj = object_first; obj != NULL; obj = obj->next)
{
if (obj->pIndexData == pObjIndex)
return obj;
@@ -2276,7 +2090,7 @@
number = number_argument(argument, arg);
count = 0;
- for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = ch->first_carryinShowing the first 100 KB of 229.3 KB. Download the archive for the full file.