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_carrying; obj != NULL; obj = obj->next_content)
{
if (obj->wear_loc == WEAR_NONE && (can_see_obj(viewer, obj)) &&
is_name(arg, obj->name))
@@ -2301,7 +2115,7 @@
number = number_argument(argument, arg);
count = 0;
- 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 != WEAR_NONE && can_see_obj(ch, obj) &&
is_name(arg, obj->name))
@@ -2321,7 +2135,7 @@
{
OBJ_DATA *obj;
- obj = get_obj_list(ch, argument, ch->in_room->contents);
+ obj = get_obj_list(ch, argument, ch->in_room->first_content);
if (obj != NULL)
return obj;
@@ -2349,7 +2163,7 @@
number = number_argument(argument, arg);
count = 0;
- 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(arg, obj->name))
{
@@ -2463,7 +2277,7 @@
else
number = 1;
- for (obj = obj->contains; obj != NULL; obj = obj->next_content)
+ for (obj = obj->first_content; obj != NULL; obj = obj->next_content)
number += get_obj_number(obj);
return number;
@@ -2478,7 +2292,7 @@
OBJ_DATA *tobj;
weight = obj->weight;
- for (tobj = obj->contains; tobj != NULL; tobj = tobj->next_content)
+ for (tobj = obj->first_content; tobj != NULL; tobj = tobj->next_content)
weight += get_obj_weight(tobj) * WEIGHT_MULT(obj) / 100;
return weight;
@@ -2489,7 +2303,7 @@
int weight;
weight = obj->weight;
- for (obj = obj->contains; obj != NULL; obj = obj->next_content)
+ for (obj = obj->first_content; obj != NULL; obj = obj->next_content)
weight += get_obj_weight(obj);
return weight;
@@ -2540,7 +2354,7 @@
return TRUE;
count = 0;
- for (rch = pRoomIndex->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = pRoomIndex->first_person; rch != NULL; rch = rch->next_in_room)
count++;
if (IS_SET(pRoomIndex->room_flags, ROOM_PRIVATE) && count >= 2)
@@ -2734,7 +2548,7 @@
{
CHAR_DATA *ch, *ch_next;
- for (ch = char_list; ch != NULL; ch = ch_next)
+ for (ch = char_first; ch != NULL; ch = ch_next)
{
ch_next = ch->next;
diff -ur src/healer.c new/healer.c
--- src/healer.c Sat Jan 11 16:24:00 2003
+++ new/healer.c Fri Jan 24 02:15:43 2003
@@ -44,7 +44,7 @@
char *words;
/* check for healer */
- 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_IS_HEALER))
break;
diff -ur src/hedit.c new/hedit.c
--- src/hedit.c Sat Jan 11 16:24:00 2003
+++ new/hedit.c Fri Jan 24 02:15:43 2003
@@ -44,21 +44,6 @@
#define HEDIT( fun ) bool fun(CHAR_DATA *ch, const char*argument)
-extern HELP_AREA *had_list;
-
-HELP_AREA *get_help_area(HELP_DATA * help)
-{
- HELP_AREA *temp;
- HELP_DATA *thelp;
-
- for (temp = had_list; temp; temp = temp->next)
- for (thelp = temp->first; thelp; thelp = thelp->next_area)
- if (thelp == help)
- return temp;
-
- return NULL;
-}
-
HEDIT(hedit_show)
{
HELP_DATA *help;
@@ -120,9 +105,7 @@
HEDIT(hedit_new)
{
char arg[MIL], fullarg[MIL];
- HELP_AREA *had;
HELP_DATA *help;
- extern HELP_DATA *help_last;
if (IS_NULLSTR(argument))
{
@@ -134,54 +117,18 @@
strcpy(fullarg, argument);
argument = one_argument(argument, arg);
- if (!(had = had_lookup(arg)))
- {
- had = ch->in_room->area->helps;
- argument = fullarg;
- }
-
if (help_lookup(argument))
{
chprintln(ch, "HEdit : help ya existe.");
return FALSE;
}
- if (!had) /* el area no tiene helps */
- {
- had = new_had();
- had->filename = str_dup(ch->in_room->area->file_name);
- had->area = ch->in_room->area;
- had->first = NULL;
- had->last = NULL;
- had->changed = TRUE;
- had->next = had_list;
- had_list = had;
- ch->in_room->area->helps = had;
- SET_BIT(ch->in_room->area->area_flags, AREA_CHANGED);
- }
-
help = new_help();
help->level = 0;
help->keyword = str_dup(argument);
help->text = str_dup("");
- if (help_last)
- help_last->next = help;
-
- if (help_first == NULL)
- help_first = help;
-
- help_last = help;
- help->next = NULL;
-
- if (!had->first)
- had->first = help;
- if (!had->last)
- had->last = help;
-
- had->last->next_area = help;
- had->last = help;
- help->next_area = NULL;
+ LINK(help, help_first, help_last, next, prev);
edit_start(ch, help, ED_HELP);
chprintln(ch, "Ok.");
@@ -233,11 +180,23 @@
CH_CMD(do_hedit)
{
HELP_DATA *pHelp;
+ char arg[MIL];
if (IS_NPC(ch))
return;
- if ((pHelp = help_lookup(argument)) == NULL)
+ argument = one_argument(argument, arg);
+
+ if (is_name(arg, "create new make"))
+ {
+ hedit_new(ch, argument);
+ return;
+ }
+
+ strcat(arg, " ");
+ strcat(arg, argument);
+
+ if ((pHelp = help_lookup(arg)) == NULL)
{
chprintln(ch, "HEdit : Help inexistente.");
return;
@@ -249,61 +208,16 @@
HEDIT(hedit_delete)
{
- HELP_DATA *pHelp, *temp;
- HELP_AREA *had;
+ HELP_DATA *pHelp;
DESCRIPTOR_DATA *d;
- bool found = FALSE;
EDIT_HELP(ch, pHelp);
- for (d = descriptor_list; d; d = d->next)
+ for (d = descriptor_first; d; d = d->next)
if (d->editor == ED_HELP && pHelp == (HELP_DATA *) d->pEdit)
edit_done(d->character);
- if (help_first == pHelp)
- help_first = help_first->next;
- else
- {
- for (temp = help_first; temp; temp = temp->next)
- if (temp->next == pHelp)
- break;
-
- if (!temp)
- {
- bugf("hedit_delete : help %s no encontrado en help_first",
- pHelp->keyword);
- return FALSE;
- }
-
- temp->next = pHelp->next;
- }
-
- for (had = had_list; had; had = had->next)
- if (pHelp == had->first)
- {
- found = TRUE;
- had->first = had->first->next_area;
- }
- else
- {
- for (temp = had->first; temp; temp = temp->next_area)
- if (temp->next_area == pHelp)
- break;
-
- if (temp)
- {
- temp->next_area = pHelp->next_area;
- found = TRUE;
- break;
- }
- }
-
- if (!found)
- {
- bugf("hedit_delete : help %s no encontrado en had_list",
- pHelp->keyword);
- return FALSE;
- }
+ UNLINK(pHelp, help_first, help_last, next, prev);
free_help(pHelp);
@@ -339,36 +253,9 @@
return FALSE;
}
- if (!str_cmp(argument, "area"))
- {
- if (ch->in_room->area->helps == NULL)
- {
- chprintln(ch, "No hay helps en esta area.");
- return FALSE;
- }
-
- buffer = new_buf();
-
- for (pHelp = ch->in_room->area->helps->first; pHelp;
- pHelp = pHelp->next_area)
- {
- sprintf(buf, "%3d. %-14.14s%s", cnt, pHelp->keyword,
- cnt % 4 == 3 ? "\n\r" : " ");
- add_buf(buffer, buf);
- cnt++;
- }
-
- if (cnt % 4)
- add_buf(buffer, "\n\r");
-
- page_to_char(buf_string(buffer), ch);
- return FALSE;
- }
-
if (IS_NULLSTR(argument))
{
chprintln(ch, "Sintaxis : list all");
- chprintln(ch, " list area");
return FALSE;
}
diff -ur src/homes.c new/homes.c
--- src/homes.c Sat Jan 11 16:24:00 2003
+++ new/homes.c Fri Jan 24 02:15:43 2003
@@ -345,8 +345,7 @@
SET_BIT(pObj->wear_flags, ITEM_HOLD);
pObj->condition = -1;
iHash = i % MAX_KEY_HASH;
- pObj->next = obj_index_hash[iHash];
- obj_index_hash[iHash] = pObj;
+ LINK_SINGLE(pObj, next, obj_index_hash[iHash]);
ch->pcdata->home_key = pObj->vnum;
break;
}
@@ -368,8 +367,7 @@
replace_string(pRoom->owner, ch->name);
SET_BIT(pRoom->room_flags, ROOM_INDOORS);
iHash = i % MAX_KEY_HASH;
- pRoom->next = room_index_hash[iHash];
- room_index_hash[iHash] = pRoom;
+ LINK_SINGLE(pRoom, next, room_index_hash[iHash]);
// do the exit
// first room
ch->in_room->exit[door] = new_exit();
@@ -506,8 +504,7 @@
replace_string(pRoom->owner, ch->name);
SET_BIT(pRoom->room_flags, ROOM_INDOORS);
iHash = i % MAX_KEY_HASH;
- pRoom->next = room_index_hash[iHash];
- room_index_hash[iHash] = pRoom;
+ LINK_SINGLE(pRoom, next, room_index_hash[iHash]);
// do the exit
ch->in_room->exit[door] = new_exit();
ch->in_room->exit[door]->u1.to_room = pRoom;
@@ -985,7 +982,7 @@
found = TRUE;
if (home_table[i].type == H_OBJ)
{
- for (obj = ch->in_room->contents; obj != NULL;
+ for (obj = ch->in_room->first_content; obj != NULL;
obj = obj_next)
{
obj_next = obj->next_content;
@@ -996,7 +993,7 @@
}
else if (home_table[i].type == H_MOB)
{
- for (mob = ch->in_room->people; mob != NULL;
+ for (mob = ch->in_room->first_person; mob != NULL;
mob = mob_next)
{
mob_next = mob->next_in_room;
diff -ur src/hunt.c new/hunt.c
--- src/hunt.c Sat Jan 11 16:24:00 2003
+++ new/hunt.c Fri Jan 24 02:15:43 2003
@@ -124,7 +124,7 @@
number = number_argument(argument, arg);
count = 0;
- for (ach = char_list; ach != NULL; ach = ach->next)
+ for (ach = char_first; ach != NULL; ach = ach->next)
{
if (ach->in_room == NULL
|| ach->in_room->area != ch->in_room->area
@@ -522,7 +522,7 @@
if (ch == NULL || ch->hunting == NULL || !IS_NPC(ch))
return;
- for (found = 0, tmp = char_list; tmp && !found; tmp = tmp->next)
+ for (found = 0, tmp = char_first; tmp && !found; tmp = tmp->next)
if (ch->hunting == tmp)
found = 1;
diff -ur src/interp.c new/interp.c
--- src/interp.c Sat Jan 11 16:24:00 2003
+++ new/interp.c Fri Jan 24 02:15:43 2003
@@ -41,14 +41,11 @@
bool check_social args((CHAR_DATA * ch, char *command, const char *argument));
bool check_disabled(const struct cmd_type *command);
-DISABLED_DATA *disabled_first;
-
#define END_MARKER "END" /* for load_disabled() and save_disabled() */
/*
* Log-all switch.
*/
-bool fLogAll = FALSE;
char last_command[MAX_STRING_LENGTH];
char last_command2[MAX_INPUT_LENGTH];
DESCRIPTOR_DATA *last_descriptor;
@@ -502,7 +499,7 @@
CH_CMD(do_disable)
{
int i;
- DISABLED_DATA *p, *q;
+ DISABLED_DATA *p;
if (IS_NPC(ch))
{
@@ -548,15 +545,7 @@
}
/* Remove */
-
- if (disabled_first == p) /* node to be removed == head ? */
- disabled_first = p->next;
- else /* Find the node before this one */
- {
- for (q = disabled_first; q->next != p; q = q->next); /* empty for */
- q->next = p->next;
- }
-
+ UNLINK(p, disabled_first, disabled_last, next, prev);
free_string(p->disabled_by); /* free name of disabler */
free_mem(p); /* free node */
save_disabled(); /* save to disk */
@@ -597,8 +586,7 @@
p->command = &cmd_table[i];
p->disabled_by = str_dup(ch->name); /* save name of disabler */
p->level = get_trust(ch); /* save trust */
- p->next = disabled_first;
- disabled_first = p; /* add before the current first element */
+ LINK(p, disabled_first, disabled_last, next, prev);
chprintln(ch, "Command disabled.");
save_disabled(); /* save to disk */
@@ -656,10 +644,7 @@
p->command = &cmd_table[i];
p->level = fread_number(fp);
p->disabled_by = str_dup(fread_word(fp));
- p->next = disabled_first;
-
- disabled_first = p;
-
+ LINK(p, disabled_first, disabled_last, next, prev);
}
name = fread_word(fp);
diff -ur src/lookup.c new/lookup.c
--- src/lookup.c Sat Jan 11 16:24:00 2003
+++ new/lookup.c Fri Jan 24 02:15:43 2003
@@ -171,18 +171,6 @@
return NULL;
}
-HELP_AREA *had_lookup(char *arg)
-{
- HELP_AREA *temp;
- extern HELP_AREA *had_list;
-
- for (temp = had_list; temp; temp = temp->next)
- if (!str_cmp(arg, temp->filename))
- return temp;
-
- return NULL;
-}
-
int command_lookup(const char *name)
{
int i;
diff -ur src/lookup.h new/lookup.h
--- src/lookup.h Sat Jan 11 16:24:00 2003
+++ new/lookup.h Fri Jan 24 02:15:43 2003
@@ -34,6 +34,5 @@
int sex_lookup args((const char *name));
int size_lookup args((const char *name));
HELP_DATA *help_lookup args((const char *));
-HELP_AREA *had_lookup args((char *));
#endif
diff -ur src/magic.c new/magic.c
--- src/magic.c Sat Jan 11 16:24:00 2003
+++ new/magic.c Fri Jan 24 02:15:43 2003
@@ -160,7 +160,7 @@
sprintf(buf2, "$n utters the words, '%s'.", buf);
sprintf(buf, "$n utters the words, '%s'.", skill_table[sn].name);
- for (rch = ch->in_room->people; rch; rch = rch->next_in_room)
+ for (rch = ch->in_room->first_person; rch; rch = rch->next_in_room)
{
if (rch != ch)
act((!IS_NPC(rch) && is_same_class(ch, rch)) ? buf : buf2,
@@ -223,7 +223,7 @@
if (is_affected(victim, sn))
{
- for (af = victim->affected; af != NULL; af = af->next)
+ for (af = victim->first_affect; af != NULL; af = af->next)
{
if (af->type == sn)
{
@@ -522,7 +522,7 @@
CHAR_DATA *vch;
CHAR_DATA *vch_next;
- 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;
if (victim == vch && victim->fighting == NULL)
@@ -659,7 +659,7 @@
CHAR_DATA *vch;
CHAR_DATA *vch_next;
- 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;
if (victim == vch && victim->fighting == NULL)
@@ -736,7 +736,7 @@
{
AFFECT_DATA *paf;
- paf = affect_find(obj->affected, gsn_curse);
+ paf = affect_find(obj->first_affect, gsn_curse);
if (!saves_dispel(level, paf != NULL ? paf->level : obj->level, 0))
{
if (paf != NULL)
@@ -866,7 +866,7 @@
act("$n calls Mota's lightning to strike $s foes!", ch, NULL, NULL,
TO_ROOM);
- for (vch = char_list; vch != NULL; vch = vch_next)
+ for (vch = char_first; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
if (vch->in_room == NULL)
@@ -901,7 +901,7 @@
AFFECT_DATA af;
/* get sum of all mobile levels in the 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)
{
if (vch->position == POS_FIGHTING)
{
@@ -922,7 +922,8 @@
if (number_range(0, chance) >= mlevel) /* hard to stop large fights */
{
- 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 (IS_NPC(vch) &&
(IS_SET(vch->imm_flags, IMM_MAGIC) ||
@@ -1170,7 +1171,7 @@
while (level > 0)
{
found = FALSE;
- for (tmp_vict = ch->in_room->people; tmp_vict != NULL;
+ for (tmp_vict = ch->in_room->first_person; tmp_vict != NULL;
tmp_vict = next_vict)
{
next_vict = tmp_vict->next_in_room;
@@ -1606,7 +1607,7 @@
{
AFFECT_DATA *paf;
- paf = affect_find(obj->affected, skill_lookup("bless"));
+ paf = affect_find(obj->first_affect, skill_lookup("bless"));
if (!saves_dispel(level, paf != NULL ? paf->level : obj->level, 0))
{
if (paf != NULL)
@@ -2096,7 +2097,7 @@
chprintln(ch, "The earth trembles beneath your feet!");
act("$n makes the earth tremble and shiver.", ch, NULL, NULL, TO_ROOM);
- for (vch = char_list; vch != NULL; vch = vch_next)
+ for (vch = char_first; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
if (vch->in_room == NULL)
@@ -2153,7 +2154,7 @@
/* find the bonuses */
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_AC)
{
@@ -2166,7 +2167,7 @@
fail += 20;
}
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
if (paf->location == APPLY_AC)
{
@@ -2209,12 +2210,12 @@
obj->enchanted = TRUE;
/* remove all affects */
- for (paf = obj->affected; paf != NULL; paf = paf_next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf_next)
{
paf_next = paf->next;
free_affect(paf);
}
- obj->affected = NULL;
+ obj->first_affect = NULL;
/* clear all flags */
obj->extra_flags = 0;
@@ -2233,12 +2234,11 @@
AFFECT_DATA *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);
@@ -2274,7 +2274,7 @@
if (ac_found)
{
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
if (paf->location == APPLY_AC)
{
@@ -2295,8 +2295,7 @@
paf->location = APPLY_AC;
paf->modifier = added;
paf->bitvector = 0;
- paf->next = obj->affected;
- obj->affected = paf;
+ LINK(paf, obj->first_affect, obj->last_affect, next, prev);
}
}
@@ -2335,7 +2334,7 @@
/* find the bonuses */
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_HITROLL)
{
@@ -2355,7 +2354,7 @@
fail += 25;
}
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
if (paf->location == APPLY_HITROLL)
{
@@ -2405,12 +2404,12 @@
obj->enchanted = TRUE;
/* remove all affects */
- for (paf = obj->affected; paf != NULL; paf = paf_next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf_next)
{
paf_next = paf->next;
free_affect(paf);
}
- obj->affected = NULL;
+ obj->first_affect = NULL;
/* clear all flags */
obj->extra_flags = 0;
@@ -2429,12 +2428,11 @@
AFFECT_DATA *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);
@@ -2470,7 +2468,7 @@
if (dam_found)
{
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
if (paf->location == APPLY_DAMROLL)
{
@@ -2493,13 +2491,12 @@
paf->location = APPLY_DAMROLL;
paf->modifier = added;
paf->bitvector = 0;
- paf->next = obj->affected;
- obj->affected = paf;
+ LINK(paf, obj->first_affect, obj->last_affect, next, prev);
}
if (hit_found)
{
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
if (paf->location == APPLY_HITROLL)
{
@@ -2521,8 +2518,7 @@
paf->location = APPLY_HITROLL;
paf->modifier = added;
paf->bitvector = 0;
- paf->next = obj->affected;
- obj->affected = paf;
+ LINK(paf, obj->first_affect, obj->last_affect, next, prev);
}
}
@@ -2651,7 +2647,7 @@
act("$n conjures a cloud of purple smoke.", ch, NULL, NULL, TO_ROOM);
chprintln(ch, "You conjure a cloud of purple smoke.");
- for (ich = ch->in_room->people; ich != NULL; ich = ich->next_in_room)
+ for (ich = ch->in_room->first_person; ich != NULL; ich = ich->next_in_room)
{
if (ich->invis_level > 0)
continue;
@@ -2926,7 +2922,8 @@
if (!saves_spell(level + 2, victim, DAM_FIRE) &&
!IS_SET(victim->imm_flags, IMM_FIRE))
{
- for (obj_lose = victim->carrying; obj_lose != NULL; obj_lose = obj_next)
+ for (obj_lose = victim->first_carrying; obj_lose != NULL;
+ obj_lose = obj_next)
{
obj_next = obj_lose->next_content;
if (number_range(1, 2 * level) > obj_lose->level &&
@@ -3068,7 +3065,7 @@
act("$n utters a word of divine power!", ch, NULL, NULL, TO_ROOM);
chprintln(ch, "You utter a word of divine power.");
- 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_in_room;
@@ -3259,7 +3256,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)
{
if (paf->location != APPLY_NONE && paf->modifier != 0)
{
@@ -3303,7 +3300,7 @@
}
}
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
if (paf->location != APPLY_NONE && paf->modifier != 0)
{
@@ -3498,7 +3495,7 @@
buffer = new_buf();
- 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(target_name, obj->name)
|| IS_OBJ_STAT(obj, ITEM_NOLOCATE) ||
@@ -3574,7 +3571,7 @@
heal_num = skill_lookup("heal");
refresh_num = skill_lookup("refresh");
- 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_NPC(ch) && IS_NPC(gch)) || (!IS_NPC(ch) && !IS_NPC(gch)))
{
@@ -3589,7 +3586,7 @@
AFFECT_DATA af;
CHAR_DATA *gch;
- 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_INVISIBLE))
continue;
@@ -3989,7 +3986,7 @@
act("$n looks more relaxed.", victim, NULL, NULL, TO_ROOM);
}
- for (obj = victim->carrying; (obj != NULL && !found);
+ for (obj = victim->first_carrying; (obj != NULL && !found);
obj = obj->next_content)
{
if ((IS_OBJ_STAT(obj, ITEM_NODROP) ||
@@ -4276,7 +4273,7 @@
sprintf(buf2, "Someone makes %s say '%s'.\n\r", speaker, target_name);
buf1[0] = UPPER(buf1[0]);
- 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 (!is_exact_name(speaker, vch->name) && IS_AWAKE(vch))
chprint(vch, saves_spell(level, vch, DAM_OTHER) ? buf2 : buf1);
@@ -4389,7 +4386,7 @@
dam = UMAX(hp_dam + dice_dam / 10, dice_dam + hp_dam / 10);
fire_effect(victim->in_room, level, dam / 2, TARGET_ROOM);
- for (vch = victim->in_room->people; vch != NULL; vch = vch_next)
+ for (vch = victim->in_room->first_person; vch != NULL; vch = vch_next)
{
vch_next = vch->next_in_room;
@@ -4446,7 +4443,7 @@
dam = UMAX(hp_dam + dice_dam / 10, dice_dam + hp_dam / 10);
cold_effect(victim->in_room, level, dam / 2, TARGET_ROOM);
- for (vch = victim->in_room->people; vch != NULL; vch = vch_next)
+ for (vch = victim->in_room->first_person; vch != NULL; vch = vch_next)
{
vch_next = vch->next_in_room;
@@ -4500,7 +4497,7 @@
dam = UMAX(hp_dam + dice_dam / 10, dice_dam + hp_dam / 10);
poison_effect(ch->in_room, level, dam, TARGET_ROOM);
- 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_in_room;
diff -ur src/magic2.c new/magic2.c
--- src/magic2.c Sat Jan 11 16:24:00 2003
+++ new/magic2.c Fri Jan 24 02:15:43 2003
@@ -140,11 +140,11 @@
obj_to_room(portal, to_room);
- if (to_room->people != NULL)
+ if (to_room->first_person != NULL)
{
- act("$p rises up from the ground.", to_room->people, portal,
+ act("$p rises up from the ground.", to_room->first_person, portal,
NULL, TO_ROOM);
- act("$p rises up from the ground.", to_room->people, portal,
+ act("$p rises up from the ground.", to_room->first_person, portal,
NULL, TO_CHAR);
}
}
diff -ur src/mem.c new/mem.c
--- src/mem.c Sat Jan 11 16:24:00 2003
+++ new/mem.c Fri Jan 24 02:15:43 2003
@@ -65,16 +65,7 @@
{
RESET_DATA *pReset;
- if (!reset_free)
- {
- alloc_mem(pReset, RESET_DATA, 1);
- top_reset++;
- }
- else
- {
- pReset = reset_free;
- reset_free = reset_free->next;
- }
+ GET_FREE(pReset, RESET_DATA, next, reset_free);
pReset->next = NULL;
pReset->command = 'X';
@@ -88,8 +79,7 @@
void free_reset_data(RESET_DATA * pReset)
{
- pReset->next = reset_free;
- reset_free = pReset;
+ PUT_FREE(pReset, next, reset_free);
return;
}
@@ -98,16 +88,7 @@
AREA_DATA *pArea;
char buf[MAX_INPUT_LENGTH];
- if (!area_free)
- {
- alloc_mem(pArea, AREA_DATA, 1);
- top_area++;
- }
- else
- {
- pArea = area_free;
- area_free = area_free->next;
- }
+ GET_FREE(pArea, AREA_DATA, next, area_free);
pArea->next = NULL;
pArea->name = str_dup("New area");
@@ -135,8 +116,7 @@
free_string(pArea->builders);
free_string(pArea->credits);
- area_free = pArea;
- pArea->next = area_free->next;
+ PUT_FREE(pArea, next, area_free);
return;
}
@@ -144,16 +124,7 @@
{
EXIT_DATA *pExit;
- if (!exit_free)
- {
- alloc_mem(pExit, EXIT_DATA, 1);
- top_exit++;
- }
- else
- {
- pExit = exit_free;
- exit_free = exit_free->next;
- }
+ GET_FREE(pExit, EXIT_DATA, next, exit_free);
pExit->u1.to_room = NULL; /* ROM OLC */
pExit->next = NULL;
@@ -172,8 +143,7 @@
free_string(pExit->keyword);
free_string(pExit->description);
- pExit->next = exit_free;
- exit_free = pExit;
+ PUT_FREE(pExit, next, exit_free);
return;
}
@@ -182,21 +152,12 @@
ROOM_INDEX_DATA *pRoom;
int door;
- if (!room_index_free)
- {
- alloc_mem(pRoom, ROOM_INDEX_DATA, 1);
- top_room++;
- }
- else
- {
- pRoom = room_index_free;
- room_index_free = room_index_free->next;
- }
+ GET_FREE(pRoom, ROOM_INDEX_DATA, next, room_index_free);
pRoom->next = NULL;
- pRoom->people = NULL;
- pRoom->contents = NULL;
- pRoom->extra_descr = NULL;
+ pRoom->first_person = NULL;
+ pRoom->first_content = NULL;
+ pRoom->first_extra_descr = NULL;
pRoom->area = NULL;
for (door = 0; door < MAX_DIR; door++)
@@ -232,7 +193,7 @@
free_exit(pRoom->exit[door]);
}
- for (pExtra = pRoom->extra_descr; pExtra; pExtra = pExtra->next)
+ for (pExtra = pRoom->first_extra_descr; pExtra; pExtra = pExtra->next)
{
free_extra_descr(pExtra);
}
@@ -243,8 +204,7 @@
free_reset_data(pReset);
}
- pRoom->next = room_index_free;
- room_index_free = pRoom;
+ PUT_FREE(pRoom, next, room_index_free);
return;
}
@@ -255,16 +215,7 @@
SHOP_DATA *pShop;
int buy;
- if (!shop_free)
- {
- alloc_mem(pShop, SHOP_DATA, 1);
- top_shop++;
- }
- else
- {
- pShop = shop_free;
- shop_free = shop_free->next;
- }
+ GET_FREE(pShop, SHOP_DATA, next, shop_free);
pShop->next = NULL;
pShop->keeper = 0;
@@ -282,8 +233,7 @@
void free_shop(SHOP_DATA * pShop)
{
- pShop->next = shop_free;
- shop_free = pShop;
+ PUT_FREE(pShop, next, shop_free);
return;
}
@@ -292,20 +242,11 @@
OBJ_INDEX_DATA *pObj;
int value;
- if (!obj_index_free)
- {
- alloc_mem(pObj, OBJ_INDEX_DATA, 1);
- top_obj_index++;
- }
- else
- {
- pObj = obj_index_free;
- obj_index_free = obj_index_free->next;
- }
+ GET_FREE(pObj, OBJ_INDEX_DATA, next, obj_index_free);
pObj->next = NULL;
- pObj->extra_descr = NULL;
- pObj->affected = NULL;
+ pObj->first_extra_descr = NULL;
+ pObj->first_affect = NULL;
pObj->area = NULL;
pObj->name = str_dup("no name");
pObj->short_descr = str_dup("(no short description)");
@@ -336,18 +277,17 @@
free_string(pObj->short_descr);
free_string(pObj->description);
- for (pAf = pObj->affected; pAf; pAf = pAf->next)
+ for (pAf = pObj->first_affect; pAf; pAf = pAf->next)
{
free_affect(pAf);
}
- for (pExtra = pObj->extra_descr; pExtra; pExtra = pExtra->next)
+ for (pExtra = pObj->first_extra_descr; pExtra; pExtra = pExtra->next)
{
free_extra_descr(pExtra);
}
- pObj->next = obj_index_free;
- obj_index_free = pObj;
+ PUT_FREE(pObj, next, obj_index_free);
return;
}
@@ -355,16 +295,7 @@
{
MOB_INDEX_DATA *pMob;
- if (!mob_index_free)
- {
- alloc_mem(pMob, MOB_INDEX_DATA, 1);
- top_mob_index++;
- }
- else
- {
- pMob = mob_index_free;
- mob_index_free = mob_index_free->next;
- }
+ GET_FREE(pMob, MOB_INDEX_DATA, next, mob_index_free);
pMob->next = NULL;
pMob->spec_fun = NULL;
@@ -416,17 +347,20 @@
void free_mob_index(MOB_INDEX_DATA * pMob)
{
+ MPROG_LIST *mp;
+
free_string(pMob->player_name);
free_string(pMob->short_descr);
free_string(pMob->long_descr);
free_string(pMob->description);
- free_mprog(pMob->mprogs);
+
+ for (mp = pMob->first_mprog; mp; mp = mp->next)
+ free_mprog(mp);
if (pMob->pShop)
free_shop(pMob->pShop);
- pMob->next = mob_index_free;
- mob_index_free = pMob;
+ PUT_FREE(pMob, next, mob_index_free);
return;
}
@@ -436,16 +370,7 @@
{
MPROG_CODE *NewCode;
- if (!mpcode_free)
- {
- alloc_mem(NewCode, MPROG_CODE, 1);
- top_mprog_index++;
- }
- else
- {
- NewCode = mpcode_free;
- mpcode_free = mpcode_free->next;
- }
+ GET_FREE(NewCode, MPROG_CODE, next, mpcode_free);
NewCode->vnum = 0;
NewCode->code = str_dup("");
@@ -457,7 +382,6 @@
void free_mpcode(MPROG_CODE * pMcode)
{
free_string(pMcode->code);
- pMcode->next = mpcode_free;
- mpcode_free = pMcode;
+ PUT_FREE(pMcode, next, mpcode_free);
return;
}
diff -ur src/merc.h new/merc.h
--- src/merc.h Sat Jan 11 16:24:00 2003
+++ new/merc.h Fri Jan 24 02:15:43 2003
@@ -63,18 +63,18 @@
#endif
#if defined(WIN32)
-typedef __int64 flag_t; /* For MSVC4.2/5.0 - flags */
#pragma warning( disable: 4018 4244 4305 4761 4800 4309)
#define __attribute__(x)
#if !defined(NOCRYPT)
#define NOCRYPT
#endif
+typedef unsigned __int64 flag_t;
#else
#if defined(__CYGWIN__)
#define NOCRYPT
#define NO_MCCP
#endif
-typedef int64_t flag_t;
+typedef u_int64_t flag_t;
#endif
typedef long vnum_t;
@@ -114,7 +114,6 @@
typedef struct exit_data EXIT_DATA;
typedef struct extra_descr_data EXTRA_DESCR_DATA;
typedef struct help_data HELP_DATA;
-typedef struct help_area_data HELP_AREA;
typedef struct kill_data KILL_DATA;
typedef struct mem_data MEM_DATA;
typedef struct mob_index_data MOB_INDEX_DATA;
@@ -218,6 +217,7 @@
struct ban_data
{
BAN_DATA *next;
+ BAN_DATA *prev;
bool valid;
flag_t ban_flags;
int level;
@@ -227,6 +227,7 @@
struct buf_type
{
BUFFER *next;
+ BUFFER *prev;
bool valid;
int state; /* error state of the buffer */
int size; /* size in k */
@@ -236,6 +237,7 @@
struct auction_data
{
AUCTION_DATA *next;
+ AUCTION_DATA *prev;
OBJ_DATA *item;
CHAR_DATA *owner;
CHAR_DATA *high_bidder;
@@ -309,26 +311,38 @@
#define BIT_d ((flag_t) 1 << 29)
#define BIT_e ((flag_t) 1 << 30)
#define BIT_f ((flag_t) 1 << 31)
-#define BIT_g ((flag_t) 1 << 32)
-#define BIT_h ((flag_t) 1 << 33)
-#define BIT_i ((flag_t) 1 << 34)
-#define BIT_j ((flag_t) 1 << 35)
-#define BIT_k ((flag_t) 1 << 36)
-#define BIT_l ((flag_t) 1 << 37)
-#define BIT_m ((flag_t) 1 << 38)
-#define BIT_n ((flag_t) 1 << 39)
-#define BIT_o ((flag_t) 1 << 40)
-#define BIT_p ((flag_t) 1 << 41)
-#define BIT_q ((flag_t) 1 << 42)
-#define BIT_r ((flag_t) 1 << 43)
-#define BIT_s ((flag_t) 1 << 44)
-#define BIT_t ((flag_t) 1 << 45)
-#define BIT_u ((flag_t) 1 << 46)
-#define BIT_v ((flag_t) 1 << 47)
-#define BIT_w ((flag_t) 1 << 48)
-#define BIT_x ((flag_t) 1 << 49)
-#define BIT_y ((flag_t) 1 << 50)
-#define BIT_z ((flag_t) 1 << 51)
+#define BIT_Ax ((flag_t) 1 << 32)
+#define BIT_Bx ((flag_t) 1 << 33)
+#define BIT_Cx ((flag_t) 1 << 34)
+#define BIT_Dx ((flag_t) 1 << 35)
+#define BIT_Ex ((flag_t) 1 << 36)
+#define BIT_Fx ((flag_t) 1 << 37)
+#define BIT_Gx ((flag_t) 1 << 38)
+#define BIT_Hx ((flag_t) 1 << 39)
+#define BIT_Ix ((flag_t) 1 << 40)
+#define BIT_Jx ((flag_t) 1 << 41)
+#define BIT_Kx ((flag_t) 1 << 42)
+#define BIT_Lx ((flag_t) 1 << 43)
+#define BIT_Mx ((flag_t) 1 << 44)
+#define BIT_Nx ((flag_t) 1 << 45)
+#define BIT_Ox ((flag_t) 1 << 46)
+#define BIT_Px ((flag_t) 1 << 47)
+#define BIT_Qx ((flag_t) 1 << 48)
+#define BIT_Rx ((flag_t) 1 << 49)
+#define BIT_Sx ((flag_t) 1 << 50)
+#define BIT_Tx ((flag_t) 1 << 51)
+#define BIT_Ux ((flag_t) 1 << 52)
+#define BIT_Vx ((flag_t) 1 << 53)
+#define BIT_Wx ((flag_t) 1 << 54)
+#define BIT_Xx ((flag_t) 1 << 55)
+#define BIT_Yx ((flag_t) 1 << 56)
+#define BIT_Zx ((flag_t) 1 << 57)
+#define BIT_ax ((flag_t) 1 << 58)
+#define BIT_bx ((flag_t) 1 << 59)
+#define BIT_cx ((flag_t) 1 << 60)
+#define BIT_dx ((flag_t) 1 << 61)
+#define BIT_ex ((flag_t) 1 << 62)
+#define BIT_fx ((flag_t) 1 << 63)
/*
* Connected state for a channel.
@@ -363,6 +377,7 @@
struct descriptor_data
{
DESCRIPTOR_DATA *next;
+ DESCRIPTOR_DATA *prev;
DESCRIPTOR_DATA *snoop_by;
CHAR_DATA *character;
CHAR_DATA *original;
@@ -451,22 +466,12 @@
struct help_data
{
HELP_DATA *next;
- HELP_DATA *next_area;
+ HELP_DATA *prev;
int level;
const char *keyword;
const char *text;
};
-struct help_area_data
-{
- HELP_AREA *next;
- HELP_DATA *first;
- HELP_DATA *last;
- AREA_DATA *area;
- const char *filename;
- bool changed;
-};
-
/*
* Shop types.
*/
@@ -474,7 +479,8 @@
struct shop_data
{
- SHOP_DATA *next; /* Next shop in list */
+ SHOP_DATA *next;
+ SHOP_DATA *prev; /* Next shop in list */
vnum_t keeper; /* Vnum of shop keeper mob */
int buy_type[MAX_TRADE]; /* Item types shop will buy */
int profit_buy; /* Cost multiplier for buying */
@@ -544,6 +550,7 @@
struct corpse_data
{
CORPSE_DATA *next;
+ CORPSE_DATA *prev;
OBJ_DATA *corpse;
};
@@ -580,6 +587,7 @@
struct note_data
{
NOTE_DATA *next;
+ NOTE_DATA *prev;
bool valid;
const char *sender;
const char *date;
@@ -620,6 +628,7 @@
struct affect_data
{
AFFECT_DATA *next;
+ AFFECT_DATA *prev;
bool valid;
int where;
int type;
@@ -1433,7 +1442,8 @@
MOB_INDEX_DATA *next;
SPEC_FUN *spec_fun;
SHOP_DATA *pShop;
- MPROG_LIST *mprogs;
+ MPROG_LIST *first_mprog;
+ MPROG_LIST *last_mprog;
AREA_DATA *area; /* OLC */
vnum_t vnum;
vnum_t group;
@@ -1480,6 +1490,7 @@
struct mem_data
{
MEM_DATA *next;
+ MEM_DATA *prev;
bool valid;
int id;
int reaction;
@@ -1495,6 +1506,7 @@
struct stat_data
{
STAT_DATA *next;
+ STAT_DATA *prev;
bool valid;
const char *name; // name of character
long gamestat[MAX_GAMESTAT]; // stat data
@@ -1506,8 +1518,11 @@
struct char_data
{
CHAR_DATA *next;
+ CHAR_DATA *prev;
CHAR_DATA *next_player;
+ CHAR_DATA *prev_player;
CHAR_DATA *next_in_room;
+ CHAR_DATA *prev_in_room;
CHAR_DATA *master;
CHAR_DATA *leader;
CHAR_DATA *fighting;
@@ -1518,8 +1533,10 @@
SPEC_FUN *spec_fun;
MOB_INDEX_DATA *pIndexData;
DESCRIPTOR_DATA *desc;
- AFFECT_DATA *affected;
- OBJ_DATA *carrying;
+ AFFECT_DATA *first_affect;
+ AFFECT_DATA *last_affect;
+ OBJ_DATA *first_carrying;
+ OBJ_DATA *last_carrying;
OBJ_DATA *on;
ROOM_INDEX_DATA *in_room;
ROOM_INDEX_DATA *was_in_room;
@@ -1603,6 +1620,7 @@
struct pc_data
{
PC_DATA *next;
+ PC_DATA *prev;
BUFFER *buffer;
bool valid;
const char *pwd;
@@ -1650,6 +1668,7 @@
struct gen_data
{
GEN_DATA *next;
+ GEN_DATA *prev;
bool valid;
bool *skill_chosen;
bool *group_chosen;
@@ -1673,7 +1692,8 @@
*/
struct extra_descr_data
{
- EXTRA_DESCR_DATA *next; /* Next in list */
+ EXTRA_DESCR_DATA *next;
+ EXTRA_DESCR_DATA *prev; /* Next in list */
bool valid;
const char *keyword; /* Keyword in look/examine */
const char *description; /* What to see */
@@ -1685,8 +1705,10 @@
struct obj_index_data
{
OBJ_INDEX_DATA *next;
- EXTRA_DESCR_DATA *extra_descr;
- AFFECT_DATA *affected;
+ EXTRA_DESCR_DATA *first_extra_descr;
+ EXTRA_DESCR_DATA *last_extra_descr;
+ AFFECT_DATA *first_affect;
+ AFFECT_DATA *last_affect;
AREA_DATA *area; /* OLC */
bool new_format;
const char *name;
@@ -1712,13 +1734,18 @@
struct obj_data
{
OBJ_DATA *next;
+ OBJ_DATA *prev;
OBJ_DATA *next_content;
- OBJ_DATA *contains;
+ OBJ_DATA *prev_content;
+ OBJ_DATA *first_content;
+ OBJ_DATA *last_content;
OBJ_DATA *in_obj;
OBJ_DATA *on;
CHAR_DATA *carried_by;
- EXTRA_DESCR_DATA *extra_descr;
- AFFECT_DATA *affected;
+ EXTRA_DESCR_DATA *first_extra_descr;
+ EXTRA_DESCR_DATA *last_extra_descr;
+ AFFECT_DATA *first_affect;
+ AFFECT_DATA *last_affect;
OBJ_INDEX_DATA *pIndexData;
ROOM_INDEX_DATA *in_room;
bool valid;
@@ -1755,7 +1782,8 @@
vnum_t key;
const char *keyword;
const char *description;
- EXIT_DATA *next; /* OLC */
+ EXIT_DATA *next;
+ EXIT_DATA *prev; /* OLC */
flag_t rs_flags; /* OLC */
int orig_door; /* OLC */
};
@@ -1779,6 +1807,7 @@
struct reset_data
{
RESET_DATA *next;
+ RESET_DATA *prev;
char command;
vnum_t arg1;
int arg2;
@@ -1792,7 +1821,7 @@
struct area_data
{
AREA_DATA *next;
- HELP_AREA *helps;
+ AREA_DATA *prev;
const char *file_name;
const char *name;
const char *credits;
@@ -1815,9 +1844,12 @@
struct room_index_data
{
ROOM_INDEX_DATA *next;
- CHAR_DATA *people;
- OBJ_DATA *contents;
- EXTRA_DESCR_DATA *extra_descr;
+ CHAR_DATA *first_person;
+ CHAR_DATA *last_person;
+ OBJ_DATA *first_content;
+ OBJ_DATA *last_content;
+ EXTRA_DESCR_DATA *first_extra_descr;
+ EXTRA_DESCR_DATA *last_extra_descr;
AREA_DATA *area;
EXIT_DATA *exit[6];
RESET_DATA *reset_first; /* OLC */
@@ -1837,7 +1869,8 @@
/* one disabled command */
struct disabled_data
{
- DISABLED_DATA *next; /* pointer to next node */
+ DISABLED_DATA *next;
+ DISABLED_DATA *prev; /* pointer to next node */
struct cmd_type const *command; /* pointer to the command struct */
const char *disabled_by; /* name of disabler */
int level; /* level of disabler */
@@ -1920,6 +1953,7 @@
vnum_t vnum;
const char *code;
MPROG_LIST *next;
+ MPROG_LIST *prev;
bool valid;
};
@@ -1928,6 +1962,7 @@
vnum_t vnum;
const char *code;
MPROG_CODE *next;
+ MPROG_CODE *prev;
};
#include "gsn.h"
@@ -1952,7 +1987,155 @@
(a) = (b); \
if ( (a) < 0 ) \
bug( "CHECK_POS : " c " == %d < 0", a ); \
- } \
+ }
+
+#define UNLINK_SINGLE(pdata,pnext,type,list) \
+do \
+{ \
+ if (list == pdata) \
+ { \
+ list = pdata->pnext; \
+ } \
+ else \
+ { \
+ type *prev; \
+ for (prev = list; prev != NULL; prev = prev->pnext) \
+ { \
+ if (prev->pnext == pdata) \
+ { \
+ prev->pnext = pdata->pnext; \
+ break; \
+ } \
+ } \
+ if (prev == NULL) \
+ { \
+ bugf (#pdata " not found in " #list "."); \
+ } \
+ } \
+} while(0)
+
+#define LINK_SINGLE(pdata,pnext,list) \
+do \
+{ \
+ pdata->pnext = list; \
+ list = pdata; \
+} \
+while (0)
+
+#define LINK(link, first, last, next, prev) \
+do \
+{ \
+ if ( !(first) ) \
+ { \
+ (first) = (link); \
+ (last) = (link); \
+ } \
+ else \
+ (last)->next = (link); \
+ (link)->next = NULL; \
+ if (first == link) \
+ (link)->prev = NULL; \
+ else \
+ (link)->prev = (last); \
+ (last) = (link); \
+} while(0)
+
+#define INSERT(link, insert, first, next, prev) \
+do \
+{ \
+ (link)->prev = (insert)->prev; \
+ if ( !(insert)->prev ) \
+ (first) = (link); \
+ else \
+ (insert)->prev->next = (link); \
+ (insert)->prev = (link); \
+ (link)->next = (insert); \
+} while(0)
+
+#define UNLINK(link, first, last, next, prev) \
+do \
+{ \
+ if ( !(link)->prev ) \
+ { \
+ (first) = (link)->next; \
+ if ((first)) \
+ (first)->prev = NULL; \
+ } \
+ else \
+ { \
+ (link)->prev->next = (link)->next; \
+ } \
+ if ( !(link)->next ) \
+ { \
+ (last) = (link)->prev; \
+ if ((last)) \
+ (last)->next = NULL; \
+ } \
+ else \
+ { \
+ (link)->next->prev = (link)->prev; \
+ } \
+} while(0)
+
+#define CHECK_LINKS(first, last, next, prev, type) \
+do { \
+ type *ptr, *pptr = NULL; \
+ if ( !(first) && !(last) ) \
+ break; \
+ if ( !(first) ) \
+ { \
+ bugf( "CHECK_LINKS: last with NULL first! %s.", \
+ #first ); \
+ for ( ptr = (last); ptr->prev; ptr = ptr->prev ); \
+ (first) = ptr; \
+ } \
+ else if ( !(last) ) \
+ { \
+ bugf( "CHECK_LINKS: first with NULL last! %s.", \
+ #first ); \
+ for ( ptr = (first); ptr->next; ptr = ptr->next ); \
+ (last) = ptr; \
+ } \
+ if ( (first) ) \
+ { \
+ for ( ptr = (first); ptr; ptr = ptr->next ) \
+ { \
+ if ( ptr->prev != pptr ) \
+ { \
+ bugf( "CHECK_LINKS(%s): %p:->prev != %p. Fixing.", \
+ #first, ptr, pptr ); \
+ ptr->prev = pptr; \
+ } \
+ if ( ptr->prev && ptr->prev->next != ptr ) \
+ { \
+ bugf( "CHECK_LINKS(%s): %p:->prev->next != %p. Fixing.",\
+ #first, ptr, ptr ); \
+ ptr->prev->next = ptr; \
+ } \
+ pptr = ptr; \
+ } \
+ pptr = NULL; \
+ } \
+ if ( (last) ) \
+ { \
+ for ( ptr = (last); ptr; ptr = ptr->prev ) \
+ { \
+ if ( ptr->next != pptr ) \
+ { \
+ bugf( "CHECK_LINKS (%s): %p:->next != %p. Fixing.", \
+ #first, ptr, pptr ); \
+ ptr->next = pptr; \
+ } \
+ if ( ptr->next && ptr->next->prev != ptr ) \
+ { \
+ bugf( "CHECK_LINKS(%s): %p:->next->prev != %p. Fixing.",\
+ #first, ptr, ptr ); \
+ ptr->next->prev = ptr; \
+ } \
+ pptr = ptr; \
+ } \
+ } \
+} while(0)
#define replace_string(astr, bstr) do{ free_string(astr); astr = str_dup(bstr); }while(0)
@@ -2058,57 +2241,17 @@
extern const struct dex_app_type dex_app[26];
extern const struct con_app_type con_app[26];
-extern struct class_type *class_table;
extern const struct weapon_type weapon_table[];
extern const struct item_type item_table[];
extern const struct wiznet_type wiznet_table[];
extern const struct attack_type attack_table[];
-extern struct race_type *race_table;
extern const struct spec_type spec_table[];
extern const struct liq_type liq_table[];
-extern struct skill_type *skill_table;
-extern struct group_type *group_table;
-
-extern struct social_type *social_table;
/*
* Global variables.
*/
-extern HELP_DATA *help_first;
-extern SHOP_DATA *shop_first;
-
-extern CHAR_DATA *char_list;
-extern DESCRIPTOR_DATA *descriptor_list;
-extern OBJ_DATA *object_list;
-extern CHAR_DATA *player_list;
-
-extern MPROG_CODE *mprog_list;
-
-extern AUCTION_DATA *auction_list;
-
-extern STAT_DATA *stat_list;
-extern BAN_DATA *ban_list;
-
-extern char bug_buf[];
-extern time_t current_time;
-extern bool fLogAll;
-extern FILE *fpReserve;
-extern KILL_DATA kill_table[];
-extern char log_buf[];
-extern TIME_INFO_DATA time_info;
-extern WEATHER_DATA weather_info;
-extern bool MOBtrigger;
-extern NOTE_DATA *note_free;
-extern OBJ_DATA *obj_free;
-extern DISABLED_DATA *disabled_first; /* interp.c */
-extern GQUEST gquest_info;
-extern WAR_DATA war_info;
-extern int maxClan;
-extern int maxCommands;
-extern int maxSkill;
-extern int maxGroup;
-extern int maxRace;
-extern int maxClass;
+#include "globals.h"
/*
* The crypt(3) function is not available on some operating systems.
@@ -2149,6 +2292,7 @@
#define BUG_FILE "bugs.txt" /* For 'bug' and bug() */
#define TYPO_FILE "typos.txt" /* For 'typo' */
#define SHUTDOWN_FILE "shutdown.txt" /* For 'shutdown' */
+#define HELP_FILE "help.are"
#define BAN_FILE DATA_DIR "ban.dat"
#define MUSIC_FILE DATA_DIR "music.dat"
#define DISABLED_FILE DATA_DIR "disabled.dat" /* disabled commands */
@@ -2186,7 +2330,6 @@
#define AREA_CLOSED (BIT_E)
#define MAX_DIR 6
-#define NO_FLAG -99 /* Must not be used in flags or stats. */
/*
* Global Constants
@@ -2199,7 +2342,6 @@
*/
extern AREA_DATA *area_first;
extern AREA_DATA *area_last;
-extern SHOP_DATA *shop_last;
extern int top_affect;
extern int top_area;
@@ -2221,7 +2363,8 @@
extern OBJ_INDEX_DATA *obj_index_hash[MAX_KEY_HASH];
extern ROOM_INDEX_DATA *room_index_hash[MAX_KEY_HASH];
-extern CORPSE_DATA *corpse_list;
+extern CORPSE_DATA *corpse_first;
+extern CORPSE_DATA *corpse_last;
#define STRING_END 2
#define STRING_FOUND 1
diff -ur src/mob_cmds.c new/mob_cmds.c
--- src/mob_cmds.c Sat Jan 11 16:24:00 2003
+++ new/mob_cmds.c Fri Jan 24 02:15:43 2003
@@ -212,7 +212,7 @@
return;
}
- for (i = 0, mprg = victim->pIndexData->mprogs; mprg != NULL;
+ for (i = 0, mprg = victim->pIndexData->first_mprog; mprg != NULL;
mprg = mprg->next)
{
@@ -261,7 +261,7 @@
return;
}
- for (d = descriptor_list; d; d = d->next)
+ for (d = descriptor_first; d; d = d->next)
{
if (d->connected == CON_PLAYING)
{
@@ -291,7 +291,7 @@
if (ch->in_room == NULL)
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
&& d->character->in_room->area == ch->in_room->area)
@@ -425,7 +425,7 @@
extract_obj(obj);
}
else
- 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 (arg[3] == '\0' || is_name(&arg[4], obj->name))
@@ -629,7 +629,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) && victim != ch &&
@@ -637,7 +637,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_SET(obj->extra_flags, ITEM_NOPURGE))
@@ -744,7 +744,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)
{
@@ -786,7 +786,8 @@
{
CHAR_DATA *victim_next;
- for (victim = ch->in_room->people; victim != NULL; victim = victim_next)
+ for (victim = ch->in_room->first_person; victim != NULL;
+ victim = victim_next)
{
victim_next = victim->next_in_room;
if (!IS_NPC(victim))
@@ -858,7 +859,7 @@
if ((who = get_char_room(ch, arg1)) == NULL)
return;
- for (victim = ch->in_room->people; victim; victim = victim_next)
+ for (victim = ch->in_room->first_person; victim; victim = victim_next)
{
victim_next = victim->next_in_room;
if (is_same_group(who, victim))
@@ -894,7 +895,7 @@
CHAR_DATA *vch;
CHAR_DATA *vch_next;
- for (vch = char_list; vch != NULL; vch = vch_next)
+ for (vch = char_first; vch != NULL; vch = vch_next)
{
vch_next = vch->next;
@@ -946,7 +947,7 @@
if (victim == ch)
return;
- for (vch = victim->in_room->people; vch != NULL; vch = vch_next)
+ for (vch = victim->in_room->first_person; vch != NULL; vch = vch_next)
{
vch_next = vch->next_in_room;
@@ -987,7 +988,7 @@
vnum = atol(arg);
- for (victim = char_list; victim; victim = victim_next)
+ for (victim = char_first; victim; victim = victim_next)
{
victim_next = victim->next;
if (IS_NPC(victim) && victim->pIndexData->vnum == vnum &&
@@ -1116,7 +1117,7 @@
fKill = TRUE;
if (fAll)
{
- for (victim = ch->in_room->people; victim; victim = victim_next)
+ for (victim = ch->in_room->first_person; victim; victim = victim_next)
{
victim_next = victim->next_in_room;
if (victim != ch)
@@ -1343,7 +1344,7 @@
else
vnum = atol(arg);
- for (obj = victim->carrying; obj; obj = obj_next)
+ for (obj = victim->first_carrying; obj; obj = obj_next)
{
obj_next = obj->next_content;
if (fAll || obj->pIndexData->vnum == vnum)
diff -ur src/mob_prog.c new/mob_prog.c
--- src/mob_prog.c Sat Jan 11 16:24:00 2003
+++ new/mob_prog.c Fri Jan 24 02:15:43 2003
@@ -257,7 +257,7 @@
{
CHAR_DATA *vch, *victim = NULL;
int now = 0, highest = 0;
- for (vch = mob->in_room->people; vch; vch = vch->next_in_room)
+ for (vch = mob->in_room->first_person; vch; vch = vch->next_in_room)
{
if (mob != vch && !IS_NPC(vch) && can_see(mob, vch) &&
(now = number_percent()) > highest)
@@ -277,15 +277,16 @@
{
CHAR_DATA *vch;
int count;
- for (count = 0, vch = mob->in_room->people; vch; vch = vch->next_in_room)
- if (mob != vch &&
- (iFlag == 0 || (iFlag == 1 && !IS_NPC(vch)) ||
- (iFlag == 2 && IS_NPC(vch)) || (iFlag == 3 &&
- IS_NPC(mob) &&
- IS_NPC(vch) &&
- mob->pIndexData->vnum ==
- vch->pIndexData->vnum)
- || (iFlag == 4 && is_same_group(mob, vch))) && can_see(mob, vch))
+ for (count = 0, vch = mob->in_room->first_person; vch;
+ vch = vch->next_in_room)
+ if (mob != vch
+ && (iFlag == 0 || (iFlag == 1 && !IS_NPC(vch))
+ || (iFlag == 2 && IS_NPC(vch)) || (iFlag == 3 && IS_NPC(mob)
+ && IS_NPC(vch)
+ && mob->pIndexData->vnum ==
+ vch->pIndexData->vnum)
+ || (iFlag == 4 && is_same_group(mob, vch)))
+ && can_see(mob, vch))
count++;
return (count);
}
@@ -302,7 +303,7 @@
if (!IS_NPC(ch))
return 0;
- for (i = 0, vch = ch->in_room->people; vch; vch = vch->next_in_room)
+ for (i = 0, vch = ch->in_room->first_person; vch; vch = vch->next_in_room)
{
if (vch == ch)
return i;
@@ -321,7 +322,7 @@
bool has_item(CHAR_DATA * ch, vnum_t vnum, int pitem_type, bool fWear)
{
OBJ_DATA *obj;
- for (obj = ch->carrying; obj; obj = obj->next_content)
+ for (obj = ch->first_carrying; obj; obj = obj->next_content)
if ((vnum < 0 || obj->pIndexData->vnum == vnum) &&
(pitem_type < 0 || obj->pIndexData->item_type == pitem_type) &&
(!fWear || obj->wear_loc != WEAR_NONE))
@@ -335,7 +336,7 @@
bool get_mob_vnum_room(CHAR_DATA * ch, vnum_t vnum)
{
CHAR_DATA *mob;
- 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) && mob->pIndexData->vnum == vnum)
return TRUE;
return FALSE;
@@ -347,7 +348,7 @@
bool get_obj_vnum_room(CHAR_DATA * ch, vnum_t vnum)
{
OBJ_DATA *obj;
- 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->pIndexData->vnum == vnum)
return TRUE;
return FALSE;
@@ -374,7 +375,6 @@
OBJ_DATA *obj1 = (OBJ_DATA *) arg1;
OBJ_DATA *obj2 = (OBJ_DATA *) arg2;
OBJ_DATA *lval_obj = NULL;
- flag_t fvalue;
const char *original;
char buf[MAX_INPUT_LENGTH], code;
int lval = 0, oper = 0, rval = -1;
@@ -555,25 +555,16 @@
{
case CHK_AFFECTED:
return (lval_char != NULL &&
- IS_SET(lval_char->affected_by,
- (fvalue =
- flag_value(affect_flags,
- buf)) == NO_FLAG ? 0 : fvalue));
+ IS_SET(lval_char->affected_by, flag_value(affect_flags, buf)));
case CHK_ACT:
return (lval_char != NULL &&
- IS_SET(lval_char->act,
- (fvalue =
- flag_value(act_flags, buf)) == NO_FLAG ? 0 : fvalue));
+ IS_SET(lval_char->act, flag_value(act_flags, buf)));
case CHK_IMM:
return (lval_char != NULL &&
- IS_SET(lval_char->imm_flags,
- (fvalue =
- flag_value(imm_flags, buf)) == NO_FLAG ? 0 : fvalue));
+ IS_SET(lval_char->imm_flags, flag_value(imm_flags, buf)));
case CHK_OFF:
return (lval_char != NULL &&
- IS_SET(lval_char->off_flags,
- (fvalue =
- flag_value(off_flags, buf)) == NO_FLAG ? 0 : fvalue));
+ IS_SET(lval_char->off_flags, flag_value(off_flags, buf)));
case CHK_CARRIES:
if (is_number(buf))
return (lval_char != NULL &&
@@ -1204,7 +1195,7 @@
{
MPROG_LIST *prg;
- for (prg = mob->pIndexData->mprogs; prg != NULL; prg = prg->next)
+ for (prg = mob->pIndexData->first_mprog; prg != NULL; prg = prg->next)
{
if (prg->trig_type == type &&
strstr(argument, prg->trig_phrase) != NULL)
@@ -1225,7 +1216,7 @@
{
MPROG_LIST *prg;
- for (prg = mob->pIndexData->mprogs; prg != NULL; prg = prg->next)
+ for (prg = mob->pIndexData->first_mprog; prg != NULL; prg = prg->next)
{
if (prg->trig_type == type && number_percent() < atoi(prg->trig_phrase))
{
@@ -1245,7 +1236,7 @@
* and give it to the mobile. WFT was that? Funcs in act_obj()
* handle it just fine.
*/
- for (prg = mob->pIndexData->mprogs; prg; prg = prg->next)
+ for (prg = mob->pIndexData->first_mprog; prg; prg = prg->next)
{
if (prg->trig_type == TRIG_BRIBE && amount >= atoi(prg->trig_phrase))
{
@@ -1261,12 +1252,12 @@
CHAR_DATA *mob;
MPROG_LIST *prg;
- 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) &&
(HAS_TRIGGER(mob, TRIG_EXIT) || HAS_TRIGGER(mob, TRIG_EXALL)))
{
- for (prg = mob->pIndexData->mprogs; prg; prg = prg->next)
+ for (prg = mob->pIndexData->first_mprog; prg; prg = prg->next)
{
/*
* Exit trigger works only if the mobile is not busy
@@ -1300,7 +1291,7 @@
const char *p;
MPROG_LIST *prg;
- for (prg = mob->pIndexData->mprogs; prg; prg = prg->next)
+ for (prg = mob->pIndexData->first_mprog; prg; prg = prg->next)
if (prg->trig_type == TRIG_GIVE)
{
p = prg->trig_phrase;
@@ -1340,7 +1331,7 @@
{
CHAR_DATA *mob;
- 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) &&
(HAS_TRIGGER(mob, TRIG_GREET) || HAS_TRIGGER(mob, TRIG_GRALL)))
@@ -1365,7 +1356,7 @@
{
MPROG_LIST *prg;
- for (prg = mob->pIndexData->mprogs; prg != NULL; prg = prg->next)
+ for (prg = mob->pIndexData->first_mprog; prg != NULL; prg = prg->next)
if ((prg->trig_type == TRIG_HPCNT) &&
((100 * mob->hit / mob->max_hit) < atol(prg->trig_phrase)))
{
diff -ur src/multiclass.c new/multiclass.c
--- src/multiclass.c Sat Jan 11 16:24:00 2003
+++ new/multiclass.c Fri Jan 24 02:15:43 2003
@@ -52,7 +52,7 @@
/*
* check for priest or special mob
*/
- 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_IS_HEALER)) /* setup to do at healer's for now */
break;
@@ -112,7 +112,7 @@
"crashes while you are creating your character, log back on and write a");
chprintln(ch, "note to 'immortal' who will retrieve your backup.");
wiznet("$N has remorted.", ch, NULL, 0, 0, 0);
- for (af = ch->affected; af != NULL; af = af_next)
+ for (af = ch->first_affect; af != NULL; af = af_next)
{
af_next = af->next;
affect_remove(ch, af);
diff -ur src/music.c new/music.c
--- src/music.c Sat Jan 11 16:24:00 2003
+++ new/music.c Fri Jan 24 02:15:43 2003
@@ -84,7 +84,7 @@
channel_songs[0]++;
}
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
victim = d->original ? d->original : d->character;
@@ -97,7 +97,7 @@
}
}
- for (obj = object_list; obj != NULL; obj = obj->next)
+ for (obj = object_first; obj != NULL; obj = obj->next)
{
if (obj->item_type != ITEM_JUKEBOX || obj->value[1] < 0)
continue;
@@ -123,8 +123,8 @@
sprintf(buf, "$p starts playing %s, %s.",
song_table[obj->value[1]].group,
song_table[obj->value[1]].name);
- if (room->people != NULL)
- act(buf, room->people, obj, NULL, TO_ALL);
+ if (room->first_person != NULL)
+ act(buf, room->first_person, obj, NULL, TO_ALL);
obj->value[0] = 0;
continue;
}
@@ -149,8 +149,8 @@
}
sprintf(buf, "$p bops: '%s'", line);
- if (room->people != NULL)
- act(buf, room->people, obj, NULL, TO_ALL);
+ if (room->first_person != NULL)
+ act(buf, room->first_person, obj, NULL, TO_ALL);
}
}
@@ -224,7 +224,8 @@
str = one_argument(argument, arg);
- for (juke = ch->in_room->contents; juke != NULL; juke = juke->next_content)
+ for (juke = ch->in_room->first_content; juke != NULL;
+ juke = juke->next_content)
if (juke->item_type == ITEM_JUKEBOX && can_see_obj(ch, juke))
break;
diff -ur src/nanny.c new/nanny.c
--- src/nanny.c Sat Jan 11 16:24:00 2003
+++ new/nanny.c Fri Jan 24 02:15:43 2003
@@ -207,7 +207,7 @@
{
case 'y':
case 'Y':
- for (d_old = descriptor_list; d_old != NULL; d_old = pd_next)
+ for (d_old = descriptor_first; d_old != NULL; d_old = pd_next)
{
pd_next = d_old->next;
if (d_old == d || d_old->character == NULL)
@@ -718,10 +718,8 @@
write_to_buffer(d,
"\n\rWelcome to ROM 2.4. Please do not feed the mobiles.\n\r",
0);
- ch->next = char_list;
- char_list = ch;
- ch->next_player = player_list;
- player_list = ch;
+ LINK(ch, char_first, char_last, next, prev);
+ LINK(ch, player_first, player_last, next_player, prev_player);
d->connected = CON_PLAYING;
reset_char(ch);
diff -ur src/olc.c new/olc.c
--- src/olc.c Sat Jan 11 16:24:00 2003
+++ new/olc.c Fri Jan 24 02:15:43 2003
@@ -309,7 +309,7 @@
{
DESCRIPTOR_DATA *d;
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->pEdit == NULL || d->character == NULL)
continue;
@@ -470,7 +470,8 @@
{"material", (void *) &xObj.material, olced_str, NULL},
{"weight", (void *) &xObj.weight, olced_number, NULL},
{"cost", (void *) &xObj.cost, olced_number_long, NULL},
- {"ed", (void *) &xObj.extra_descr, olced_ed, NULL},
+ {"ed", (void *) &xObj.first_extra_descr, olced_ed,
+ (const void *) &xObj.last_extra_descr},
{"delete", NULL, olced_olded, (const void *) oedit_delete},
{"extra", (void *) &xObj.extra_flags, olced_flag,
@@ -493,7 +494,8 @@
{"create", NULL, olced_olded, (const void *) redit_create},
{"name", (void *) &xRoom.name, olced_str, NULL},
{"desc", (void *) &xRoom.description, olced_desc, NULL},
- {"ed", (void *) &xRoom.extra_descr, olced_ed, NULL},
+ {"ed", (void *) &xRoom.first_extra_descr, olced_ed,
+ (const void *) &xRoom.last_extra_descr},
{"format", NULL, olced_olded, (const void *) redit_format},
{"north", NULL, olced_direction, (const void *) DIR_NORTH},
{"south", NULL, olced_direction, (const void *) DIR_SOUTH},
@@ -899,13 +901,7 @@
if ((*table[temp].function)
(table[temp].name, ch, argument, puntero,
table[temp].parameter))
- {
- HELP_AREA *tHelp = get_help_area(pHelp);
-
- if (tHelp != NULL && tHelp->area != NULL)
- SET_BIT(tHelp->area->area_flags, AREA_CHANGED);
- save_other_helps(NULL);
- }
+ save_helps();
return TRUE;
break;
case ED_SOCIAL:
@@ -1437,31 +1433,6 @@
return TRUE;
}
-void extract_area(AREA_DATA * pArea)
-{
- if (pArea == area_first)
- {
- area_first = pArea->next;
- }
- else
- {
- AREA_DATA *prev;
-
- for (prev = area_first; prev != NULL; prev = prev->next)
- {
- if (prev->next == pArea)
- {
- prev->next = pArea->next;
- break;
- }
- }
- if (prev == NULL)
- {
- bug("extract_area: area not found.", 0);
- }
- }
-}
-
/* Entry point for editing area_data. */
CH_CMD(do_aedit)
{
@@ -1520,7 +1491,7 @@
clean_area_links(pArea);
unlink(pArea->file_name);
- extract_area(pArea);
+ UNLINK(pArea, area_first, area_last, next, prev);
free_area(pArea);
do_asave(NULL, "changed");
chprintln(ch, "Area deleted.");
@@ -2277,8 +2248,7 @@
"O[%5ld] %-13.13s %-19.19s M[%5ld] %-15.15s\n\r",
pReset->arg1, pObj->short_descr,
(pReset->command ==
- 'G') ? flag_string(wear_loc_strings,
- WEAR_NONE) :
+ 'G') ? "in the inventory" :
flag_string(wear_loc_strings, pReset->arg3),
pMob->vnum, pMob->short_descr);
strcat(final, buf);
@@ -2329,41 +2299,26 @@
Purpose: Inserts a new reset in the given index slot.
Called by: do_resets(olc.c).
****************************************************************************/
-void add_reset(ROOM_INDEX_DATA * room, RESET_DATA * pReset, int pindex)
+void add_reset(ROOM_INDEX_DATA * room, RESET_DATA * pReset, int pIndex)
{
RESET_DATA *reset;
int iReset = 0;
- if (!room->reset_first)
- {
- room->reset_first = pReset;
- room->reset_last = pReset;
- pReset->next = NULL;
- return;
- }
-
- pindex--;
+ pIndex--;
- if (pindex == 0) /* First slot (1) selected. */
+ if (pIndex == 0 || !room->reset_first)
{
- pReset->next = room->reset_first;
- room->reset_first = pReset;
+ LINK(pReset, room->reset_first, room->reset_last, next, prev);
return;
}
- /*
- * If negative slot( <= 0 selected) then this will find the last.
- */
- for (reset = room->reset_first; reset->next; reset = reset->next)
+ for (reset = room->reset_first; reset; reset = reset->next)
{
- if (++iReset == pindex)
+ if (++iReset == pIndex || reset->next == NULL)
break;
}
- pReset->next = reset->next;
- reset->next = pReset;
- if (!pReset->next)
- room->reset_last = pReset;
+ INSERT(pReset, reset, room->reset_first, next, prev);
return;
}
@@ -2423,50 +2378,28 @@
if (!str_cmp(arg2, "delete"))
{
int insert_loc = atoi(arg1);
+ int iReset = -1;
if (!ch->in_room->reset_first)
{
chprintln(ch, "No resets in this area.");
return;
}
-
- if (insert_loc - 1 <= 0)
+ for (pReset = pRoom->reset_first; pReset; pReset = pReset->next)
{
- pReset = pRoom->reset_first;
- pRoom->reset_first = pRoom->reset_first->next;
- if (!pRoom->reset_first)
- pRoom->reset_last = NULL;
+ if (++iReset == insert_loc - 1)
+ break;
}
- else
- {
- int iReset = 0;
- RESET_DATA *prev = NULL;
-
- for (pReset = pRoom->reset_first; pReset; pReset = pReset->next)
- {
- if (++iReset == insert_loc)
- break;
- prev = pReset;
- }
-
- if (!pReset)
- {
- chprintln(ch, "Reset not found.");
- return;
- }
- if (prev)
- prev->next = prev->next->next;
- else
- pRoom->reset_first = pRoom->reset_first->next;
-
- for (pRoom->reset_last = pRoom->reset_first;
- pRoom->reset_last->next;
- pRoom->reset_last = pRoom->reset_last->next);
+ if (!pReset)
+ {
+ chprintln(ch, "Reset not found.");
+ return;
}
-
+ UNLINK(pReset, pRoom->reset_first, pRoom->reset_last, next, prev);
free_reset_data(pReset);
chprintln(ch, "Reset deleted.");
+ SET_BIT(ch->in_room->area->area_flags, AREA_CHANGED);
}
else
/*
@@ -2546,7 +2479,7 @@
* --------------------------
*/
{
- if (flag_value(wear_loc_flags, arg4) == NO_FLAG)
+ if (flag_value(wear_loc_flags, arg4) == 0)
{
chprintln(ch, "Resets: '? wear-loc'");
return;
diff -ur src/olc.h new/olc.h
--- src/olc.h Sat Jan 11 16:24:00 2003
+++ new/olc.h Fri Jan 24 02:15:43 2003
@@ -150,8 +150,7 @@
flag_t wear_bit(int loc);
int wear_loc(flag_t bits, int count);
void save_area(AREA_DATA * pArea);
-void save_other_helps(CHAR_DATA * ch);
-void save_helps(FILE * fp, HELP_AREA * ha);
+void save_helps(void);
void save_shops(FILE * fp, AREA_DATA * pArea);
void save_resets(FILE * fp, AREA_DATA * pArea);
void save_door_resets(FILE * fp, AREA_DATA * pArea);
diff -ur src/olc_act.c new/olc_act.c
--- src/olc_act.c Sat Jan 11 16:24:00 2003
+++ new/olc_act.c Fri Jan 24 02:15:43 2003
@@ -55,13 +55,13 @@
#define ALT_FLAGVALUE_SET( _blargh, _table, _arg ) \
{ \
flag_t blah = flag_value( _table, _arg ); \
- _blargh = (blah == NO_FLAG) ? 0 : blah; \
+ _blargh = blah; \
}
#define ALT_FLAGVALUE_TOGGLE( _blargh, _table, _arg ) \
{ \
flag_t blah = flag_value( _table, _arg ); \
- _blargh ^= (blah == NO_FLAG) ? 0 : blah; \
+ _blargh ^= blah; \
}
/* Return TRUE if area changed, FALSE if not. */
@@ -82,124 +82,42 @@
{
RESET_DATA *prev, *wReset;
- prev = pRoom->reset_first;
- for (wReset = pRoom->reset_first; wReset; wReset = wReset->next)
+ for (wReset = pRoom->reset_first; wReset; wReset = prev)
{
+ prev = wReset->next;
+
if (wReset == pReset)
{
- if (pRoom->reset_first == pReset)
- {
- pRoom->reset_first = pReset->next;
- if (!pRoom->reset_first)
- pRoom->reset_last = NULL;
- }
- else if (pRoom->reset_last == pReset)
- {
- pRoom->reset_last = prev;
- prev->next = NULL;
- }
- else
- prev->next = prev->next->next;
-
- if (pRoom->reset_first == pReset)
- pRoom->reset_first = pReset->next;
-
- if (!pRoom->reset_first)
- pRoom->reset_last = NULL;
+ UNLINK(pReset, pRoom->reset_first, pRoom->reset_last, next, prev);
}
-
- prev = wReset;
}
}
void unlink_obj_index(OBJ_INDEX_DATA * pObj)
{
int iHash;
- OBJ_INDEX_DATA *iObj, *sObj;
iHash = pObj->vnum % MAX_KEY_HASH;
- sObj = obj_index_hash[iHash];
-
- if (sObj->next == NULL)
-
- obj_index_hash[iHash] = NULL;
- else if (sObj == pObj)
-
- obj_index_hash[iHash] = pObj->next;
- else
- {
-
- for (iObj = sObj; iObj != NULL; iObj = iObj->next)
- {
- if (iObj == pObj)
- {
- sObj->next = pObj->next;
- break;
- }
- sObj = iObj;
- }
- }
+ UNLINK_SINGLE(pObj, next, OBJ_INDEX_DATA, obj_index_hash[iHash]);
}
void unlink_room_index(ROOM_INDEX_DATA * pRoom)
{
int iHash;
- ROOM_INDEX_DATA *iRoom, *sRoom;
iHash = pRoom->vnum % MAX_KEY_HASH;
- sRoom = room_index_hash[iHash];
-
- if (sRoom->next == NULL)
-
- room_index_hash[iHash] = NULL;
- else if (sRoom == pRoom)
-
- room_index_hash[iHash] = pRoom->next;
- else
- {
-
- for (iRoom = sRoom; iRoom != NULL; iRoom = iRoom->next)
- {
- if (iRoom == pRoom)
- {
- sRoom->next = pRoom->next;
- break;
- }
- sRoom = iRoom;
- }
- }
+ UNLINK_SINGLE(pRoom, next, ROOM_INDEX_DATA, room_index_hash[iHash]);
}
void unlink_mob_index(MOB_INDEX_DATA * pMob)
{
int iHash;
- MOB_INDEX_DATA *iMob, *sMob;
iHash = pMob->vnum % MAX_KEY_HASH;
- sMob = mob_index_hash[iHash];
-
- if (sMob->next == NULL)
-
- mob_index_hash[iHash] = NULL;
- else if (sMob == pMob)
-
- mob_index_hash[iHash] = pMob->next;
- else
- {
-
- for (iMob = sMob; iMob != NULL; iMob = iMob->next)
- {
- if (iMob == pMob)
- {
- sMob->next = pMob->next;
- break;
- }
- sMob = iMob;
- }
- }
+ UNLINK_SINGLE(pMob, next, MOB_INDEX_DATA, mob_index_hash[iHash]);
}
bool show_version(CHAR_DATA * ch, char *argument)
@@ -630,7 +548,7 @@
}
ocount = 0;
- for (Obj = pRoom->contents; Obj; Obj = obj_next)
+ for (Obj = pRoom->first_content; Obj; Obj = obj_next)
{
obj_next = Obj->next_content;
@@ -639,7 +557,7 @@
}
mcount = 0;
- for (wch = pRoom->people; wch; wch = wnext)
+ for (wch = pRoom->first_person; wch; wch = wnext)
{
wnext = wch->next_in_room;
if (IS_NPC(wch))
@@ -690,7 +608,7 @@
}
edcount = 0;
- for (pExtra = pRoom->extra_descr; pExtra; pExtra = pExtra->next)
+ for (pExtra = pRoom->first_extra_descr; pExtra; pExtra = pExtra->next)
{
edcount++;
}
@@ -753,7 +671,7 @@
if ((pObjIndex = get_obj_index(vnum)))
{
if (fAll || is_name(arg, pObjIndex->name) ||
- flag_value(type_flags, arg) == pObjIndex->item_type)
+ (int) flag_value(type_flags, arg) == pObjIndex->item_type)
{
found = TRUE;
sprintf(buf, "[%5ld] %-17.16s", pObjIndex->vnum,
@@ -945,8 +863,7 @@
AREA_DATA *pArea;
pArea = new_area();
- area_last->next = pArea;
- area_last = pArea; /* Thanks, Walker. */
+ LINK(pArea, area_first, area_last, next, prev);
edit_start(ch, pArea, ED_AREA);
SET_BIT(pArea->area_flags, AREA_ADDED);
chprintln(ch, "Area Created.");
@@ -1248,12 +1165,12 @@
strcat(buf1, buf);
}
- if (pRoom->extra_descr)
+ if (pRoom->first_extra_descr)
{
EXTRA_DESCR_DATA *ed;
strcat(buf1, "Desc Kwds: [");
- for (ed = pRoom->extra_descr; ed; ed = ed->next)
+ for (ed = pRoom->first_extra_descr; ed; ed = ed->next)
{
strcat(buf1, ed->keyword);
if (ed->next)
@@ -1264,7 +1181,7 @@
strcat(buf1, "Characters: [");
fcnt = FALSE;
- for (rch = pRoom->people; rch; rch = rch->next_in_room)
+ for (rch = pRoom->first_person; rch; rch = rch->next_in_room)
{
one_argument(rch->name, buf);
strcat(buf1, buf);
@@ -1285,7 +1202,7 @@
strcat(buf1, "Objects: [");
fcnt = FALSE;
- for (obj = pRoom->contents; obj; obj = obj->next_content)
+ for (obj = pRoom->first_content; obj; obj = obj->next_content)
{
one_argument(obj->name, buf);
strcat(buf1, buf);
@@ -1382,7 +1299,7 @@
* Set the exit flags, needs full argument.
* ----------------------------------------
*/
- if ((value = flag_value(exit_flags, argument)) != NO_FLAG)
+ if ((value = flag_value(exit_flags, argument)) != 0)
{
ROOM_INDEX_DATA *pToRoom;
int rev; /* ROM OLC */
@@ -1685,8 +1602,7 @@
top_vnum_room = value;
iHash = value % MAX_KEY_HASH;
- pRoom->next = room_index_hash[iHash];
- room_index_hash[iHash] = pRoom;
+ LINK_SINGLE(pRoom, next, room_index_hash[iHash]);
edit_start(ch, pRoom, ED_ROOM);
chprintln(ch, "Room created.");
return TRUE;
@@ -1789,7 +1705,7 @@
{WEAR_WRIST_R, ITEM_WEAR_WRIST},
{WEAR_WIELD, ITEM_WIELD},
{WEAR_HOLD, ITEM_HOLD},
- {NO_FLAG, NO_FLAG}
+ {-2, -2}
};
/*****************************************************************************
@@ -1802,13 +1718,13 @@
{
int flag;
- for (flag = 0; wear_table[flag].wear_bit != NO_FLAG; flag++)
+ for (flag = 0; wear_table[flag].wear_bit != -2; flag++)
{
if (IS_SET(bits, wear_table[flag].wear_bit) && --count < 1)
return wear_table[flag].wear_loc;
}
- return NO_FLAG;
+ return 0;
}
/*****************************************************************************
@@ -1820,7 +1736,7 @@
{
int flag;
- for (flag = 0; wear_table[flag].wear_loc != NO_FLAG; flag++)
+ for (flag = 0; wear_table[flag].wear_loc != -2; flag++)
{
if (loc == wear_table[flag].wear_loc)
return wear_table[flag].wear_bit;
@@ -1893,7 +1809,7 @@
* Load into object's inventory.
*/
if (argument[0] == '\0' &&
- ((to_obj = get_obj_list(ch, arg2, pRoom->contents)) != NULL))
+ ((to_obj = get_obj_list(ch, arg2, pRoom->first_content)) != NULL))
{
pReset = new_reset_data();
pReset->command = 'P';
@@ -1925,7 +1841,7 @@
/*
* Make sure the location on mobile is valid.
*/
- if ((pwear_loc = flag_value(wear_loc_flags, argument)) == NO_FLAG)
+ if ((pwear_loc = flag_value(wear_loc_flags, argument)) == 0)
{
chprintln(ch, "REdit: Invalid wear_loc. '? wear-loc'");
return FALSE;
@@ -2372,7 +2288,7 @@
pObj->value[0] = atol(argument);
break;
case 1:
- if ((value = flag_value(container_flags, argument)) != NO_FLAG)
+ if ((value = flag_value(container_flags, argument)) != 0)
TOGGLE_BIT(pObj->value[1], value);
else
{
@@ -2540,13 +2456,13 @@
chprintlnf(ch, "Weight: [%5d]\n\rCost: [%5d]",
pObj->weight, pObj->cost);
- if (pObj->extra_descr)
+ if (pObj->first_extra_descr)
{
EXTRA_DESCR_DATA *ed;
chprint(ch, "Ex desc kwd: ");
- for (ed = pObj->extra_descr; ed; ed = ed->next)
+ for (ed = pObj->first_extra_descr; ed; ed = ed->next)
{
chprint(ch, "[");
chprint(ch, ed->keyword);
@@ -2559,7 +2475,7 @@
chprintlnf(ch, "Short desc: %s\n\rLong desc:\n\r %s",
pObj->short_descr, pObj->description);
- for (cnt = 0, paf = pObj->affected; paf; paf = paf->next)
+ for (cnt = 0, paf = pObj->first_affect; paf; paf = paf->next)
{
if (cnt == 0)
{
@@ -2599,7 +2515,7 @@
return FALSE;
}
- if ((value = flag_value(apply_flags, loc)) == NO_FLAG) /* Hugin */
+ if ((value = flag_value(apply_flags, loc)) == 0) /* Hugin */
{
chprintln(ch, "Valid affects are:");
show_help(ch, "apply");
@@ -2614,8 +2530,7 @@
pAf->duration = -1;
pAf->bitvector = 0;
pAf->level = pObj->level;
- pAf->next = pObj->affected;
- pObj->affected = pAf;
+ LINK(pAf, pObj->first_affect, pObj->last_affect, next, prev);
chprintln(ch, "Affect added.");
return TRUE;
@@ -2684,7 +2599,7 @@
top_obj_index--;
ocount = 0;
- for (obj = object_list; obj; obj = obj_next)
+ for (obj = object_first; obj; obj = obj_next)
{
obj_next = obj->next;
@@ -2763,14 +2678,14 @@
argument = one_argument(argument, mod);
one_argument(argument, bvector);
- if (type[0] == '\0' || (typ = flag_value(apply_types, type)) == NO_FLAG)
+ if (type[0] == '\0' || (typ = flag_value(apply_types, type)) == 0)
{
chprintln(ch, "Invalid apply type. Valid apply types are:");
show_help(ch, "apptype");
return FALSE;
}
- if (loc[0] == '\0' || (value = flag_value(apply_flags, loc)) == NO_FLAG)
+ if (loc[0] == '\0' || (value = flag_value(apply_flags, loc)) == 0)
{
chprintln(ch, "Valid applys are:");
show_help(ch, "apply");
@@ -2778,7 +2693,7 @@
}
if (bvector[0] == '\0' ||
- (bv = flag_value(bitvector_type[typ].table, bvector)) == NO_FLAG)
+ (bv = flag_value(bitvector_type[typ].table, bvector)) == 0)
{
chprintln(ch, "Invalid bitvector type.");
chprintln(ch, "Valid bitvector types are:");
@@ -2801,8 +2716,7 @@
pAf->duration = -1;
pAf->bitvector = bv;
pAf->level = pObj->level;
- pAf->next = pObj->affected;
- pObj->affected = pAf;
+ LINK(pAf, pObj->first_affect, pObj->last_affect, next, prev);
chprintln(ch, "Apply added.");
return TRUE;
@@ -2816,7 +2730,6 @@
{
OBJ_INDEX_DATA *pObj;
AFFECT_DATA *pAf;
- AFFECT_DATA *pAf_next;
char affect[MAX_STRING_LENGTH];
int value;
int cnt = 0;
@@ -2839,34 +2752,18 @@
return FALSE;
}
- if (!(pAf = pObj->affected))
+ for (pAf = pObj->first_affect; pAf != NULL; pAf = pAf->next)
+ if (++cnt == value)
+ break;
+
+ if (!pAf)
{
chprintln(ch, "OEdit: Non-existant affect.");
return FALSE;
}
- if (value == 0) /* First case: Remove first affect */
- {
- pAf = pObj->affected;
- pObj->affected = pAf->next;
- free_affect(pAf);
- }
- else /* Affect to remove is not the first */
- {
- while ((pAf_next = pAf->next) && (++cnt < value))
- pAf = pAf_next;
-
- if (pAf_next) /* See if it's the next affect */
- {
- pAf->next = pAf_next->next;
- free_affect(pAf_next);
- }
- else /* Doesn't exist */
- {
- chprintln(ch, "No such affect.");
- return FALSE;
- }
- }
+ UNLINK(pAf, pObj->first_affect, pObj->last_affect, next, prev);
+ free_affect(pAf);
chprintln(ch, "Affect removed.");
return TRUE;
@@ -2945,8 +2842,7 @@
top_vnum_obj = value;
iHash = value % MAX_KEY_HASH;
- pObj->next = obj_index_hash[iHash];
- obj_index_hash[iHash] = pObj;
+ LINK_SINGLE(pObj, next, obj_index_hash[iHash]);
edit_start(ch, pObj, ED_OBJECT);
chprintln(ch, "Object Created.");
return TRUE;
@@ -3079,13 +2975,13 @@
}
}
- if (pMob->mprogs)
+ if (pMob->first_mprog)
{
int cnt;
chprintlnf(ch, "\n\rMOBPrograms for [%5ld]:", pMob->vnum);
- for (cnt = 0, list = pMob->mprogs; list; list = list->next)
+ for (cnt = 0, list = pMob->first_mprog; list; list = list->next)
{
if (cnt == 0)
{
@@ -3146,8 +3042,7 @@
pMob->act = ACT_IS_NPC;
iHash = value % MAX_KEY_HASH;
- pMob->next = mob_index_hash[iHash];
- mob_index_hash[iHash] = pMob;
+ LINK_SINGLE(pMob, next, mob_index_hash[iHash]);
edit_start(ch, pMob, ED_MOBILE);
chprintln(ch, "Mobile Created.");
return TRUE;
@@ -3225,7 +3120,7 @@
for (pRoom = room_index_hash[iHash]; pRoom; pRoom = pRoom->next)
{
- for (wch = pRoom->people; wch; wch = wnext)
+ for (wch = pRoom->first_person; wch; wch = wnext)
{
wnext = wch->next_in_room;
if (wch->pIndexData == pMob)
@@ -3444,7 +3339,7 @@
return FALSE;
}
- if ((value = flag_value(mprog_flags, trigger)) == NO_FLAG)
+ if ((value = flag_value(mprog_flags, trigger)) == 0)
{
chprintln(ch, "Valid flags are:");
show_help(ch, "mprog");
@@ -3461,10 +3356,9 @@
list->vnum = atol(num);
list->trig_type = value;
list->trig_phrase = str_dup(phrase);
- list->code = code->code;
+ replace_string(list->code, code->code);
SET_BIT(pMob->mprog_flags, value);
- list->next = pMob->mprogs;
- pMob->mprogs = list;
+ LINK(list, pMob->first_mprog, pMob->last_mprog, next, prev);
chprintln(ch, "Mprog Added.");
return TRUE;
@@ -3474,7 +3368,6 @@
{
MOB_INDEX_DATA *pMob;
MPROG_LIST *list;
- MPROG_LIST *list_next;
char mprog[MAX_STRING_LENGTH];
int value;
int cnt = 0;
@@ -3496,36 +3389,18 @@
return FALSE;
}
- if (!(list = pMob->mprogs))
+ for (list = pMob->first_mprog; list != NULL; list = list->next)
+ if ((++cnt == value))
+ break;
+
+ if (!list)
{
chprintln(ch, "MEdit: Non existant mprog.");
return FALSE;
}
-
- if (value == 0)
- {
- REMOVE_BIT(pMob->mprog_flags, pMob->mprogs->trig_type);
- list = pMob->mprogs;
- pMob->mprogs = list->next;
- free_mprog(list);
- }
- else
- {
- while ((list_next = list->next) && (++cnt < value))
- list = list_next;
-
- if (list_next)
- {
- REMOVE_BIT(pMob->mprog_flags, list_next->trig_type);
- list->next = list_next->next;
- free_mprog(list_next);
- }
- else
- {
- chprintln(ch, "No such mprog.");
- return FALSE;
- }
- }
+ REMOVE_BIT(pMob->mprog_flags, list->trig_type);
+ UNLINK(list, pMob->first_mprog, pMob->last_mprog, next, prev);
+ free_mprog(list);
chprintln(ch, "Mprog removed.");
return TRUE;
@@ -3922,7 +3797,7 @@
}
if (str_cmp(argument, "none")
- && (value = flag_value(type_flags, argument)) == NO_FLAG)
+ && (value = flag_value(type_flags, argument)) == 0)
{
chprintln(ch, "MEdit: That type of item is not known.");
return FALSE;
@@ -3945,12 +3820,7 @@
}
pMob->pShop = new_shop();
- if (!shop_first)
- shop_first = pMob->pShop;
- if (shop_last)
- shop_last->next = pMob->pShop;
- shop_last = pMob->pShop;
-
+ LINK(pMob->pShop, shop_first, shop_last, next, prev);
pMob->pShop->keeper = pMob->vnum;
chprintln(ch, "New shop assigned to mobile.");
@@ -3964,34 +3834,7 @@
pShop = pMob->pShop;
pMob->pShop = NULL;
- if (pShop == shop_first)
- {
- if (!pShop->next)
- {
- shop_first = NULL;
- shop_last = NULL;
- }
- else
- shop_first = pShop->next;
- }
- else
- {
- SHOP_DATA *ipShop;
-
- for (ipShop = shop_first; ipShop; ipShop = ipShop->next)
- {
- if (ipShop->next == pShop)
- {
- if (!pShop->next)
- {
- shop_last = ipShop;
- shop_last->next = NULL;
- }
- else
- ipShop->next = pShop->next;
- }
- }
- }
+ UNLINK(pShop, shop_first, shop_last, next, prev);
free_shop(pShop);
@@ -4196,6 +4039,7 @@
{
EXTRA_DESCR_DATA *ed;
EXTRA_DESCR_DATA **pEd = (EXTRA_DESCR_DATA **) arg;
+ EXTRA_DESCR_DATA **lEd = (EXTRA_DESCR_DATA **) par;
char command[MAX_INPUT_LENGTH];
char keyword[MAX_INPUT_LENGTH];
@@ -4222,8 +4066,7 @@
ed = new_extra_descr();
replace_string(ed->keyword, keyword);
- ed->next = *pEd;
- *pEd = ed;
+ LINK(ed, *pEd, *lEd, next, prev);
string_append(ch, &ed->description);
@@ -4278,10 +4121,7 @@
return FALSE;
}
- if (!ped)
- *pEd = ed->next;
- else
- ped->next = ed->next;
+ UNLINK(ed, *pEd, *lEd, next, prev);
free_extra_descr(ed);
@@ -4486,7 +4326,7 @@
c = clan_lookup(pClan->name);
- for (pch = char_list; pch != NULL; pch = pch->next)
+ for (pch = char_first; pch != NULL; pch = pch->next)
{
if (pch->clan == c)
pch->clan = -1;
diff -ur src/olc_class.c new/olc_class.c
--- src/olc_class.c Sat Jan 11 16:24:00 2003
+++ new/olc_class.c Fri Jan 24 02:15:43 2003
@@ -127,7 +127,7 @@
c = class_lookup(pClass->name);
- for (pch = player_list; pch != NULL; pch = pch->next_player)
+ for (pch = player_first; pch != NULL; pch = pch->next_player)
{
invalid = FALSE;
diff -ur src/olc_mpcode.c new/olc_mpcode.c
--- src/olc_mpcode.c Sat Jan 11 16:24:00 2003
+++ new/olc_mpcode.c Fri Jan 24 02:15:43 2003
@@ -47,7 +47,7 @@
MPROG_LIST *list, *list_next;
MOB_INDEX_DATA *pMob;
vnum_t vnum = 0;
- int nMatch = 0, count, pos = 0;
+ int nMatch = 0, count;
for (vnum = 0; nMatch < top_mob_index; vnum++)
{
@@ -56,7 +56,7 @@
nMatch++;
count = -1;
- for (list = pMob->mprogs; list != NULL; list = list_next)
+ for (list = pMob->first_mprog; list != NULL; list = list_next)
{
list_next = list->next;
count++;
@@ -64,25 +64,9 @@
if (list->vnum != pnum)
continue;
- if (count == 0)
- {
- REMOVE_BIT(pMob->mprog_flags, pMob->mprogs->trig_type);
- list = pMob->mprogs;
- pMob->mprogs = list->next;
- free_mprog(list);
- }
- else
- {
- while ((list_next = list->next) && (++pos < count))
- list = list_next;
-
- if (list_next)
- {
- REMOVE_BIT(pMob->mprog_flags, list_next->trig_type);
- list->next = list_next->next;
- free_mprog(list_next);
- }
- }
+ REMOVE_BIT(pMob->mprog_flags, list->trig_type);
+ UNLINK(list, pMob->first_mprog, pMob->last_mprog, next, prev);
+ free_mprog(list);
}
}
}
@@ -229,8 +213,7 @@
pMcode = new_mpcode();
pMcode->vnum = value;
- pMcode->next = mprog_list;
- mprog_list = pMcode;
+ LINK(pMcode, mprog_first, mprog_last, next, prev);
edit_start(ch, pMcode, ED_MPCODE);
chprintln(ch, "MobProgram Code Created.");
@@ -263,7 +246,7 @@
buffer = new_buf();
- for (mprg = mprog_list; mprg != NULL; mprg = mprg->next)
+ for (mprg = mprog_first; mprg != NULL; mprg = mprg->next)
if (fAll ||
ENTRE(ch->in_room->area->min_vnum, mprg->vnum,
ch->in_room->area->max_vnum))
@@ -330,15 +313,14 @@
unlink_mprog(value);
prev = NULL;
- for (curr = mprog_list; curr != NULL; prev = curr, curr = curr->next)
+ for (curr = mprog_first; curr != NULL; curr = prev)
{
+ prev = curr->next;
+
if (curr->vnum != value)
continue;
- if (prev == NULL)
- mprog_list = mprog_list->next;
- else
- prev->next = curr->next;
+ UNLINK(curr, mprog_first, mprog_last, next, prev);
free_mpcode(curr);
}
save_area(ad);
diff -ur src/olc_race.c new/olc_race.c
--- src/olc_race.c Sat Jan 11 16:24:00 2003
+++ new/olc_race.c Fri Jan 24 02:15:43 2003
@@ -465,7 +465,7 @@
}
}
- for (rch = char_list; rch != NULL; rch = rch->next)
+ for (rch = char_first; rch != NULL; rch = rch->next)
{
if (rch->race == c)
{
diff -ur src/olc_save.c new/olc_save.c
--- src/olc_save.c Sat Jan 11 16:24:00 2003
+++ new/olc_save.c Fri Jan 24 02:15:43 2003
@@ -99,8 +99,6 @@
{
FILE *fp;
AREA_DATA *pArea;
- extern HELP_AREA *had_list;
- HELP_AREA *ha;
if ((fp = file_open("area.lst", "w")) == NULL)
{
@@ -109,13 +107,7 @@
}
else
{
- /*
- * Add any help files that need to be loaded at
- * startup to this section.
- */
- for (ha = had_list; ha; ha = ha->next)
- if (ha->area == NULL)
- fprintf(fp, "%s\n", ha->filename);
+ fprintf(fp, "%s\n", HELP_FILE);
for (pArea = area_first; pArea; pArea = pArea->next)
{
@@ -136,24 +128,23 @@
{
static int cnt;
static char buf[NBUF][NBITS + 1];
- int count, pos = 0;
+ flag_t count = 0, temp = 1;
cnt = (cnt + 1) % NBUF;
- for (count = 0; count < NBITS; count++)
- if (IS_SET(flags, (flag_t) 1 << count))
- {
- if (count < 26)
- buf[cnt][pos] = 'A' + count;
- else
- buf[cnt][pos] = 'a' + (count - 26);
- pos++;
- }
+ buf[cnt][0] = '+';
- if (pos == 0)
- buf[cnt][pos++] = '0';
+ do
+ {
+ if (IS_SET(flags, (temp << count)))
+ buf[cnt][count + 1] = 'Y';
+ else
+ buf[cnt][count + 1] = 'n';
+ count++;
+ }
+ while ((temp << count) <= flags && count < 64);
- buf[cnt][pos] = '\0';
+ buf[cnt][count + 1] = '\0';
return buf[cnt];
}
@@ -248,7 +239,7 @@
if ((temp = DIF(race_table[race].parts, pMobIndex->parts)))
fprintf(fp, "F par %s\n", fwrite_flags(temp));
- for (pMprog = pMobIndex->mprogs; pMprog; pMprog = pMprog->next)
+ for (pMprog = pMobIndex->first_mprog; pMprog; pMprog = pMprog->next)
{
fprintf(fp, "M %s %ld %s~\n",
mprog_type_to_name(pMprog->trig_type), pMprog->vnum,
@@ -386,7 +377,7 @@
fprintf(fp, "%c\n", letter);
- for (pAf = pObjIndex->affected; pAf; pAf = pAf->next)
+ for (pAf = pObjIndex->first_affect; pAf; pAf = pAf->next)
{
if (pAf->where == TO_OBJECT || pAf->bitvector == 0)
fprintf(fp, "A\n%d %d\n", pAf->location, pAf->modifier);
@@ -418,7 +409,7 @@
}
}
- for (pEd = pObjIndex->extra_descr; pEd; pEd = pEd->next)
+ for (pEd = pObjIndex->first_extra_descr; pEd; pEd = pEd->next)
{
fprintf(fp, "E\n%s~\n%s~\n", pEd->keyword,
fix_string(pEd->description));
@@ -478,7 +469,7 @@
fprintf(fp, "%s ", fwrite_flags(pRoomIndex->room_flags));
fprintf(fp, "%d\n", pRoomIndex->sector_type);
- for (pEd = pRoomIndex->extra_descr; pEd; pEd = pEd->next)
+ for (pEd = pRoomIndex->first_extra_descr; pEd; pEd = pEd->next)
{
fprintf(fp, "E\n%s~\n%s~\n",
pEd->keyword, fix_string(pEd->description));
@@ -880,51 +871,26 @@
return;
}
-void save_helps(FILE * fp, HELP_AREA * ha)
+void save_helps(void)
{
- HELP_DATA *help = ha->first;
-
- fprintf(fp, "#HELPS\n");
+ HELP_DATA *help;
+ FILE *fp;
- for (; help; help = help->next_area)
+ if ((fp = file_open(HELP_FILE, "w")) != NULL)
{
- fprintf(fp, "%d %s~\n", help->level, help->keyword);
- fprintf(fp, "%s~\n\n", fix_string(help->text));
- }
+ fprintf(fp, "#HELPS\n");
- fprintf(fp, "-1 $~\n\n");
-
- ha->changed = FALSE;
-
- return;
-}
-
-void save_other_helps(CHAR_DATA * ch)
-{
- extern HELP_AREA *had_list;
- HELP_AREA *ha;
- FILE *fp;
-
- for (ha = had_list; ha; ha = ha->next)
- if (ha->changed == TRUE)
+ for (help = help_first; help; help = help->next)
{
- fp = file_open(ha->filename, "w");
-
- if (!fp)
- {
- perror(ha->filename);
- return;
- }
-
- save_helps(fp, ha);
-
- if (ch)
- chprintf(ch, "%s\n\r", ha->filename);
-
- fprintf(fp, "#$\n");
- file_close(fp);
+ fprintf(fp, "%d %s~\n", help->level, help->keyword);
+ fprintf(fp, "%s~\n\n", fix_string(help->text));
}
+ fprintf(fp, "-1 $~\n\n");
+ fprintf(fp, "#$\n");
+ }
+ else
+ bug("Error opening " HELP_FILE ".", 0);
return;
}
@@ -960,9 +926,6 @@
save_shops(fp, pArea);
save_mobprogs(fp, pArea);
- if (pArea->helps && pArea->helps->first)
- save_helps(fp, pArea->helps);
-
fprintf(fp, "#$\n");
file_close(fp);
@@ -1020,6 +983,7 @@
chprintln(ch, " asave races - saves race data");
chprintln(ch, " asave classes - saves class data");
chprintln(ch, " asave socials - saves social data");
+ chprintln(ch, " asave helps - saves the help file");
chprintln(ch, "");
}
@@ -1069,7 +1033,7 @@
if (ch)
chprintln(ch, "You saved the world.");
- save_other_helps(NULL);
+ save_helps();
return;
}
@@ -1111,8 +1075,6 @@
}
}
- save_other_helps(ch);
-
if (!str_cmp(buf, "None.\n\r"))
{
if (ch)
@@ -1144,6 +1106,15 @@
chprintln(ch, "Socials saved.");
return;
}
+
+ if (!str_cmp(arg1, "helps"))
+ {
+ save_area_list();
+ save_helps();
+ chprintln(ch, "Helps saved.");
+ return;
+ }
+
if (!str_cmp(arg1, "commands"))
{
save_commands();
@@ -1209,10 +1180,6 @@
case ED_MOBILE:
pArea = ((MOB_INDEX_DATA *) ch->desc->pEdit)->area;
break;
- case ED_HELP:
- chprint(ch, "Grabando area : ");
- save_other_helps(ch);
- return;
default:
pArea = ch->in_room->area;
break;
diff -ur src/olc_social.c new/olc_social.c
--- src/olc_social.c Sat Jan 11 16:24:00 2003
+++ new/olc_social.c Fri Jan 24 02:15:43 2003
@@ -43,10 +43,6 @@
#include "db.h"
#include "olc.h"
-int maxSocial;
-
-struct social_type *social_table; /* and social table */
-
#define SEDIT( fun ) bool fun( CHAR_DATA *ch, const char *argument )
/* Find a social based on name */
diff -ur src/proto.h new/proto.h
--- src/proto.h Sat Jan 11 16:24:00 2003
+++ new/proto.h Fri Jan 24 02:15:43 2003
@@ -275,9 +275,6 @@
bool is_full_name args((const char *str, const char *namelist));
CHAR_DATA *get_char_id args((long id));
-/* hedit.c */
-HELP_AREA *get_help_area args((HELP_DATA * help));
-
/* interp.c */
void interpret args((CHAR_DATA * ch, const char *argument));
bool is_number args((const char *arg));
diff -ur src/quest.c new/quest.c
--- src/quest.c Sat Jan 11 16:24:00 2003
+++ new/quest.c Fri Jan 24 02:15:43 2003
@@ -139,7 +139,7 @@
bool found;
found = FALSE;
- for (paf_old = obj->affected; paf_old != NULL; paf_old = paf_old->next)
+ for (paf_old = obj->first_affect; paf_old != NULL; paf_old = paf_old->next)
{
if (paf_old->location == paf->location &&
paf_old->type == paf->type &&
@@ -272,25 +272,25 @@
OBJ_DATA *obj;
AFFECT_DATA *o_paf;
- for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
+ for (obj = ch->first_carrying; obj != NULL; obj = obj->next_content)
{
if (IS_OBJ_STAT(obj, ITEM_QUEST))
{
update_questobjs(ch, obj);
- for (o_paf = obj->pIndexData->affected; o_paf != NULL;
+ for (o_paf = obj->pIndexData->first_affect; o_paf != NULL;
o_paf = o_paf->next)
affect_join_obj(obj, o_paf);
- for (o_paf = obj->affected; o_paf != NULL; o_paf = o_paf->next)
+ for (o_paf = obj->first_affect; o_paf != NULL; o_paf = o_paf->next)
affect_check(ch, o_paf->where, o_paf->bitvector);
}
else
{
- for (o_paf = obj->affected; o_paf != NULL; o_paf = o_paf->next)
+ for (o_paf = obj->first_affect; o_paf != NULL; o_paf = o_paf->next)
affect_check(ch, o_paf->where, o_paf->bitvector);
if (!obj->enchanted)
{
- for (o_paf = obj->pIndexData->affected;
+ for (o_paf = obj->pIndexData->first_affect;
o_paf != NULL; o_paf = o_paf->next)
affect_check(ch, o_paf->where, o_paf->bitvector);
}
@@ -312,7 +312,7 @@
OBJ_DATA *obj = NULL;
ROOM_INDEX_DATA *pRoom = NULL;
- for (obj = object_list; obj != NULL; obj = obj->next)
+ for (obj = object_first; obj != NULL; obj = obj->next)
if (obj->pIndexData->vnum == ch->pcdata->questobj
&& is_name(ch->name, obj->owner))
found = TRUE;
@@ -340,7 +340,7 @@
{
CHAR_DATA *mob;
- for (mob = char_list; mob != NULL; mob = mob->next)
+ for (mob = char_first; mob != NULL; mob = mob->next)
if (IS_NPC(mob)
&& mob->pIndexData->vnum == ch->pcdata->questmob)
break;
@@ -419,7 +419,7 @@
if ((pObj = get_obj_index(ch->pcdata->questobj)) == 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 != NULL && obj->pIndexData == pObj)
return obj;
@@ -497,7 +497,7 @@
}
else if (ch->pcdata->questobj > 0)
{
- for (qinfoobj = object_list; qinfoobj != NULL;
+ for (qinfoobj = object_first; qinfoobj != NULL;
qinfoobj = qinfoobj->next)
{
if (qinfoobj->pIndexData->vnum == ch->pcdata->questobj)
@@ -524,7 +524,7 @@
}
else if (ch->pcdata->questmob > 0)
{
- for (qinfomob = char_list; qinfomob != NULL;
+ for (qinfomob = char_first; qinfomob != NULL;
qinfomob = qinfomob->next)
{
if (IS_NPC(qinfomob)
@@ -597,7 +597,7 @@
* an ACT_QUESTMASTER flag instead of a special procedure.
*/
- for (questman = ch->in_room->people; questman != NULL;
+ for (questman = ch->in_room->first_person; questman != NULL;
questman = questman->next_in_room)
{
if (!IS_NPC(questman))
@@ -965,7 +965,7 @@
alloc_mem(mobs, CHAR_DATA *, MAX_QMOB_COUNT);
mob_count = 0;
- for (victim = char_list; victim; victim = victim->next)
+ for (victim = char_first; victim; victim = victim->next)
{
if (!IS_NPC(victim)
@@ -1185,7 +1185,7 @@
DESCRIPTOR_DATA *d;
CHAR_DATA *ch;
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING
&& (ch = d->original ? d->original : d->character) != NULL)
@@ -1286,7 +1286,7 @@
OBJ_DATA *c;
int count = 0;
- for (c = object_list; c != NULL; c = c->next)
+ for (c = object_first; c != NULL; c = c->next)
{
if (is_name(ch->name, c->owner)
&& c->item_type == ITEM_CORPSE_PC)
@@ -1361,7 +1361,7 @@
return;
}
}
- for (triviamob = ch->in_room->people; triviamob != NULL;
+ for (triviamob = ch->in_room->first_person; triviamob != NULL;
triviamob = triviamob->next_in_room)
{
if (!IS_NPC(triviamob))
diff -ur src/recycle.c new/recycle.c
--- src/recycle.c Sat Jan 11 16:24:00 2003
+++ new/recycle.c Fri Jan 24 02:15:43 2003
@@ -45,13 +45,7 @@
static BAN_DATA ban_zero;
BAN_DATA *ban;
- if (ban_free == NULL)
- alloc_mem(ban, BAN_DATA, 1);
- else
- {
- ban = ban_free;
- ban_free = ban_free->next;
- }
+ GET_FREE(ban, BAN_DATA, next, ban_free);
*ban = ban_zero;
VALIDATE(ban);
@@ -67,25 +61,17 @@
free_string(ban->name);
INVALIDATE(ban);
- ban->next = ban_free;
- ban_free = ban;
+ PUT_FREE(ban, next, ban_free);
}
/* stuff for recycling descriptors */
-DESCRIPTOR_DATA *descriptor_free;
DESCRIPTOR_DATA *new_descriptor(void)
{
static DESCRIPTOR_DATA d_zero;
DESCRIPTOR_DATA *d;
- if (descriptor_free == NULL)
- alloc_mem(d, DESCRIPTOR_DATA, 1);
- else
- {
- d = descriptor_free;
- descriptor_free = descriptor_free->next;
- }
+ GET_FREE(d, DESCRIPTOR_DATA, next, descriptor_free);
*d = d_zero;
VALIDATE(d);
@@ -107,8 +93,7 @@
free_string(d->host);
free_mem(d->outbuf);
INVALIDATE(d);
- d->next = descriptor_free;
- descriptor_free = d;
+ PUT_FREE(d, next, descriptor_free);
}
/* stuff for recycling gen_data */
@@ -119,13 +104,8 @@
static GEN_DATA gen_zero;
GEN_DATA *gen;
- if (gen_data_free == NULL)
- alloc_mem(gen, GEN_DATA, 1);
- else
- {
- gen = gen_data_free;
- gen_data_free = gen_data_free->next;
- }
+ GET_FREE(gen, GEN_DATA, next, gen_data_free);
+
*gen = gen_zero;
VALIDATE(gen);
alloc_mem(gen->skill_chosen, bool, maxSkill);
@@ -141,8 +121,8 @@
INVALIDATE(gen);
free_mem(gen->skill_chosen);
free_mem(gen->group_chosen);
- gen->next = gen_data_free;
- gen_data_free = gen;
+
+ PUT_FREE(gen, next, gen_data_free);
}
/* stuff for recycling extended descs */
@@ -152,13 +132,7 @@
{
EXTRA_DESCR_DATA *ed;
- if (extra_descr_free == NULL)
- alloc_mem(ed, EXTRA_DESCR_DATA, 1);
- else
- {
- ed = extra_descr_free;
- extra_descr_free = extra_descr_free->next;
- }
+ GET_FREE(ed, EXTRA_DESCR_DATA, next, extra_descr_free);
ed->keyword = &str_empty[0];
ed->description = &str_empty[0];
@@ -175,25 +149,17 @@
free_string(ed->description);
INVALIDATE(ed);
- ed->next = extra_descr_free;
- extra_descr_free = ed;
+ PUT_FREE(ed, next, extra_descr_free);
}
/* stuff for recycling affects */
-AFFECT_DATA *affect_free;
AFFECT_DATA *new_affect(void)
{
static AFFECT_DATA af_zero;
AFFECT_DATA *af;
- if (affect_free == NULL)
- alloc_mem(af, AFFECT_DATA, 1);
- else
- {
- af = affect_free;
- affect_free = affect_free->next;
- }
+ GET_FREE(af, AFFECT_DATA, next, affect_free);
*af = af_zero;
@@ -207,25 +173,19 @@
return;
INVALIDATE(af);
- af->next = affect_free;
- affect_free = af;
+
+ PUT_FREE(af, next, affect_free);
}
/* stuff for recycling objects */
-OBJ_DATA *obj_free;
OBJ_DATA *new_obj(void)
{
static OBJ_DATA obj_zero;
OBJ_DATA *obj;
- if (obj_free == NULL)
- alloc_mem(obj, OBJ_DATA, 1);
- else
- {
- obj = obj_free;
- obj_free = obj_free->next;
- }
+ GET_FREE(obj, OBJ_DATA, next, obj_free);
+
*obj = obj_zero;
VALIDATE(obj);
@@ -240,19 +200,19 @@
if (!IS_VALID(obj))
return;
- for (paf = obj->affected; paf != NULL; paf = paf_next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf_next)
{
paf_next = paf->next;
free_affect(paf);
}
- obj->affected = NULL;
+ obj->first_affect = NULL;
- for (ed = obj->extra_descr; ed != NULL; ed = ed_next)
+ for (ed = obj->first_extra_descr; ed != NULL; ed = ed_next)
{
ed_next = ed->next;
free_extra_descr(ed);
}
- obj->extra_descr = NULL;
+ obj->first_extra_descr = NULL;
free_string(obj->name);
free_string(obj->description);
@@ -260,12 +220,10 @@
free_string(obj->owner);
INVALIDATE(obj);
- obj->next = obj_free;
- obj_free = obj;
+ PUT_FREE(obj, next, obj_free);
}
/* stuff for recyling characters */
-CHAR_DATA *char_free;
CHAR_DATA *new_char(void)
{
@@ -273,13 +231,7 @@
CHAR_DATA *ch;
int i;
- if (char_free == NULL)
- alloc_mem(ch, CHAR_DATA, 1);
- else
- {
- ch = char_free;
- char_free = char_free->next;
- }
+ GET_FREE(ch, CHAR_DATA, next, char_free);
*ch = ch_zero;
VALIDATE(ch);
@@ -323,13 +275,13 @@
if (IS_NPC(ch))
mobile_count--;
- 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);
}
- for (paf = ch->affected; paf != NULL; paf = paf_next)
+ for (paf = ch->first_affect; paf != NULL; paf = paf_next)
{
paf_next = paf->next;
affect_remove(ch, paf);
@@ -343,15 +295,12 @@
free_string(ch->prefix);
free_pcdata(ch->pcdata);
- ch->next = char_free;
- char_free = ch;
+ PUT_FREE(ch, next, char_free);
INVALIDATE(ch);
return;
}
-PC_DATA *pcdata_free;
-
PC_DATA *new_pcdata(void)
{
int alias;
@@ -359,13 +308,7 @@
static PC_DATA pcdata_zero;
PC_DATA *pcdata;
- if (pcdata_free == NULL)
- alloc_mem(pcdata, PC_DATA, 1);
- else
- {
- pcdata = pcdata_free;
- pcdata_free = pcdata_free->next;
- }
+ GET_FREE(pcdata, PC_DATA, next, pcdata_free);
*pcdata = pcdata_zero;
@@ -403,8 +346,8 @@
free_string(pcdata->alias_sub[alias]);
}
INVALIDATE(pcdata);
- pcdata->next = pcdata_free;
- pcdata_free = pcdata;
+
+ PUT_FREE(pcdata, next, pcdata_free);
return;
}
@@ -438,13 +381,7 @@
{
MEM_DATA *memory;
- if (mem_data_free == NULL)
- alloc_mem(memory, MEM_DATA, 1);
- else
- {
- memory = mem_data_free;
- mem_data_free = mem_data_free->next;
- }
+ GET_FREE(memory, MEM_DATA, next, mem_data_free);
memory->next = NULL;
memory->id = 0;
@@ -460,9 +397,8 @@
if (!IS_VALID(memory))
return;
- memory->next = mem_data_free;
- mem_data_free = memory;
INVALIDATE(memory);
+ PUT_FREE(memory, next, mem_data_free);
}
/* buffer sizes */
@@ -489,13 +425,7 @@
{
BUFFER *buffer;
- if (buf_free == NULL)
- alloc_mem(buffer, BUFFER, 1);
- else
- {
- buffer = buf_free;
- buf_free = buf_free->next;
- }
+ GET_FREE(buffer, BUFFER, next, buf_free);
buffer->next = NULL;
buffer->state = BUFFER_SAFE;
@@ -512,13 +442,7 @@
{
BUFFER *buffer;
- if (buf_free == NULL)
- alloc_mem(buffer, BUFFER, 1);
- else
- {
- buffer = buf_free;
- buf_free = buf_free->next;
- }
+ GET_FREE(buffer, BUFFER, next, buf_free);
buffer->next = NULL;
buffer->state = BUFFER_SAFE;
@@ -546,8 +470,7 @@
buffer->state = BUFFER_FREED;
INVALIDATE(buffer);
- buffer->next = buf_free;
- buf_free = buffer;
+ PUT_FREE(buffer, next, buf_free);
}
bool add_buf(BUFFER * buffer, const char *string)
@@ -609,13 +532,7 @@
static MPROG_LIST mp_zero;
MPROG_LIST *mp;
- if (mprog_free == NULL)
- alloc_mem(mp, MPROG_LIST, 1);
- else
- {
- mp = mprog_free;
- mprog_free = mprog_free->next;
- }
+ GET_FREE(mp, MPROG_LIST, next, mprog_free);
*mp = mp_zero;
mp->vnum = 0;
@@ -631,28 +548,8 @@
return;
INVALIDATE(mp);
- mp->next = mprog_free;
- mprog_free = mp;
-}
-
-HELP_AREA *had_free;
-
-HELP_AREA *new_had(void)
-{
- HELP_AREA *had;
- static HELP_AREA zHad;
-
- if (had_free)
- {
- had = had_free;
- had_free = had_free->next;
- }
- else
- alloc_mem(had, HELP_AREA, 1);
- *had = zHad;
-
- return had;
+ PUT_FREE(mp, next, mprog_free);
}
HELP_DATA *help_free;
@@ -661,13 +558,10 @@
{
HELP_DATA *help;
- if (help_free)
- {
- help = help_free;
- help_free = help_free->next;
- }
- else
- alloc_mem(help, HELP_DATA, 1);
+ GET_FREE(help, HELP_DATA, next, help_free);
+
+ help->keyword = &str_empty[0];
+ help->text = &str_empty[0];
return help;
}
@@ -676,8 +570,8 @@
{
free_string(help->keyword);
free_string(help->text);
- help->next = help_free;
- help_free = help;
+
+ PUT_FREE(help, next, help_free);
}
/*
@@ -690,13 +584,7 @@
static STAT_DATA stat_zero;
STAT_DATA *stat;
- if (stat_free == NULL)
- alloc_mem(stat, STAT_DATA, 1);
- else
- {
- stat = stat_free;
- stat_free = stat_free->next;
- }
+ GET_FREE(stat, STAT_DATA, next, stat_free);
*stat = stat_zero;
VALIDATE(stat);
@@ -712,8 +600,7 @@
free_string(stat->name);
INVALIDATE(stat);
- stat->next = stat_free;
- stat_free = stat;
+ PUT_FREE(stat, next, stat_free);
}
CORPSE_DATA *corpse_free;
@@ -723,13 +610,7 @@
static CORPSE_DATA corpse_zero;
CORPSE_DATA *corpse;
- if (corpse_free == NULL)
- alloc_mem(corpse, CORPSE_DATA, 1);
- else
- {
- corpse = corpse_free;
- corpse_free = corpse_free->next;
- }
+ GET_FREE(corpse, CORPSE_DATA, next, corpse_free);
*corpse = corpse_zero;
@@ -746,8 +627,8 @@
if (corpse->corpse != NULL)
free_obj(corpse->corpse);
- corpse->next = corpse_free;
- corpse_free = corpse;
+ PUT_FREE(corpse, next, corpse_free);
+
return;
}
@@ -758,13 +639,7 @@
static AUCTION_DATA auc_zero;
AUCTION_DATA *auction;
- if (auction_free == NULL)
- alloc_mem(auction, AUCTION_DATA, 1);
- else
- {
- auction = auction_free;
- auction_free = auction_free->next;
- }
+ GET_FREE(auction, AUCTION_DATA, next, auction_free);
*auction = auc_zero;
VALIDATE(auction);
@@ -782,6 +657,5 @@
INVALIDATE(auction);
- auction->next = auction_free;
- auction_free = auction;
+ PUT_FREE(auction, next, auction_free);
}
diff -ur src/recycle.h new/recycle.h
--- src/recycle.h Sat Jan 11 16:24:00 2003
+++ new/recycle.h Fri Jan 24 02:15:43 2003
@@ -35,6 +35,25 @@
int get_size(int val);
+#define GET_FREE(point, type, pnext, freelist) \
+do { \
+ if ( freelist != NULL ) \
+ { \
+ point = freelist; \
+ freelist = freelist->pnext; \
+ } \
+ else \
+ { \
+ alloc_mem(point, type, 1); \
+ }\
+ memset(point, 0, sizeof(*point)); \
+} while(0)
+
+#define PUT_FREE(point, next, freelist) \
+do { \
+ LINK_SINGLE(point, next, freelist); \
+} while(0)
+
/* stuff for providing a crash-proof buffer */
#define MAX_BUF 16384
@@ -109,7 +128,6 @@
void clear_buf args((BUFFER * buffer));
char *buf_string args((BUFFER * buffer));
-HELP_AREA *new_had args((void));
HELP_DATA *new_help args((void));
void free_help args((HELP_DATA *));
diff -ur src/save.c new/save.c
--- src/save.c Sat Jan 11 16:24:00 2003
+++ new/save.c Fri Jan 24 02:15:43 2003
@@ -100,8 +100,8 @@
else
{
fwrite_char(ch, fp);
- if (ch->carrying != NULL)
- fwrite_obj(ch, ch->carrying, fp, 0);
+ if (ch->first_carrying != NULL)
+ fwrite_obj(ch, ch->first_carrying, fp, 0);
/* save the pets */
if (ch->pet != NULL && ch->pet->in_room == ch->in_room)
fwrite_pet(ch->pet, fp);
@@ -322,7 +322,7 @@
}
}
- for (paf = ch->affected; paf != NULL; paf = paf->next)
+ for (paf = ch->first_affect; paf != NULL; paf = paf->next)
{
if (paf->type < 0 || paf->type >= maxSkill)
continue;
@@ -394,7 +394,7 @@
pet->mod_stat[STAT_INT], pet->mod_stat[STAT_WIS],
pet->mod_stat[STAT_DEX], pet->mod_stat[STAT_CON]);
- for (paf = pet->affected; paf != NULL; paf = paf->next)
+ for (paf = pet->first_affect; paf != NULL; paf = paf->next)
{
if (paf->type < 0 || paf->type >= maxSkill)
continue;
@@ -521,7 +521,7 @@
break;
}
- for (paf = obj->affected; paf != NULL; paf = paf->next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf->next)
{
if (paf->type < 0 || paf->type >= maxSkill)
continue;
@@ -531,15 +531,15 @@
fwrite_flags(paf->bitvector));
}
- for (ed = obj->extra_descr; ed != NULL; ed = ed->next)
+ for (ed = obj->first_extra_descr; ed != NULL; ed = ed->next)
{
fprintf(fp, "ExDe %s~ %s~\n", ed->keyword, ed->description);
}
fprintf(fp, "End\n\n");
- if (obj->contains != NULL)
- fwrite_obj(ch, obj->contains, fp, iNest + 1);
+ if (obj->first_content != NULL)
+ fwrite_obj(ch, obj->first_content, fp, iNest + 1);
return;
}
@@ -831,8 +831,7 @@
paf->modifier = fread_number(fp);
paf->location = fread_number(fp);
paf->bitvector = fread_number(fp);
- paf->next = ch->affected;
- ch->affected = paf;
+ LINK(paf, ch->first_affect, ch->last_affect, next, prev);
fMatch = TRUE;
break;
}
@@ -856,8 +855,7 @@
paf->modifier = fread_number(fp);
paf->location = fread_number(fp);
paf->bitvector = fread_flag(fp);
- paf->next = ch->affected;
- ch->affected = paf;
+ LINK(paf, ch->first_affect, ch->last_affect, next, prev);
fMatch = TRUE;
break;
}
@@ -1342,8 +1340,7 @@
paf->modifier = fread_number(fp);
paf->location = fread_number(fp);
paf->bitvector = fread_number(fp);
- paf->next = pet->affected;
- pet->affected = paf;
+ LINK(paf, pet->first_affect, pet->last_affect, next, prev);
fMatch = TRUE;
break;
}
@@ -1367,8 +1364,7 @@
paf->modifier = fread_number(fp);
paf->location = fread_number(fp);
paf->bitvector = fread_flag(fp);
- paf->next = pet->affected;
- pet->affected = paf;
+ LINK(paf, pet->first_affect, pet->last_affect, next, prev);
fMatch = TRUE;
break;
}
@@ -1582,8 +1578,7 @@
paf->modifier = fread_number(fp);
paf->location = fread_number(fp);
paf->bitvector = fread_number(fp);
- paf->next = obj->affected;
- obj->affected = paf;
+ LINK(paf, obj->first_affect, obj->last_affect, next, prev);
fMatch = TRUE;
break;
}
@@ -1606,8 +1601,7 @@
paf->modifier = fread_number(fp);
paf->location = fread_number(fp);
paf->bitvector = fread_flag(fp);
- paf->next = obj->affected;
- obj->affected = paf;
+ LINK(paf, obj->first_affect, obj->last_affect, next, prev);
fMatch = TRUE;
break;
}
@@ -1643,8 +1637,8 @@
ed->keyword = fread_string(fp);
ed->description = fread_string(fp);
- ed->next = obj->extra_descr;
- obj->extra_descr = ed;
+ LINK(ed, obj->first_extra_descr, obj->last_extra_descr, next,
+ prev);
fMatch = TRUE;
}
@@ -1666,8 +1660,7 @@
if (!new_format)
{
- obj->next = object_list;
- object_list = obj;
+ LINK(obj, object_first, object_last, next, prev);
obj->pIndexData->count++;
}
@@ -1696,8 +1689,7 @@
c = new_corpse();
c->corpse = obj;
- c->next = corpse_list;
- corpse_list = c;
+ LINK(c, corpse_first, corpse_last, next, prev);
if ((Room = get_room_index(where)) == NULL)
Room = get_room_index(ROOM_VNUM_MORGUE);
obj_to_room(obj, Room);
@@ -1843,7 +1835,8 @@
}
}
-CORPSE_DATA *corpse_list;
+CORPSE_DATA *corpse_first;
+CORPSE_DATA *corpse_last;
void save_corpses(void)
{
@@ -1856,7 +1849,7 @@
}
else
{
- for (c = corpse_list; c != NULL; c = c->next)
+ for (c = corpse_first; c != NULL; c = c->next)
{
if (c->corpse->item_type == ITEM_CORPSE_PC)
fwrite_obj(NULL, c->corpse, fp, 0);
@@ -1923,44 +1916,23 @@
{
CORPSE_DATA *c;
- for (c = corpse_list; c != NULL; c = c->next)
+ for (c = corpse_first; c != NULL; c = c->next)
if (c->corpse == obj)
break;
if (c != NULL)
{
- if (c == corpse_list)
- {
- corpse_list = c->next;
- }
- else
- {
- CORPSE_DATA *aux;
-
- for (aux = corpse_list; aux != NULL; aux = aux->next)
- {
- if (aux->next == c)
- {
- aux->next = c->next;
- break;
- }
-
- if (aux == NULL)
- {
- bug("update_corpses: corpse not found.", 0);
- return;
- }
- }
- }
if (pdelete)
+ {
+ UNLINK(c, corpse_first, corpse_last, next, prev);
free_corpse(c);
+ }
save_corpses();
}
- else if (obj->contains != NULL && obj->in_room != NULL)
+ else if (obj->first_content != NULL && obj->in_room != NULL)
{
c = new_corpse();
c->corpse = obj;
- c->next = corpse_list;
- corpse_list = c;
+ LINK(c, corpse_first, corpse_last, next, prev);
save_corpses();
}
}
@@ -1976,7 +1948,7 @@
if (!ch || IS_NPC(ch))
return;
- for (c = corpse_list; c != NULL; c = c->next)
+ for (c = corpse_first; c != NULL; c = c->next)
{
if (c->corpse && is_name(ch->name, c->corpse->owner))
{
diff -ur src/scan.c new/scan.c
--- src/scan.c Sat Jan 11 16:24:00 2003
+++ new/scan.c Fri Jan 24 02:15:43 2003
@@ -105,7 +105,7 @@
if (scan_room == NULL)
return;
- for (rch = scan_room->people; rch != NULL; rch = rch->next_in_room)
+ for (rch = scan_room->first_person; rch != NULL; rch = rch->next_in_room)
{
if (rch == ch)
continue;
diff -ur src/skills.c new/skills.c
--- src/skills.c Sat Jan 11 16:24:00 2003
+++ new/skills.c Fri Jan 24 02:15:43 2003
@@ -50,7 +50,7 @@
return;
/* find a trainer */
- for (trainer = ch->in_room->people; trainer != NULL;
+ for (trainer = ch->in_room->first_person; trainer != NULL;
trainer = trainer->next_in_room)
if (IS_NPC(trainer) && IS_SET(trainer->act, ACT_GAIN))
break;
diff -ur src/special.c new/special.c
--- src/special.c Sat Jan 11 16:24:00 2003
+++ new/special.c Fri Jan 24 02:15:43 2003
@@ -139,7 +139,7 @@
return FALSE;
/* find an ogre to beat up */
- 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 (!IS_NPC(vch) || ch == vch)
continue;
@@ -208,7 +208,7 @@
return FALSE;
/* find an troll to beat up */
- 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 (!IS_NPC(vch) || ch == vch)
continue;
@@ -277,7 +277,7 @@
return FALSE;
/* look for a fight in the 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)
{
if (vch == ch)
continue;
@@ -302,7 +302,7 @@
act("You blow down hard on $p.", ch, obj, NULL, TO_CHAR);
act("$n blows on $p, ***WHEEEEEEEEEEEET***", ch, obj, NULL, TO_ROOM);
- for (vch = char_list; vch != NULL; vch = vch->next)
+ for (vch = char_first; vch != NULL; vch = vch->next)
{
if (vch->in_room == NULL)
continue;
@@ -361,7 +361,8 @@
if (ch->position != POS_FIGHTING)
{
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL;
+ victim = v_next)
{
v_next = victim->next_in_room;
if (!IS_NPC(victim) && (victim->level > ch->level) &&
@@ -420,7 +421,7 @@
if (ch->position != POS_FIGHTING)
return FALSE;
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
if (victim->fighting == ch && number_bits(3) == 0)
@@ -505,7 +506,7 @@
if (!IS_AWAKE(ch))
return FALSE;
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
if (victim != ch && can_see(ch, victim) && number_bits(1) == 0
@@ -574,7 +575,7 @@
if (ch->position != POS_FIGHTING)
return FALSE;
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
if (victim->fighting == ch && number_bits(2) == 0)
@@ -658,7 +659,7 @@
if (ch->position != POS_FIGHTING)
return FALSE;
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
if (victim->fighting == ch && number_bits(2) == 0)
@@ -685,7 +686,7 @@
if (ch->position != POS_FIGHTING)
return FALSE;
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
if (victim->fighting == ch && number_bits(2) == 0)
@@ -765,7 +766,7 @@
if (ch->position != POS_FIGHTING)
return FALSE;
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
if (victim->fighting == ch && number_bits(2) == 0)
@@ -844,7 +845,7 @@
return FALSE;
crime = "";
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
@@ -884,14 +885,14 @@
if (!IS_AWAKE(ch))
return FALSE;
- for (corpse = ch->in_room->contents; corpse != NULL; corpse = c_next)
+ for (corpse = ch->in_room->first_content; corpse != NULL; corpse = c_next)
{
c_next = corpse->next_content;
if (corpse->item_type != ITEM_CORPSE_NPC)
continue;
act("$n savagely devours a corpse.", ch, NULL, NULL, TO_ROOM);
- for (obj = corpse->contains; obj; obj = obj_next)
+ for (obj = corpse->first_content; obj; obj = obj_next)
{
obj_next = obj->next_content;
obj_from_obj(obj);
@@ -920,7 +921,7 @@
ech = NULL;
crime = "";
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
@@ -975,7 +976,7 @@
if (!IS_AWAKE(ch))
return FALSE;
- for (trash = ch->in_room->contents; trash != NULL; trash = trash_next)
+ for (trash = ch->in_room->first_content; trash != NULL; trash = trash_next)
{
trash_next = trash->next_content;
if (!IS_SET(trash->wear_flags, ITEM_TAKE) || !can_loot(ch, trash))
@@ -1117,7 +1118,7 @@
if (ch->position != POS_STANDING)
return FALSE;
- for (victim = ch->in_room->people; victim != NULL; victim = v_next)
+ for (victim = ch->in_room->first_person; victim != NULL; victim = v_next)
{
v_next = victim->next_in_room;
diff -ur src/statlist.c new/statlist.c
--- src/statlist.c Sat Jan 11 16:24:00 2003
+++ new/statlist.c Fri Jan 24 02:15:43 2003
@@ -36,8 +36,6 @@
#include "interp.h"
#include "recycle.h"
-STAT_DATA *stat_list;
-
void update_statlist(CHAR_DATA * ch, bool pdelete)
{
STAT_DATA *prev;
@@ -49,15 +47,13 @@
prev = NULL;
- for (curr = stat_list; curr != NULL; prev = curr, curr = curr->next)
+ for (curr = stat_first; curr != NULL; curr = prev)
{
+ prev = curr->next;
+
if (!str_cmp(ch->name, curr->name))
{
- if (prev == NULL)
- stat_list = stat_list->next;
- else
- prev->next = curr->next;
-
+ UNLINK(curr, stat_first, stat_last, next, prev);
free_stat_data(curr);
save_statlist();
}
@@ -72,8 +68,7 @@
for (i = 0; i < MAX_GAMESTAT; i++)
curr->gamestat[i] = ch->pcdata->gamestat[i];
- curr->next = stat_list;
- stat_list = curr;
+ LINK(curr, stat_first, stat_last, next, prev);
save_statlist();
return;
}
@@ -104,15 +99,13 @@
STAT_DATA *curr = NULL;
bool found = FALSE;
- for (curr = stat_list; curr != NULL; prev = curr, curr = curr->next)
+ for (curr = stat_first; curr != NULL; curr = prev)
{
+ prev = curr->next;
+
if (!str_cmp(argument, curr->name))
{
- if (prev == NULL)
- stat_list = stat_list->next;
- else
- prev->next = curr->next;
-
+ UNLINK(curr, stat_first, stat_last, next, prev);
free_stat_data(curr);
save_statlist();
found = TRUE;
@@ -155,7 +148,7 @@
STAT_DATA *stat;
int i = 0;
- for (stat = stat_list; stat != NULL; stat = stat->next)
+ for (stat = stat_first; stat != NULL; stat = stat->next)
i++;
return i;
@@ -189,7 +182,7 @@
add_buf(output, "\n\r");
loop = 0;
loop = 0;
- for (curr = stat_list; curr != NULL; curr = curr->next)
+ for (curr = stat_first; curr != NULL; curr = curr->next)
{
top[count] = curr;
count++;
diff -ur src/string.c new/string.c
--- src/string.c Sat Jan 11 16:24:00 2003
+++ new/string.c Fri Jan 24 02:15:43 2003
@@ -378,11 +378,11 @@
if (mpc != NULL)
for (hash = 0; hash < MAX_KEY_HASH; hash++)
for (mob = mob_index_hash[hash]; mob; mob = mob->next)
- for (mpl = mob->mprogs; mpl; mpl = mpl->next)
+ for (mpl = mob->first_mprog; mpl; mpl = mpl->next)
if (mpl->vnum == mpc->vnum)
{
chprintlnf(ch, "Fixing mob %ld.", mob->vnum);
- mpl->code = mpc->code;
+ replace_string(mpl->code, mpc->code);
}
}
ch->desc->pString = NULL;
diff -ur src/tables.c new/tables.c
--- src/tables.c Sat Jan 11 16:24:00 2003
+++ new/tables.c Fri Jan 24 02:15:43 2003
@@ -515,7 +515,6 @@
* What is seen.
*/
const struct flag_type wear_loc_strings[] = {
- {"in the inventory", WEAR_NONE, TRUE},
{"as a light", WEAR_LIGHT, TRUE},
{"on the left finger", WEAR_FINGER_L, TRUE},
{"on the right finger", WEAR_FINGER_R, TRUE},
@@ -540,7 +539,6 @@
};
const struct flag_type wear_loc_flags[] = {
- {"none", WEAR_NONE, TRUE},
{"light", WEAR_LIGHT, TRUE},
{"lfinger", WEAR_FINGER_L, TRUE},
{"rfinger", WEAR_FINGER_R, TRUE},
@@ -917,7 +915,7 @@
{"normal", LOG_NORMAL, TRUE},
{"always", LOG_ALWAYS, TRUE},
{"never", LOG_NEVER, TRUE},
- {NULL, -1, FALSE}
+ {NULL, 0, FALSE}
};
const struct flag_type target_flags[] = {
diff -ur src/tables.h new/tables.h
--- src/tables.h Sat Jan 11 16:24:00 2003
+++ new/tables.h Fri Jan 24 02:15:43 2003
@@ -82,7 +82,7 @@
struct flag_type
{
const char *name;
- int bit;
+ flag_t bit;
bool settable;
};
diff -ur src/tablesave.c new/tablesave.c
--- src/tablesave.c Sat Jan 11 16:24:00 2003
+++ new/tablesave.c Fri Jan 24 02:15:43 2003
@@ -390,8 +390,7 @@
(flag_t *) ((int) temp->puntero_field -
(int) typebase + (int) puntero);
string = fread_string(fp);
- if ((*pentero = flag_value(flagtable, string)) == NO_FLAG)
- *pentero = 0;
+ *pentero = flag_value(flagtable, string);
free_string(string);
found = TRUE, cnt++;
break;
@@ -402,8 +401,7 @@
(int *) ((int) temp->puntero_field - (int) typebase +
(int) puntero);
string = fread_string(fp);
- if ((*pint = flag_value(flagtable, string)) == NO_FLAG)
- *pint = 0;
+ *pint = flag_value(flagtable, string);
free_string(string);
found = TRUE, cnt++;
break;
@@ -1328,7 +1326,7 @@
return;
}
- for (pstat = stat_list; pstat != NULL; pstat = pstat->next)
+ for (pstat = stat_first; pstat != NULL; pstat = pstat->next)
{
fprintf(fp, "#STAT\n");
save_struct(fp, &stat, statsavetable, pstat);
@@ -1370,8 +1368,7 @@
pstat = new_stat_data();
load_struct(fp, &stat, statsavetable, pstat);
- pstat->next = stat_list;
- stat_list = pstat;
+ LINK(pstat, stat_first, stat_last, next, prev);
}
file_close(fp);
}
@@ -1393,7 +1390,7 @@
return;
}
- for (pban = ban_list; pban != NULL; pban = pban->next)
+ for (pban = ban_first; pban != NULL; pban = pban->next)
{
fprintf(fp, "#BAN\n");
save_struct(fp, &ban, bansavetable, pban);
@@ -1436,8 +1433,7 @@
pban = new_ban();
load_struct(fp, &ban, bansavetable, pban);
- pban->next = ban_list;
- ban_list = pban;
+ LINK(pban, ban_first, ban_last, next, prev);
}
file_close(fp);
}
diff -ur src/telnet.c new/telnet.c
--- src/telnet.c Sat Jan 11 16:24:00 2003
+++ new/telnet.c Fri Jan 24 02:15:43 2003
@@ -105,6 +105,9 @@
else
REMOVE_BIT(ch->comm, COMM_TELNET_EOR);
+ if (IS_SET(ch->comm, COMM_NOCOLOUR))
+ REMOVE_BIT(d->d_flags, DESC_COLOUR);
+
return;
}
@@ -130,7 +133,7 @@
#endif
/* telnet window size negotiation */
- write_to_descriptor(d, naws_do, strlen(naws_do));
+ write_to_descriptor(d, naws_do, 0);
return;
}
@@ -270,7 +273,7 @@
if (IS_SET(d->d_flags, DESC_TELOPT_NAWS))
return;
- write_to_descriptor(d, naws_do, strlen(naws_do));
+ write_to_descriptor(d, naws_do, 0);
return;
}
@@ -315,7 +318,7 @@
if (buf[i] == (signed char) IAC)
{
/* Telnet Window Size Negotiation */
- MTELOPT(naws_sb, telopt_naws(d, i, buf), 4);
+ MTELOPT(naws_sb, telopt_naws(d, i, buf), 6);
MTELOPT(naws_will, telopt_naws_do(d), 0);
MTELOPT(naws_wont, telopt_ignore(), 0);
diff -ur src/update.c new/update.c
--- src/update.c Sat Jan 11 16:24:00 2003
+++ new/update.c Fri Jan 24 02:15:43 2003
@@ -394,7 +394,7 @@
int door;
/* Examine all mobs. */
- for (ch = char_list; ch != NULL; ch = ch_next)
+ for (ch = char_first; ch != NULL; ch = ch_next)
{
ch_next = ch->next;
@@ -450,7 +450,7 @@
/* Scavenge */
if (IS_SET(ch->act, ACT_SCAVENGER) &&
- ch->in_room->contents != NULL && number_bits(6) == 0)
+ ch->in_room->first_content != NULL && number_bits(6) == 0)
{
OBJ_DATA *obj;
OBJ_DATA *obj_best;
@@ -458,7 +458,7 @@
max = 1;
obj_best = 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 (CAN_WEAR(obj, ITEM_TAKE)
&& can_loot(ch, obj) && obj->cost > max && obj->cost > 0)
@@ -623,7 +623,7 @@
if (buf[0] != '\0')
{
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
if (d->connected == CON_PLAYING
&& IS_OUTSIDE(d->character) && IS_AWAKE(d->character))
@@ -651,7 +651,7 @@
if (save_number > 29)
save_number = 0;
- for (ch = char_list; ch != NULL; ch = ch_next)
+ for (ch = char_first; ch != NULL; ch = ch_next)
{
AFFECT_DATA *paf;
AFFECT_DATA *paf_next;
@@ -737,7 +737,7 @@
gain_condition(ch, COND_HUNGER, ch->size > SIZE_MEDIUM ? -2 : -1);
}
- 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->duration > 0)
@@ -781,7 +781,7 @@
act("$n writhes in agony as plague sores erupt from $s skin.",
ch, NULL, NULL, TO_ROOM);
chprintln(ch, "You writhe in agony from the plague.");
- 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;
@@ -804,7 +804,7 @@
plague.modifier = -5;
plague.bitvector = AFF_PLAGUE;
- for (vch = ch->in_room->people; vch != NULL;
+ for (vch = ch->in_room->first_person; vch != NULL;
vch = vch->next_in_room)
{
if (!saves_spell
@@ -830,7 +830,7 @@
{
AFFECT_DATA *poison;
- poison = affect_find(ch->affected, gsn_poison);
+ poison = affect_find(ch->first_affect, gsn_poison);
if (poison != NULL)
{
@@ -855,7 +855,7 @@
* Autosave and autoquit.
* Check that these chars still exist.
*/
- for (ch = char_list; ch != NULL; ch = ch_next)
+ for (ch = char_first; ch != NULL; ch = ch_next)
{
ch_next = ch->next;
@@ -883,7 +883,7 @@
OBJ_DATA *obj_next;
AFFECT_DATA *paf, *paf_next;
- for (obj = object_list; obj != NULL; obj = obj_next)
+ for (obj = object_first; obj != NULL; obj = obj_next)
{
CHAR_DATA *rch;
char *message;
@@ -891,7 +891,7 @@
obj_next = obj->next;
/* go through affects and decrement */
- for (paf = obj->affected; paf != NULL; paf = paf_next)
+ for (paf = obj->first_affect; paf != NULL; paf = paf_next)
{
paf_next = paf->next;
if (paf->duration > 0)
@@ -916,9 +916,9 @@
[paf->type].msg_obj, rch, obj, NULL, TO_CHAR);
}
if (obj->in_room != NULL &&
- obj->in_room->people != NULL)
+ obj->in_room->first_person != NULL)
{
- rch = obj->in_room->people;
+ rch = obj->in_room->first_person;
act(skill_table
[paf->type].msg_obj, rch, obj, NULL, TO_ALL);
}
@@ -957,7 +957,7 @@
break;
case ITEM_CONTAINER:
if (CAN_WEAR(obj, ITEM_WEAR_FLOAT))
- if (obj->contains)
+ if (obj->first_content)
message =
"$p flickers and vanishes, spilling its contents on the floor.";
else
@@ -979,7 +979,8 @@
act(message, obj->carried_by, obj, NULL, TO_ROOM);
}
}
- else if (obj->in_room != NULL && (rch = obj->in_room->people) != NULL)
+ else if (obj->in_room != NULL
+ && (rch = obj->in_room->first_person) != NULL)
{
if (!
(obj->in_obj &&
@@ -992,11 +993,11 @@
}
if ((obj->item_type == ITEM_CORPSE_PC ||
- obj->wear_loc == WEAR_FLOAT) && obj->contains)
+ obj->wear_loc == WEAR_FLOAT) && obj->first_content)
{ /* save the contents */
OBJ_DATA *t_obj, *next_obj;
- for (t_obj = obj->contains; t_obj != NULL; t_obj = next_obj)
+ for (t_obj = obj->first_content; t_obj != NULL; t_obj = next_obj)
{
next_obj = t_obj->next_content;
obj_from_obj(t_obj);
@@ -1051,7 +1052,7 @@
CHAR_DATA *vch_next;
CHAR_DATA *victim;
- for (wch = player_list; wch != NULL; wch = wch_next)
+ for (wch = player_first; wch != NULL; wch = wch_next)
{
if (wch->next == NULL)
{
@@ -1063,7 +1064,7 @@
IS_SET(wch->in_room->room_flags, ROOM_SAFE))
continue;
- for (ch = wch->in_room->people; ch != NULL; ch = ch_next)
+ for (ch = wch->in_room->first_person; ch != NULL; ch = ch_next)
{
int count;
@@ -1083,7 +1084,7 @@
*/
count = 0;
victim = NULL;
- for (vch = wch->in_room->people; vch != NULL; vch = vch_next)
+ for (vch = wch->in_room->first_person; vch != NULL; vch = vch_next)
{
vch_next = vch->next_in_room;
diff -ur src/war.c new/war.c
--- src/war.c Sat Jan 11 16:24:00 2003
+++ new/war.c Fri Jan 24 02:15:43 2003
@@ -83,7 +83,7 @@
CHAR_DATA *wch, *warmaster = NULL;
int blevel, elevel, type;
- for (warmaster = ch->in_room->people; warmaster != NULL;
+ for (warmaster = ch->in_room->first_person; warmaster != NULL;
warmaster = warmaster->next_in_room)
{
if (!IS_NPC(warmaster))
@@ -205,7 +205,7 @@
war_info.max_level);
war_info.timer = 3;
war_info.next = 0;
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (IS_SET(wch->act, PLR_WAR))
REMOVE_BIT(wch->act, PLR_WAR);
@@ -225,7 +225,7 @@
if (war_info.iswar != WAR_OFF)
return;
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (!wch->desc)
continue;
@@ -239,7 +239,7 @@
heros++;
if (is_clan(wch))
{
- for (wch_last = player_list; wch_last != NULL;
+ for (wch_last = player_first; wch_last != NULL;
wch_last = wch_last->next_player)
{
if (!IS_NPC(wch_last)
@@ -266,7 +266,7 @@
maxlvl = LEVEL_HERO;
else
maxlvl = UMIN(LEVEL_HERO, number_range((middle * 3) / 2, maxlvl));
- for (warmaster = char_list; warmaster != NULL; warmaster = warmaster->next)
+ for (warmaster = char_first; warmaster != NULL; warmaster = warmaster->next)
if (warmaster->pIndexData
&& warmaster->pIndexData->vnum == MOB_VNUM_WARMASTER)
break;
@@ -297,7 +297,7 @@
war_info.max_level);
war_info.timer = 3;
war_info.next = 0;
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (IS_SET(wch->act, PLR_WAR))
REMOVE_BIT(wch->act, PLR_WAR);
@@ -318,7 +318,7 @@
war_info.inwar = 0;
war_info.timer = 0;
war_info.next = number_range(100, 200);
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (IS_SET_WAR(wch))
{
@@ -460,7 +460,7 @@
chprintlnf(ch, "{g%s{x",
stringf(0, ALIGN_CENTER, "-", "[ {WWAR COMBATENTS{g ]"));
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (IS_SET(wch->act, PLR_WAR))
{
@@ -557,11 +557,11 @@
CHAR_DATA *ch;
CHAR_DATA *vict;
- for (ch = player_list; ch != NULL; ch = ch->next_player)
+ for (ch = player_first; ch != NULL; ch = ch->next_player)
{
if (IS_SET(ch->act, PLR_WAR))
{
- for (vict = player_list; vict != NULL; vict = vict->next_player)
+ for (vict = player_first; vict != NULL; vict = vict->next_player)
{
if (IS_SET(vict->act, PLR_WAR))
{
@@ -581,11 +581,11 @@
CHAR_DATA *ch;
CHAR_DATA *vict;
- for (ch = player_list; ch != NULL; ch = ch->next_player)
+ for (ch = player_first; ch != NULL; ch = ch->next_player)
{
if (IS_SET(ch->act, PLR_WAR))
{
- for (vict = player_list; vict != NULL; vict = vict->next_player)
+ for (vict = player_first; vict != NULL; vict = vict->next_player)
{
if (IS_SET(vict->act, PLR_WAR))
{
@@ -605,11 +605,11 @@
CHAR_DATA *ch;
CHAR_DATA *vict;
- for (ch = player_list; ch != NULL; ch = ch->next_player)
+ for (ch = player_first; ch != NULL; ch = ch->next_player)
{
if (IS_SET(ch->act, PLR_WAR) && is_clan(ch))
{
- for (vict = player_list; vict != NULL; vict = vict->next_player)
+ for (vict = player_first; vict != NULL; vict = vict->next_player)
{
if (IS_SET(vict->act, PLR_WAR) && is_clan(vict))
{
@@ -644,7 +644,7 @@
sprintf(buf, "{RType : {W%s war.{x", wartype_name(war_info.wartype));
add_buf(output, buf);
add_buf(output, "{WWAR COMBATENTS{g\n\r--------------{x");
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (!IS_SET_WAR(wch))
continue;
@@ -739,7 +739,7 @@
war_info.timer =
number_range(3 * war_info.inwar, 5 * war_info.inwar);
war_info.iswar = WAR_RUNNING;
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (IS_SET(wch->act, PLR_WAR))
{
@@ -828,7 +828,7 @@
announce(NULL, INFO_WAR, "The %s's have won the War!",
race_table[ch->race].name);
note_war(ch);
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (!IS_SET_WAR(wch))
continue;
@@ -852,7 +852,7 @@
announce(NULL, INFO_WAR, "The %s's have won the War!{x",
class_table[ch->Class[0]].name);
note_war(ch);
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (!IS_SET_WAR(wch))
continue;
@@ -875,7 +875,7 @@
announce(NULL, INFO_WAR, "%s has won the War!{x",
clan_table[ch->clan].who_name);
note_war(ch);
- for (wch = player_list; wch != NULL; wch = wch->next_player)
+ for (wch = player_first; wch != NULL; wch = wch->next_player)
{
if (!IS_SET_WAR(wch))
continue;
@@ -947,7 +947,7 @@
chprintf(ch, "{Y({RWarTalk{Y) {gYou drum: %s{x\n\r", argument);
- for (d = descriptor_list; d != NULL; d = d->next)
+ for (d = descriptor_first; d != NULL; d = d->next)
{
CHAR_DATA *victim;