[ScryMUD] SVN Commit Info r740 - in trunk/mud/grrmud: . server
scrymud at wanfear.com
scrymud at wanfear.com
Fri Dec 10 00:12:06 PST 2004
Author: eroper
Date: 2004-12-10 00:12:05 -0800 (Fri, 10 Dec 2004)
New Revision: 740
Modified:
trunk/mud/grrmud/opening
trunk/mud/grrmud/server/Makefile
trunk/mud/grrmud/server/ServerConfig.cc
trunk/mud/grrmud/server/ServerConfig.h
trunk/mud/grrmud/server/command2.cc
trunk/mud/grrmud/server/commands.cc
trunk/mud/grrmud/server/critter.h
trunk/mud/grrmud/server/door.h
trunk/mud/grrmud/server/ez_skll.cc
trunk/mud/grrmud/server/ez_skll.h
trunk/mud/grrmud/server/gen_cmds.spec
trunk/mud/grrmud/server/grrmud.cc
trunk/mud/grrmud/server/misc.cc
trunk/mud/grrmud/server/misc.h
trunk/mud/grrmud/server/object.h
trunk/mud/grrmud/server/room.h
trunk/mud/grrmud/server/script.cc
trunk/mud/grrmud/server/spec_prc.cc
trunk/mud/grrmud/server/vehicle.cc
Log:
Ported (merged) 717:739 from the version-2-1 branch.
--Khaav
Modified: trunk/mud/grrmud/opening
===================================================================
--- trunk/mud/grrmud/opening 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/opening 2004-12-10 08:12:05 UTC (rev 740)
@@ -20,11 +20,13 @@
Written with DikuMUD and its derivatives in mind.
- Head Builder: Shamu
- Coders: Justin Piper, Andrew Gibson, Ed Roper
- Builders: MiniShamu, Andrew Gibson, SFN, Pyrite,
- Jaeger
+ Head Builder: Jaeger
+ Builders: Andrew Gibson, MiniShamu, Pyrite, Shamu, StienFeastNine
+ Coders: Andrew Gibson, Ben Greear, Justin Piper, Ed Roper
+ Thanks To: Aasen, AngelBob, Cynder, Dagath, Gryphon, Eliud,
+ Jubal, Radick, Shade, Snoopy, Ron Yacketta
+
Web Page: http://scrymud.net/
Player Forums: http://scrymud.net/forums/
Email: lanfear at scrymud.net
Modified: trunk/mud/grrmud/server/Makefile
===================================================================
--- trunk/mud/grrmud/server/Makefile 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/Makefile 2004-12-10 08:12:05 UTC (rev 740)
@@ -115,6 +115,7 @@
clean:
rm -f *.o ${GEN_TARGS} BuildInfo.cc parse_gen.cc parse_gen.h
rm -f lang_strings.h lang_strings.cc
+ rm -f Subversion-Revision
${MAKE} -C ../../lib clean
purge: clean
Modified: trunk/mud/grrmud/server/ServerConfig.cc
===================================================================
--- trunk/mud/grrmud/server/ServerConfig.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/ServerConfig.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -2,6 +2,7 @@
ServerConfig::ServerConfig() {
port=4000;
+ hostname="all";
daemonize=0;
suid=0;
@@ -100,6 +101,9 @@
if (strcasecmp(key, "port") == 0) {
port = (int)strtol(val, NULL, 0);
}
+ else if (strcasecmp(key, "hostname") == 0) {
+ hostname=val;
+ }
else if (strcasecmp(key, "bootLoadModifier") == 0) {
bootLoadModifier = (int)strtol(val, NULL, 0);
}
Modified: trunk/mud/grrmud/server/ServerConfig.h
===================================================================
--- trunk/mud/grrmud/server/ServerConfig.h 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/ServerConfig.h 2004-12-10 08:12:05 UTC (rev 740)
@@ -24,6 +24,7 @@
// Network
int port;
+ String hostname;
// Percent Load Modifiers
int bootLoadModifier;
Modified: trunk/mud/grrmud/server/command2.cc
===================================================================
--- trunk/mud/grrmud/server/command2.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/command2.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -1906,231 +1906,133 @@
inv.head(cell);
int id_num;
int cnt = 0;
- while ((obj_ptr = cell.next())) {
-
- id_num = obj_ptr->getIdNum();
-
- if (!obj_ptr->in_list &&
- (item_counts[id_num] == -1)) { //already done it
- continue;
- }
-
- if (detect(pc.SEE_BIT, (obj_ptr->OBJ_VIS_BIT | ROOM.getVisBit()))) {
- if (crit_owner) {
- price = crit_owner->findItemSalePrice(*obj_ptr, pc);
- }
- else if (obj_owner) {
- price = obj_owner->getDefaultPrice();
- }
- else {
- return -1;
- }
-
- if (price < 0) {
- continue; //buf = " NOT FOR SALE NOW.";
- }//if
- // Build object restrictions string, this is retarded... should have
- // a method.
- restrict_buf = NULL_STRING;
- if (obj_ptr->OBJ_FLAGS.get(1))
- restrict_buf += "Anti-Evil ";
- if (obj_ptr->OBJ_FLAGS.get(2))
- restrict_buf += "Anti-Neutral ";
- if (obj_ptr->OBJ_FLAGS.get(3))
- restrict_buf += "Anti-Good ";
- if (obj_ptr->OBJ_FLAGS.get(4))
- restrict_buf += "Anti-Donate ";
- if (obj_ptr->OBJ_FLAGS.get(5))
- restrict_buf += "Anti-Drop ";
- if (obj_ptr->OBJ_FLAGS.get(6))
- restrict_buf += "Anti-Remove ";
- if (obj_ptr->OBJ_FLAGS.get(7))
- restrict_buf += "Anti-Mortal ";
- if (obj_ptr->OBJ_FLAGS.get(11))
- restrict_buf += "Anti-Warrior ";
- if (obj_ptr->OBJ_FLAGS.get(12))
- restrict_buf += "Anti-Sage ";
- if (obj_ptr->OBJ_FLAGS.get(13))
- restrict_buf += "Anti-Wizard ";
- if (obj_ptr->OBJ_FLAGS.get(14))
- restrict_buf += "Anti-Ranger ";
- if (obj_ptr->OBJ_FLAGS.get(15))
- restrict_buf += "Anti-Thief ";
- if (obj_ptr->OBJ_FLAGS.get(16))
- restrict_buf += "Anti-Alchemist ";
- if (obj_ptr->OBJ_FLAGS.get(17))
- restrict_buf += "Anti-Cleric ";
- if (obj_ptr->OBJ_FLAGS.get(18))
- restrict_buf += "Anti-Bard ";
- if (obj_ptr->OBJ_FLAGS.get(20))
- restrict_buf += "Anti-PC ";
- // End of object restrictions string building.
+ int done = 0;
- if (pc.shouldShowVnums()) {
- if (obj_ptr->in_list || (item_counts[id_num] == 1)) {
- Sprintf(buf, " [%i][%i]%P06 %S%P50%i %S", id_num,
- obj_ptr->getLevel(),
- &(obj_ptr->short_desc), price,
- &restrict_buf);
- }
- else {
- Sprintf(buf, " [%i][%i]%P06 [*%i]%P12 %S%P50%i %S", id_num,
- obj_ptr->getLevel(),
- item_counts[id_num], &(obj_ptr->short_desc), price,
- &restrict_buf);
- }
+ // This is to prevent code duplication, I debated just using goto :p
+ while ( done < 2) {
+ while ((obj_ptr = cell.next())) {
+
+ id_num = obj_ptr->getIdNum();
+
+ if (!obj_ptr->in_list &&
+ (item_counts[id_num] == -1)) { //already done it
+ continue;
}
- else {
- cnt++;
- int hack = cnt;
- if (hack == 1) {
- hack = -1;
+
+ if (detect(pc.SEE_BIT, (obj_ptr->OBJ_VIS_BIT | ROOM.getVisBit()))) {
+ if (crit_owner) {
+ price = crit_owner->findItemSalePrice(*obj_ptr, pc);
}
- if (obj_ptr->in_list || (item_counts[id_num] == 1)) {
- Sprintf(buf, " [%i][%i]%P12 %S%P50%i %S", hack,
- obj_ptr->getLevel(),
- &(obj_ptr->short_desc),
- price,
- &restrict_buf);
+ else if (obj_owner) {
+ price = obj_ptr->getDefaultPrice();
}
else {
- Sprintf(buf, " [%i][%i] [*%i]%P12 %S%P50%i %S", hack,
- obj_ptr->getLevel(),
- item_counts[id_num],
- &(obj_ptr->short_desc), price,
- &restrict_buf);
+ return -1;
}
- }
-
- item_counts[id_num] = -1;
-
- //if ((!obj_wear_by(*obj_ptr, pc, -1, FALSE)) &&
- // (!obj_ptr->isFood()))
- // buf.Prepend("**");
-
- if (obj_ptr->OBJ_VIS_BIT & 2) //if invisible
- buf.Append(" *\n");
- else
- buf.Append("\n");
- show(buf, pc);
- }//if detectable
- }//while
- perm_inv.head(cell);
- while ((obj_ptr = cell.next())) {
-
- id_num = obj_ptr->getIdNum();
-
- if (!obj_ptr->in_list &&
- (item_counts[id_num] == -1)) { //already done it
- continue;
- }
-
- if (detect(pc.SEE_BIT, (obj_ptr->OBJ_VIS_BIT | ROOM.getVisBit()))) {
- if (crit_owner) {
- price = crit_owner->findItemSalePrice(*obj_ptr, pc);
- }
- else if (obj_owner) {
- price = obj_owner->getDefaultPrice();
- }
- else {
- return -1;
- }
-
- if (price < 0) {
- continue; //buf = " NOT FOR SALE NOW.";
- }//if
-
- // Build object restrictions string, this is retarded... should have
- // a method.
- restrict_buf = NULL_STRING;
+ if (price < 0) {
+ continue; //buf = " NOT FOR SALE NOW.";
+ }//if
- if (obj_ptr->OBJ_FLAGS.get(1))
- restrict_buf += "Anti-Evil ";
- if (obj_ptr->OBJ_FLAGS.get(2))
- restrict_buf += "Anti-Neutral ";
- if (obj_ptr->OBJ_FLAGS.get(3))
- restrict_buf += "Anti-Good ";
- if (obj_ptr->OBJ_FLAGS.get(4))
- restrict_buf += "Anti-Donate ";
- if (obj_ptr->OBJ_FLAGS.get(5))
- restrict_buf += "Anti-Drop ";
- if (obj_ptr->OBJ_FLAGS.get(6))
- restrict_buf += "Anti-Remove ";
- if (obj_ptr->OBJ_FLAGS.get(7))
- restrict_buf += "Anti-Mortal ";
- if (obj_ptr->OBJ_FLAGS.get(11))
- restrict_buf += "Anti-Warrior ";
- if (obj_ptr->OBJ_FLAGS.get(12))
- restrict_buf += "Anti-Sage ";
- if (obj_ptr->OBJ_FLAGS.get(13))
- restrict_buf += "Anti-Wizard ";
- if (obj_ptr->OBJ_FLAGS.get(14))
- restrict_buf += "Anti-Ranger ";
- if (obj_ptr->OBJ_FLAGS.get(15))
- restrict_buf += "Anti-Thief ";
- if (obj_ptr->OBJ_FLAGS.get(16))
- restrict_buf += "Anti-Alchemist ";
- if (obj_ptr->OBJ_FLAGS.get(17))
- restrict_buf += "Anti-Cleric ";
- if (obj_ptr->OBJ_FLAGS.get(18))
- restrict_buf += "Anti-Bard ";
- if (obj_ptr->OBJ_FLAGS.get(20))
- restrict_buf += "Anti-PC ";
- // End of object restrictions string building.
-
- if (pc.shouldShowVnums()) {
- if (obj_ptr->in_list || (item_counts[id_num] == 1)) {
- Sprintf(buf, " [%i][%i]%P06 %S%P50%i %S", id_num,
- obj_ptr->getLevel(),
- &(obj_ptr->short_desc), price,
- &restrict_buf);
+ // Build object restrictions string, this is retarded... should have
+ // a method.
+ restrict_buf = NULL_STRING;
+
+ if (obj_ptr->OBJ_FLAGS.get(1))
+ restrict_buf += "Anti-Evil ";
+ if (obj_ptr->OBJ_FLAGS.get(2))
+ restrict_buf += "Anti-Neutral ";
+ if (obj_ptr->OBJ_FLAGS.get(3))
+ restrict_buf += "Anti-Good ";
+ if (obj_ptr->OBJ_FLAGS.get(4))
+ restrict_buf += "Anti-Donate ";
+ if (obj_ptr->OBJ_FLAGS.get(5))
+ restrict_buf += "Anti-Drop ";
+ if (obj_ptr->OBJ_FLAGS.get(6))
+ restrict_buf += "Anti-Remove ";
+ if (obj_ptr->OBJ_FLAGS.get(7))
+ restrict_buf += "Anti-Mortal ";
+ if (obj_ptr->OBJ_FLAGS.get(11))
+ restrict_buf += "Anti-Warrior ";
+ if (obj_ptr->OBJ_FLAGS.get(12))
+ restrict_buf += "Anti-Sage ";
+ if (obj_ptr->OBJ_FLAGS.get(13))
+ restrict_buf += "Anti-Wizard ";
+ if (obj_ptr->OBJ_FLAGS.get(14))
+ restrict_buf += "Anti-Ranger ";
+ if (obj_ptr->OBJ_FLAGS.get(15))
+ restrict_buf += "Anti-Thief ";
+ if (obj_ptr->OBJ_FLAGS.get(16))
+ restrict_buf += "Anti-Alchemist ";
+ if (obj_ptr->OBJ_FLAGS.get(17))
+ restrict_buf += "Anti-Cleric ";
+ if (obj_ptr->OBJ_FLAGS.get(18))
+ restrict_buf += "Anti-Bard ";
+ if (obj_ptr->OBJ_FLAGS.get(20))
+ restrict_buf += "Anti-PC ";
+ // End of object restrictions string building.
+
+ if (pc.shouldShowVnums()) {
+ if (obj_ptr->in_list || (item_counts[id_num] == 1)) {
+ Sprintf(buf, " [onum: %i][lvl: %i]%P06 %S%P50%i %S", id_num,
+ obj_ptr->getLevel(),
+ &(obj_ptr->short_desc), price,
+ &restrict_buf);
+ }
+ else {
+ Sprintf(buf, " [onum: %i][lvl: %i]%P06 [qty: %i]%P12 %S%P50%i %S", id_num,
+ obj_ptr->getLevel(),
+ item_counts[id_num], &(obj_ptr->short_desc), price,
+ &restrict_buf);
+ }
}
else {
- Sprintf(buf, " [%i][%i]%P06 [*%i]%P12 %S%P50%i %S", id_num,
- obj_ptr->getLevel(),
- item_counts[id_num], &(obj_ptr->short_desc), price,
- &restrict_buf);
+ cnt++;
+ int hack = cnt;
+
+ // if this isn't here you can't buy the first item by id. This
+ // is because the parser will set i_th to 1 if you just issue
+ // the "buy" command with no args. Unfortunately this means
+ // that we protect against these accidental purchases in buy()
+ if (hack == 1) {
+ hack = -1;
+ }
+
+ if (obj_ptr->in_list || (item_counts[id_num] == 1)) {
+ Sprintf(buf, " [%i][lvl: %i]%P12 %S%P50%i %S", hack,
+ obj_ptr->getLevel(),
+ &(obj_ptr->short_desc),
+ price,
+ &restrict_buf);
+ }
+ else {
+ Sprintf(buf, " [%i][lvl: %i] [qty: %i]%P12 %S%P50%i %S", hack,
+ obj_ptr->getLevel(),
+ item_counts[id_num],
+ &(obj_ptr->short_desc), price,
+ &restrict_buf);
+ }
}
- }
- else {
- cnt++;
- int hack = cnt;
- if (hack == 1) {
- hack = -1;
- }
- if (obj_ptr->in_list || (item_counts[id_num] == 1)) {
- Sprintf(buf, " [%i][%i]%P12 %S%P50%i %S", hack,
- obj_ptr->getLevel(),
- &(obj_ptr->short_desc),
- price,
- &restrict_buf);
- }
- else {
- Sprintf(buf, " [%i][%i] [*%i]%P12 %S%P50%i %S", hack,
- obj_ptr->getLevel(),
- item_counts[id_num],
- &(obj_ptr->short_desc), price,
- &restrict_buf);
- }
- }
-
- item_counts[id_num] = -1;
-
- //if ((!obj_wear_by(*obj_ptr, pc, -1, FALSE)) &&
- // (!obj_ptr->isFood()))
- // buf.Prepend("**");
-
- if (obj_ptr->OBJ_VIS_BIT & 2) //if invisible
- buf.Append(" *\n");
- else
- buf.Append("\n");
- show(buf, pc);
- }//if detectable
-
- }//while
+
+ item_counts[id_num] = -1;
+
+ //if ((!obj_wear_by(*obj_ptr, pc, -1, FALSE)) &&
+ // (!obj_ptr->isFood()))
+ // buf.Prepend("**");
+
+ if (obj_ptr->OBJ_VIS_BIT & 2) //if invisible
+ buf.Append(" *\n");
+ else
+ buf.Append("\n");
+ show(buf, pc);
+ }//if detectable
+ }//while
+ done++;
+ perm_inv.head(cell);
+ }//while (done < 2)
+
return 0;
}//do_list_merchandise
Modified: trunk/mud/grrmud/server/commands.cc
===================================================================
--- trunk/mud/grrmud/server/commands.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/commands.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -386,7 +386,7 @@
buf.Cap();
show(buf, pc);
- out_inv(obj_ptr->inv, pc, OBJ_INV);
+ out_inv(obj_ptr->inv, pc, OBJ_INV, obj_ptr->isBulletinBoard());
String cmd = "examine";
ROOM.checkForProc(cmd, NULL_STRING, pc, obj_ptr->OBJ_NUM);
@@ -2953,7 +2953,8 @@
}//if
}//while
- if (door_ptr->getTokenNum() != 0) {
+ if ( (door_ptr->getTokenNum() != 0) &&
+ (!room_list[pc.getCurRoomNum()].isVehicle()) ) {
object* token = NULL;
int posn = -1;
Modified: trunk/mud/grrmud/server/critter.h
===================================================================
--- trunk/mud/grrmud/server/critter.h 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/critter.h 2004-12-10 08:12:05 UTC (rev 740)
@@ -1028,7 +1028,7 @@
int isSleeping() const { return POS == POS_SLEEP; }
int isStunned() const { return POS == POS_STUN; }
int isMeditating() const { return POS == POS_MED; }
- int isPossessed() const { return (!possessed_by); }
+ int isPossessed() const { return (possessed_by > 0); }
int posnNonTalkative() const { return ((POS > POS_REST) && (POS != POS_PRONE)); }
int isEdible() const { return mob && MOB_FLAGS.get(5); }
Modified: trunk/mud/grrmud/server/door.h
===================================================================
--- trunk/mud/grrmud/server/door.h 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/door.h 2004-12-10 08:12:05 UTC (rev 740)
@@ -63,6 +63,8 @@
// 15 !complete 16 secret_when_open_too, 17 consume_key
// 18 !passdoor
+ int isOpenable() const { return(door_data_flags.get(8)); }
+ int isCloseable() const { return(isOpenable()); }
int isOpen() const { return !(door_data_flags.get(2)); }
int canClose() const { return canOpen(); }
int isVehicleExit() const { return door_data_flags.get(12); }
@@ -150,6 +152,7 @@
int consumesKey() const { return dr_data && dr_data->consumesKey(); }
int isNoPassdoor() const { return (dr_data && dr_data->isNoPassdoor()); }
int getIdNum() const { if (dr_data) return dr_data->getIdNum(); return 0; }
+ int getDestRnum() const { return destination; }
void lock() { if (dr_data) dr_data->lock(); }
void unlock() { if (dr_data) dr_data->unlock(); }
Modified: trunk/mud/grrmud/server/ez_skll.cc
===================================================================
--- trunk/mud/grrmud/server/ez_skll.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/ez_skll.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -280,15 +280,40 @@
Sprintf(buf, "You start guarding %S.\n", name_of_crit(vict, pc.SEE_BIT));
show(buf, pc);
- Sprintf(buf, "starts guarding %S.", name_of_crit(vict, ~0));
- emote(buf, pc, ROOM, TRUE, &vict);
Sprintf(buf, "%S starts guarding you. You feel much safer!!\n",
name_of_crit(pc, vict.SEE_BIT));
vict.show(buf);
return 0;
}//do_guard
+int unguard(critter& pc) {
+ String buf(100);
+ if ( !pc.temp_crit ) {
+ Sprintf(buf, "You aren't guarding anyone.\n");
+ pc.show(buf);
+ return -1;
+ }
+
+ if (!pc.GUARDING) {
+ Sprintf(buf, "You aren't guarding anyone.\n");
+ pc.show(buf);
+ return -1;
+ }
+
+ Sprintf(buf, "You stop guarding %S.\n", name_of_crit(*(pc.GUARDING), pc.SEE_BIT));
+ pc.show(buf);
+
+ Sprintf(buf, "%S stops guarding you.\n", name_of_crit(pc,
+ pc.GUARDING->SEE_BIT));
+ pc.GUARDING->show(buf);
+
+ pc.GUARDING->GUARDED_BY = NULL;
+ pc.GUARDING = NULL;
+
+ return 0;
+}//unguard
+
int picklock(int i_th, const String* vict, critter& pc) {
int skill_num = PICKLOCK_SKILL_NUM;
door* dr;
Modified: trunk/mud/grrmud/server/ez_skll.h
===================================================================
--- trunk/mud/grrmud/server/ez_skll.h 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/ez_skll.h 2004-12-10 08:12:05 UTC (rev 740)
@@ -39,6 +39,7 @@
int guard(int i_th, const String* vict, critter& pc);
int do_guard(critter& vict, critter& pc);
+int unguard(critter& pc);
int shield(int i_th, const String* vict, critter& pc, int was_ordered);
int do_shield(critter& vict, critter& pc);
int rescue(int i_th, const String* vict, critter& pc);
Modified: trunk/mud/grrmud/server/gen_cmds.spec
===================================================================
--- trunk/mud/grrmud/server/gen_cmds.spec 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/gen_cmds.spec 2004-12-10 08:12:05 UTC (rev 740)
@@ -324,8 +324,6 @@
return show_eq(pc);
examine ~
return examine(i, &(cooked_strs[1]), pc);
-exits ~
-return exit(pc);
eyebrow socials ~
eyebrow(j, &(cooked_strs[1]), pc, (*(pc.getCurRoom()))); return 0;
# IMM Commands - E
@@ -362,8 +360,11 @@
giggle(i, &(cooked_strs[1]), pc, (*(pc.getCurRoom()))); return 0;
give ~
return give(i, &(cooked_strs[1]), j, &(cooked_strs[2]), pc);
-go enter go ~
+go enter exit go ~
is_dead = FALSE; return go(i, &(cooked_strs[1]), pc, is_dead);
+# exits is here so that "exit" can be part of "go" (i.e. vehicles)
+exits ~
+return exit(pc);
goo socials ~
goo(i, &(cooked_strs[1]), pc, (*(pc.getCurRoom()))); return 0;
gossip *channels ~
@@ -393,7 +394,7 @@
return gag(i, &(cooked_strs[1]), pc);
gain_exp ~
return scr_gain_exp(i, pc, was_ordered);
-goto ~
+goto cd goto ~
return _goto(i, &(cooked_strs[1]), pc);
# Mortal Commands - H
@@ -916,6 +917,8 @@
return up(pc, *(pc.getCurRoom()), is_dead);
ungroup ~
return pc.doUngroup(i, &(cooked_strs[1]));
+unguard ~
+return unguard(pc);
unlock ~
return unlock(i, &(cooked_strs[1]), pc);
unwield remove ~
@@ -950,6 +953,8 @@
value_set ~
return value_set(i, &(cooked_strs[1]), j, k, l, pc);
# IMM Commands - V
+verifydoors ~
+return verifydoors(i, pc);
visible ~
return visible(pc);
@@ -1137,6 +1142,5 @@
# Help - Z
zones *zones ~
NOP
+~
-
-~
Modified: trunk/mud/grrmud/server/grrmud.cc
===================================================================
--- trunk/mud/grrmud/server/grrmud.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/grrmud.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -890,8 +890,13 @@
// Will try to pulse the entire MUD ever 20 seconds.
// We will pulse one-tenth at a time (room wise).
- if ((pulse % 10) == 0)
+ if ((pulse % 10) == 0) {
do_pulsed_spec_procs(First_Room, Last_Room);
+ }
+ if ((pulse % 63) == 0) {
+ do_regeneration_pcs();
+ do_regeneration_smobs();
+ }
if ((pulse % 379) == 0) {
do_tick(); //takes care of zones too
}
@@ -1369,7 +1374,7 @@
int init_socket(int port) {
int s;
- char *opt;
+ int so_reuseaddr_opt;
char hostname[MAX_HOSTNAME+1];
struct sockaddr_in sa;
struct hostent *hp;
@@ -1377,17 +1382,22 @@
mudlog.log(TRC, "in init_socket\n");
memset((char*)(&sa), 0, sizeof(struct sockaddr_in ));
- if (gethostname(hostname, MAX_HOSTNAME) < 0) {
- mudlog << "ERROR: gethostname: " << strerror(errno) << endl;
- //strcpy(hostname, "mogul");
- }//if
- hp = gethostbyname(hostname);
- if (hp == NULL) {
- mudlog << "ERROR: gethostbyname: " << strerror(errno) << endl;
- do_shutdown = TRUE;
- exit(100);
- }//if
- sa.sin_family = hp->h_addrtype;
+ if ( config.hostname == "all" ) {
+ sa.sin_addr.s_addr = htonl(INADDR_ANY);
+ sa.sin_family = AF_INET;
+ } else {
+ hp = gethostbyname(config.hostname);
+ if (hp == NULL) {
+ mudlog << "ERROR: gethostbyname: " << strerror(errno) << endl;
+ do_shutdown = TRUE;
+ exit(100);
+ } else {
+ memcpy((void *)&sa.sin_addr, (void *)hp->h_addr_list[0],
+ sizeof(sa.sin_addr));
+ sa.sin_family = hp->h_addrtype;
+ }
+ }
+
sa.sin_port = htons(port);
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
@@ -1396,7 +1406,9 @@
exit(100);
}//if
- if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof (opt))
+ so_reuseaddr_opt = 1;
+ if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (void *)&so_reuseaddr_opt,
+ sizeof(so_reuseaddr_opt))
< 0) {
mudlog << "ERROR: setsockopt: " << strerror(errno) << endl;
do_shutdown = TRUE;
Modified: trunk/mud/grrmud/server/misc.cc
===================================================================
--- trunk/mud/grrmud/server/misc.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/misc.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -337,8 +337,8 @@
decrease_timed_affecting_rooms(); //takes care of affected_rooms
/* do all incrementing */
- do_regeneration_pcs(); //takes care of all pc's
- do_regeneration_smobs(); //takes care of affected_mobs list
+ //do_regeneration_pcs(); //takes care of all pc's
+ //do_regeneration_smobs(); //takes care of affected_mobs list
do_regeneration_objects(); //takes care of affected_objects list
ZoneCollection::instance().doRegeneration(); //update mobs, objs, rooms if needed
@@ -467,6 +467,10 @@
}//do_mini_tick
+//The /6.0)+1.0) is because I'm having regen occur in about 1/6th the amount
+//of time that it used to. The +1.0 is just so we don't accidently have people
+//that never regen. I'll be watching the effects of this change closely and
+//will most likely adjust the algorithms based on what I discover.
void do_regeneration_pcs() {
float adj = 1.0, posn_mod, align_mod = 1.0;
Cell<critter*> crit_cell;
@@ -474,8 +478,14 @@
critter* crit_ptr;
//log("In do_regeneration_pcs\n");
-
+
while ((crit_ptr = crit_cell.next())) {
+
+ //no regen if we're fighting
+ if ( crit_ptr->isFighting() ) {
+ continue;
+ }
+
if ((crit_ptr->THIRST == 0) || (crit_ptr->HUNGER == 0)) {
adj = 0.2; // big penalty for being hungry
}
@@ -499,10 +509,10 @@
// if we are affected by remove hope we get no hp
if ( ! (is_affected_by(REMOVE_HOPE_SKILL_NUM, *crit_ptr)) ) {
- crit_ptr->HP += (int)((((float)(crit_ptr->CON) + 5.0) / 15.0) *
+ crit_ptr->HP += (int)((((((float)(crit_ptr->CON) + 5.0) / 15.0) *
(((float)(crit_ptr->HP_MAX)) / 9.0) *
posn_mod * (((float)(crit_ptr->HP_REGEN)) / 100.0)
- * adj + 10.0);
+ * adj + 10.0)/6.0)+1.0);
}
// if we are affected by remove karma we get no mana
@@ -516,12 +526,12 @@
align_mod = 1/pow(10, (breakeven+crit_ptr->ALIGN)/(1000-breakeven));
}
- crit_ptr->MANA += (int)(((((float)(crit_ptr->INT)) + 5.0) / 16.0) *
+ crit_ptr->MANA += (int)(((((((float)(crit_ptr->INT)) + 5.0) / 16.0) *
posn_mod *
(((float)(crit_ptr->MA_MAX)) / 7.0) *
(((float)(crit_ptr->MA_REGEN)) / 100.0) *
align_mod *
- adj + 4.0);
+ adj + 4.0)/6.0)+1.0);
}
/* Lose 5 mov points if you're idleing in deep water without a boat or
@@ -532,12 +542,11 @@
// player should die if mov hits 0
} else {
int tmp_mov;
+ tmp_mov = (int)(((((((float)(crit_ptr->DEX)) + 5.0) / 16.0) *
+ posn_mod * adj *
+ (((float)(crit_ptr->MV_MAX)) / 3.0) *
+ (((float)(crit_ptr->MV_REGEN)) / 100.0) + 3.0)/6.0)+1.0);
- tmp_mov = (int)(((((float)(crit_ptr->DEX)) + 5.0) / 16.0) *
- posn_mod * adj *
- (((float)(crit_ptr->MV_MAX)) / 3.0) *
- (((float)(crit_ptr->MV_REGEN)) / 100.0) + 3.0);
-
crit_ptr->MOV += tmp_mov;
}
@@ -549,8 +558,10 @@
// }
//}
- if (crit_ptr->HP > crit_ptr->HP_MAX)
+ if ( (crit_ptr->HP > crit_ptr->HP_MAX) &&
+ ( ! is_affected_by(ABSORB_BLOWS_SKILL_NUM, *crit_ptr) ) ) {
crit_ptr->HP = crit_ptr->HP_MAX;
+ }
if (crit_ptr->MANA > crit_ptr->MA_MAX)
crit_ptr->MANA = crit_ptr->MA_MAX;
if (crit_ptr->MOV > crit_ptr->MV_MAX)
@@ -589,27 +600,34 @@
//log("In do_regeneration_smobs\n");
while ((crit_ptr = crit_cell.next())) {
+
+ //no regen if we're fighting
+ if ( crit_ptr->isFighting() ) {
+ continue;
+ }
posn_mod = (2.0 + crit_ptr->POS) / 4.0;
-
+
// if we are affected by remove hope we get no hp
if ( ! (is_affected_by(REMOVE_HOPE_SKILL_NUM, *crit_ptr)) ) {
crit_ptr->HP +=
- (int)(((crit_ptr->CON + 5.0) / 15.0) *
+ (int)(((((crit_ptr->CON + 5.0) / 15.0) *
(crit_ptr->HP_MAX / 9.0) *
- posn_mod * (crit_ptr->HP_REGEN / 100.0) * adj + 10.0);
+ posn_mod * (crit_ptr->HP_REGEN / 100.0) * adj + 10.0)/6.0)+1.0);
}
// if we are affected by remove hope we get no mana
if ( ! (is_affected_by(REMOVE_KARMA_SKILL_NUM, *crit_ptr)) ) {
crit_ptr->MANA +=
- (int)(((crit_ptr->INT + 5.0) / 16.0) * posn_mod *
- (crit_ptr->MA_MAX / 7.0) * (crit_ptr->MA_REGEN / 100.0) * adj + 4.0);
+ (int)(((((crit_ptr->INT + 5.0) / 16.0) * posn_mod *
+ (crit_ptr->MA_MAX / 7.0) * (crit_ptr->MA_REGEN / 100.0) * adj +
+ 4.0)/6.0)+1.0);
}
crit_ptr->MOV +=
- (int)(((crit_ptr->DEX + 5.0) / 16.0) * posn_mod *
+ (int)(((((crit_ptr->DEX + 5.0) / 16.0) * posn_mod *
adj *
- (crit_ptr->MV_MAX / 2.0) * (crit_ptr->MV_REGEN / 100.0) + 5.0);
+ (crit_ptr->MV_MAX / 2.0) * (crit_ptr->MV_REGEN / 100.0) +
+ 5.0)/6.0)+1.0);
if (crit_ptr->HP > crit_ptr->HP_MAX)
crit_ptr->HP = crit_ptr->HP_MAX;
@@ -1107,6 +1125,45 @@
//log("About to check if need to load more inv into the room.\n");
room_ptr->getInv()->head(ocell);
while ((obj_ptr = ocell.next())) {
+
+ //make sure containers have their initial inventory reload if
+ //necessary.
+ if ( obj_ptr->isContainer() ) {
+ object* ig_room_object;
+ object* orig_object_inv;
+ Cell<object*> ig_room_inv_cell;
+ Cell<object*> orig_inv_cell;
+ int id_we_want = obj_ptr->getIdNum();
+ //don't update more than should load in room, otherwise players
+ //have the potential to mass item dupe/farm.
+ int max_to_update = obj_count(*(room_ptr->getInv()), *obj_ptr);
+
+ obj_ptr->inv.head(orig_inv_cell);
+ room_list[k].getInv()->head(ig_room_inv_cell);
+
+ //look at everything in this room.
+ while ( (ig_room_object = ig_room_inv_cell.next()) &&
+ (max_to_update--) ) {
+ //if we've found a match for the container
+ if ( ig_room_object->getIdNum() == id_we_want ) {
+ obj_ptr->inv.head(orig_inv_cell);
+ //walk the clean ones inventory
+ while ( ( orig_object_inv = orig_inv_cell.next() ) ) {
+ //do we need to add something to our in-game?
+ if ( (obj_count(obj_ptr->inv, *orig_object_inv) >
+ obj_count(ig_room_object->inv,
+ *orig_object_inv )) &&
+ ( orig_object_inv->getCurInGame() <
+ orig_object_inv->getMaxInGame()) ) {
+ ig_room_object->inv.append(orig_object_inv);
+ recursive_init_loads(
+ obj_list[orig_object_inv->getIdNum()], 0);
+ }
+ }
+ }//match
+ }
+ }//handle containers.
+
if ((obj_count(*(room_ptr->getInv()), *obj_ptr) >
obj_count(*(room_list[k].getInv()), *obj_ptr)) &&
(obj_ptr->getCurInGame()
@@ -2062,23 +2119,77 @@
-void out_inv(const List<object*>& lst, critter& pc,
- const short type_of_list) {
+void out_inv(List<object*>& lst, critter& pc,
+ const short type_of_list, int is_board) {
//outs the names object*
+
+ List<object*>* lst_ptr = NULL;
+ int lst_idx;
+
+ List<object*> reordered_lst(NULL);
Cell<object*> cell(lst);
+
+ List<object*> inv_weapons(NULL);
+ List<object*> inv_armor(NULL);
+ List<object*> inv_consumables(NULL);
+ List<object*> inv_containers(NULL);
+ List<object*> inv_potions(NULL);
+ List<object*> inv_scrolls(NULL);
+ List<object*> inv_wands(NULL);
+ List<object*> inv_ammunition(NULL);
+ List<object*> inv_skins(NULL);
+ List<object*> inv_misc(NULL);
+ List<object*> inv_lights(NULL);
+
+ //when doing obj/crit inventory, PCs walk these lists.
+ List<object*>* inv_lists[] = {
+ &inv_weapons,
+ &inv_armor,
+ &inv_consumables,
+ &inv_containers,
+ &inv_potions,
+ &inv_scrolls,
+ &inv_wands,
+ &inv_ammunition,
+ &inv_lights,
+ &inv_misc,
+ NULL
+ };
+
+ //when doing obj/crit inventory, MOBs walk these lists.
+ List<object*>* mob_inv_lists[] = {
+ &lst,
+ NULL
+ };
+
+ char *inv_names[] = {
+ "[ Weapons ]",
+ "[ Armor ]",
+ "[ Consumables ]",
+ "[ Containers ]",
+ "[ Potions ]",
+ "[ Scrolls ]",
+ "[ Wands ]",
+ "[ Ammunition ]",
+ "[ Lights ]",
+ "[ Misc. ]"
+ };
+
object* obj_ptr;
String buf(100);
+ String qty_str = "";//important to set this? so it's not undef (if mob)
+ static int item_counts[NUMBER_OF_ITEMS + 1];
+ int id_num;
+ // stack if it's a player or possesed mob. Never stack bulletin-board
+ // inventory.
+ int stack = ( ( (pc.isPc() ) || (pc.isPossessed() ) ) && (!is_board) );
+
mudlog.log(TRC, "In out_inv.\n");
if (pc.isUsingClient()) {
pc.show("<ITEM_LIST>");
}
- /* KHAAVREN DELETE ME MARKER
- else if (pc.isUsingColor()) {
- pc.show(*(pc.getObjListColor()));
- }
- */
if (IsEmpty(lst) && type_of_list == OBJ_INV) {
pc.show(" [empty] \n");
@@ -2086,30 +2197,102 @@
pc.show("</ITEM_LIST>");
}
- /* KHAAVREN DELETE ME MARKER
- else if (pc.isUsingColor()) {
- pc.show(*(pc.getDefaultColor()));
- }
- */
-
mudlog.log(DBG, "Done with out_inv (empty).\n");
return;
}//if
+
+ if ( stack ) {
+ //set the counts to zero, then update them all.
+ memset(item_counts, 0, sizeof(int) * (NUMBER_OF_ITEMS + 1));
+ while ( (obj_ptr = cell.next()) ) {
+ item_counts[obj_ptr->getIdNum()]++;
+
+ switch (type_of_list) {
+ case OBJ_INV:
+ case CRIT_INV:
+ if(obj_ptr->isWeapon()) {
+ inv_weapons.append(obj_ptr);
+ } else if (obj_ptr->isArmor()) {
+ inv_armor.append(obj_ptr);
+ } else if (obj_ptr->isPotion()) {
+ inv_potions.append(obj_ptr);
+ } else if (obj_ptr->isFood()) {
+ inv_consumables.append(obj_ptr);
+ } else if (obj_ptr->isContainer()) {
+ inv_containers.append(obj_ptr);
+ } else if (obj_ptr->isWand()) {
+ inv_wands.append(obj_ptr);
+ } else if (obj_ptr->isScroll()) {
+ inv_scrolls.append(obj_ptr);
+ } else if (obj_ptr->isAmmo()) {
+ inv_ammunition.append(obj_ptr);
+ } else if (obj_ptr->isLightSource()) {
+ inv_lights.append(obj_ptr);
+ } else {
+ inv_misc.append(obj_ptr);
+ }
+ }//switch
+
+ }//while
+
+ //if we're showing categories, we actually need to reorganize the real
+ //inventory so that get #.name works as players expect.
+ switch (type_of_list) {
+ case OBJ_INV:
+ case CRIT_INV:
+ lst_ptr = inv_lists[0];
+ lst_idx = 0;
+ while (lst_ptr) {
+ lst_ptr->head(cell);
+ while ( (obj_ptr = cell.next()) ) {
+ reordered_lst.append(obj_ptr);
+ }
+ lst_ptr = inv_lists[++lst_idx];
+ }
+ lst = reordered_lst;
+ }//switch
+
+ lst.head(cell);
+ }//if (stack)
+
switch (type_of_list)
{
case ROOM_INV:
while ((obj_ptr = cell.next())) {
if (detect(pc.SEE_BIT, obj_ptr->OBJ_VIS_BIT)) {
+
+ id_num = obj_ptr->getIdNum();
+
+ if ( stack ) {
+ if (//these objects should not stack.
+ (id_num == config.corpseObject) ||
+ (id_num == config.pcSkinObject) ||
+ (id_num == config.HeadObject)
+ ) {
+ qty_str = "";
+ } else {
+ if ( item_counts[id_num] == -1 ) {
+ //already done it.
+ continue;
+ } else if ( item_counts[id_num] > 1 ) {
+ Sprintf(qty_str, "(%i%s) ", item_counts[id_num], "x");
+ } else {
+ qty_str = "";
+ }
+ item_counts[id_num] = -1;
+ }//okay to stack
+ }
+
if (pc.shouldShowVnums()) {
char tmp[50];
sprintf(tmp, "%p: ", obj_ptr);
- Sprintf(buf, " %s [%i] %P11 %S", tmp, obj_ptr->OBJ_NUM,
- &(obj_ptr->in_room_desc));
+ Sprintf(buf, " %s [%i] %P11 %S%S", tmp, id_num,
+ &qty_str, &(obj_ptr->in_room_desc));
}
else {
- Sprintf(buf, "\t%S", &(obj_ptr->in_room_desc));
+ Sprintf(buf, "\t%S%S", &qty_str, &(obj_ptr->in_room_desc));
}
buf.Cap();
@@ -2138,43 +2321,89 @@
}//while
break;
case OBJ_INV: case CRIT_INV:
- while ((obj_ptr = cell.next())) {
- if (detect(pc.SEE_BIT, obj_ptr->OBJ_VIS_BIT)) {
- if (pc.shouldShowVnums()) {
- char tmp[50];
- sprintf(tmp, "%p: ", obj_ptr);
- Sprintf(buf, " %s [%i] %P11 %S", tmp, obj_ptr->OBJ_NUM,
- long_name_of_obj(*obj_ptr, ~0));
+
+ if ( stack ) {
+ lst_ptr = inv_lists[0];
+ } else {
+ lst_ptr = mob_inv_lists[0];
+ }
+ lst_idx = 0;
+
+ while ( lst_ptr ) {
+
+ lst_ptr->head(cell);
+
+ if ( stack ) {
+ if ( (obj_ptr = cell.next()) ) {
+ Sprintf(buf, "%s\n", inv_names[lst_idx]);
+ pc.show(buf, HL_OBJ_LIST);
+ obj_ptr = cell.prev();
}
- else {
- Sprintf(buf, "\t%S", long_name_of_obj(*obj_ptr, ~0));
- }
+ }
- buf.Cap();
+ while ((obj_ptr = cell.next())) {
+ if (detect(pc.SEE_BIT, obj_ptr->OBJ_VIS_BIT)) {
- if (obj_ptr->isHerb()) {
- if (d(1, 100) <=
- d(1, 2 * get_percent_lrnd(HERBALISM_SKILL_NUM, pc))) {
- buf.Append("(^Gherb^0)");
+ id_num = obj_ptr->getIdNum();
+
+ if ( stack ) {
+ if (//these objects should not stack.
+ (id_num == config.corpseObject) ||
+ (id_num == config.pcSkinObject) ||
+ (id_num == config.HeadObject)
+ ) {
+ qty_str = "";
+ } else {
+ if ( item_counts[id_num] == -1 ) {
+ //already done it.
+ continue;
+ } else if ( item_counts[id_num] > 1 ) {
+ Sprintf(qty_str, "(%i%s) ", item_counts[id_num], "x");
+ } else {
+ qty_str = "";
+ }
+ item_counts[id_num] = -1;
+ }//okay to stack
+ }
+
+ if (pc.shouldShowVnums()) {
+ char tmp[50];
+ sprintf(tmp, "%p: ", obj_ptr);
+ Sprintf(buf, " %s [%i] %P11 %S%S", tmp, id_num,
+ &qty_str, long_name_of_obj(*obj_ptr, ~0));
+ }
+ else {
+ Sprintf(buf, "\t%S%S", &qty_str,
+ long_name_of_obj(*obj_ptr, ~0));
+ }
+
+ buf.Cap();
+
+ if (obj_ptr->isHerb()) {
+ if (d(1, 100) <=
+ d(1, 2 * get_percent_lrnd(HERBALISM_SKILL_NUM, pc))) {
+ buf.Append("(^Gherb^0)");
+ }//if
}//if
- }//if
- if (pc.canDetectMagic() &&
- (!IsEmpty(obj_ptr->affected_by) ||
- !IsEmpty(obj_ptr->stat_affects))) {
+ if (pc.canDetectMagic() &&
+ (!IsEmpty(obj_ptr->affected_by) ||
+ !IsEmpty(obj_ptr->stat_affects))) {
buf.Append("^B{Blue Glow}^0\n");
-
-
+
+
+ }//if
+ else {
+ buf.Append("\n");
+ }
+ if (obj_ptr->OBJ_VIS_BIT & 2) {
+ buf.Prepend("*");
+ }//if
+ pc.show(buf, HL_OBJ_LIST);
}//if
- else {
- buf.Append("\n");
- }
- if (obj_ptr->OBJ_VIS_BIT & 2) {
- buf.Prepend("*");
- }//if
- pc.show(buf, HL_OBJ_LIST);
- }//if
- }//while
+ }//while
+ lst_ptr = inv_lists[++lst_idx];
+ }// while lst_ptr
break;
default:
mudlog.log(ERROR, "ERROR: default called in out_inv.\n");
@@ -2184,11 +2413,6 @@
if (pc.isUsingClient()) {
pc.show("</ITEM_LIST>");
}
- /* KHAAVREN DELETE ME MARKER
- else if (pc.isUsingColor()) {
- pc.show(*(pc.getDefaultColor()));
- }
- */
mudlog.log(DBG, "Done with out_inv.\n");
@@ -2935,3 +3159,79 @@
}
return(&output);
}
+
+int verifydoors(int i_th, critter &pc) {
+ Cell<door*> dcell;
+ room* rm_ptr;
+ door* dr_ptr;
+ door* dst_dr_ptr;
+ int cur_rm_num;
+ int chk_rm_num;
+ String buf;
+ int i;
+ int dir_okay = 0;
+ String *dr_dir;
+ String *dst_dir;
+
+ for(i=0;i<NUMBER_OF_ROOMS;i++) {
+ rm_ptr = &room_list[i];
+ if ( (rm_ptr) && (rm_ptr->isUsed()) &&
+ (rm_ptr->getZoneNum() == i_th) ) {
+ cur_rm_num = abs(rm_ptr->getRoomNum());
+ rm_ptr->doors.head(dcell);
+ while ( (dr_ptr = dcell.next()) ) {
+ chk_rm_num = abs(dr_ptr->getDestRnum());
+ dir_okay = false;
+ if (! dr_ptr->getDestRoom()) {
+ Sprintf(buf,
+ "^c[^B%d^c:^B%d^c] ^N-^w-> ^c[^B%d^c] "
+ "^R** which is not in use.^0\n",
+ rm_ptr->getZoneNum(), cur_rm_num, chk_rm_num);
+ pc.show(buf);
+ continue;
+ }
+ if ( ! (dst_dr_ptr =
+ dr_ptr->findDoorByDest(dr_ptr->getDestRoom()->doors,
+ cur_rm_num)) ) {
+ Sprintf(buf, "^c[^B%d^c:^B%d^c] ^N-^w-> ^c[^B%d^c:^B%d^c] "
+ "^r!--> ^c[^B%d^c:^B%d^c]^0\n"
+ "^cLHS: ^C%S ^cRHS: ^C%S\n\n^0",
+ rm_ptr->getZoneNum(), cur_rm_num,
+ dr_ptr->getDestRoom()->getZoneNum(), chk_rm_num,
+ rm_ptr->getZoneNum(), cur_rm_num,
+ &(rm_ptr->short_desc),
+ &(dr_ptr->getDestRoom()->short_desc));
+ pc.show(buf);
+ //if it isn't reflexive in any direction.
+ } else {
+ //if it does have a way back, make sure it's the opposite
+ //direction.
+ dr_dir = dr_ptr->getDirection();
+ dst_dir = dst_dr_ptr->getDirection();
+
+ if ( strncasecmp((const char*)(*dr_dir),
+ get_opposite_dir((const char*)(*dst_dir)),
+ strlen((const char*)(*dr_dir))) == 0 ) {
+ dir_okay = true;
+ }
+
+ if ( ! dir_okay ) {
+ Sprintf(buf, "^c[^B%d^c:^B%d^c:^B%S^c] ^w<--> "
+ "^c[^B%d^c:^B%d^c:^B%S^c] "
+ "^GDirection mismatch.\n"
+ "^cLHS: ^C%S ^cRHS: ^C%S\n\n^0",
+ rm_ptr->getZoneNum(), cur_rm_num,
+ dr_dir,
+ dr_ptr->getDestRoom()->getZoneNum(), chk_rm_num,
+ dst_dir,
+ &(rm_ptr->short_desc),
+ &(dr_ptr->getDestRoom()->short_desc));
+ pc.show(buf);
+
+ }
+ }//doors go opposite directions.
+ }//while there are more doors.
+ }//if it's a valid room.
+ }//while there are more rooms.
+ return(0);
+}//verifydoors()
Modified: trunk/mud/grrmud/server/misc.h
===================================================================
--- trunk/mud/grrmud/server/misc.h 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/misc.h 2004-12-10 08:12:05 UTC (rev 740)
@@ -110,7 +110,8 @@
void out_str(const List<String*>& lst, critter& pc);
void out_crit(const List<critter*>& lst, critter& pc, int see_all = FALSE);
-void out_inv(const List<object*>& lst, critter& pc, const short l_type);
+void out_inv(List<object*>& lst, critter& pc, const short l_type, const
+ int is_board = false);
//outs the names object*, formats according to l_type
@@ -186,6 +187,7 @@
void do_tick();
void do_mini_tick(); //every round of battle....
bool isNightTime();
+int verifydoors(int i_th, critter &pc);
String *colorize(const char *input, critter &pc, hilite_type hl_type);
Modified: trunk/mud/grrmud/server/object.h
===================================================================
--- trunk/mud/grrmud/server/object.h 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/object.h 2004-12-10 08:12:05 UTC (rev 740)
@@ -280,12 +280,22 @@
int isCoins() const { return OBJ_FLAGS.get(55); }
int isNoDonate() const { return OBJ_FLAGS.get(4); }
int isHerb() const;
+ int isVendingMachine() const { return obj_flags.get(73); }
int isPaused() const { return pause > 0; }
int isModified() const { return (in_list && 1); } //ie is it a SOBJ
int hasScript() const { return obj_flags.get(76); }
int isLiquid() const;
int isCanteen() const;
+ int isContainer() const { return obj_flags.get(54); }
int isTwoHanded() const;
+ int isWeapon() const { return (obj_flags.get(57) && (! obj_flags.get(40))); }
+ int isNotWeapon() const { return (!isWeapon()); }
+ int isWand() const { return obj_flags.get(51); }
+ int isArmor() const { return obj_flags.get(56); }
+ int isDart() const { return obj_flags.get(48); }
+ int isArrow() const { return obj_flags.get(49); }
+ int isAmmo() const { return ( isArrow() || isDart() ); }
+
int isBoat() const { return OBJ_FLAGS.get(62); }
int isContainer() const { return obj_flags.get(54); }
int needsResetting() const { return obj_flags.get(70); }
Modified: trunk/mud/grrmud/server/room.h
===================================================================
--- trunk/mud/grrmud/server/room.h 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/room.h 2004-12-10 08:12:05 UTC (rev 740)
@@ -167,6 +167,7 @@
void setNotComplete() { room_flags.turn_on(31); }
+ int isUsed() const { return room_flags.get(23); }
int isNotComplete() const { return room_flags.get(31); }
int canCamp() const { return room_flags.get(30); }
int canSeeSky();
Modified: trunk/mud/grrmud/server/script.cc
===================================================================
--- trunk/mud/grrmud/server/script.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/script.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -1169,6 +1169,7 @@
int MobScript::_cnt = 0;
int MobScript::parseScriptCommand(ScriptCmd& cmd, critter& owner, int& obj_was_deleted) {
+ int result;
// Look at first command and see if it has non-standard actors.
obj_was_deleted = FALSE;
critter* script_actor = NULL;
@@ -1215,7 +1216,11 @@
}//if
targ = cmd.getCommand(); //reuse targ, it should contain the command now.
- return script_actor->processInput(targ, FALSE, TRUE, &owner, NULL);
+ result = script_actor->processInput(targ, FALSE, TRUE, &owner, NULL);
+ if (script_actor->pc && script_actor != &owner) {
+ script_actor->setDoPrompt(TRUE);
+ }
+ return result;
}//parseScriptCommand
Modified: trunk/mud/grrmud/server/spec_prc.cc
===================================================================
--- trunk/mud/grrmud/server/spec_prc.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/spec_prc.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -1111,7 +1111,7 @@
mudlog.log(ERROR, "ERROR: keeper has no proc_data in do_buy_proc.\n");
return -1;
}//else
- }//if
+ }//if (keeper.mob)
else {
mudlog.log(ERROR, "ERROR: keeper's mob is NULL in do_buy_proc.\n");
return -1;
@@ -1167,60 +1167,38 @@
keeper.inv.head(cell);
int id_num;
int cnt = 0;
- while ((tmp_optr = cell.next())) {
-
- id_num = tmp_optr->getIdNum();
-
- if (!tmp_optr->in_list &&
- (item_counts[id_num] == -1)) { //already done it
- continue;
- }
-
- if (detect(pc.SEE_BIT, (tmp_optr->OBJ_VIS_BIT | ROOM.getVisBit()))) {
- price = keeper.findItemSalePrice(*tmp_optr, pc);
-
- if (price < 0) {
- continue; //buf = " NOT FOR SALE NOW.";
- }//if
-
- cnt++;
- if (i_th == cnt) {
- obj_ptr = tmp_optr;
- break;
- }
+ int done = 0;
+ // This is to prevent code duplication, I debated just using goto :p
+ while ( done < 2 ) {
+ while ((tmp_optr = cell.next())) {
- item_counts[id_num] = -1;
- }//if detectable
- }//while
+ id_num = tmp_optr->getIdNum();
- keeper.PERM_INV.head(cell);
- while ((tmp_optr = cell.next())) {
-
- id_num = tmp_optr->getIdNum();
-
- if (!tmp_optr->in_list &&
- (item_counts[id_num] == -1)) { //already done it
- continue;
- }
-
- if (detect(pc.SEE_BIT, (tmp_optr->OBJ_VIS_BIT | ROOM.getVisBit()))) {
- price = keeper.findItemSalePrice(*tmp_optr, pc);
-
- if (price < 0) {
- continue; //buf = " NOT FOR SALE NOW.";
- }//if
-
- cnt++;
- if (i_th == cnt) {
- obj_ptr = tmp_optr;
- break;
+ if (!tmp_optr->in_list &&
+ (item_counts[id_num] == -1)) { //already done it
+ continue;
}
- item_counts[id_num] = -1;
-
- }//if detectable
+ if (detect(pc.SEE_BIT, (tmp_optr->OBJ_VIS_BIT | ROOM.getVisBit()))) {
+ price = keeper.findItemSalePrice(*tmp_optr, pc);
- }//while
+ if (price < 0) {
+ continue; //buf = " NOT FOR SALE NOW.";
+ }//if
+
+ cnt++;
+ if (i_th == cnt) {
+ obj_ptr = tmp_optr;
+ break;
+ }
+
+ item_counts[id_num] = -1;
+ }//if detectable
+ }//while
+ done++;
+ keeper.PERM_INV.head(cell);
+ }//while (done<2)
+
}//else, tried to get it by index only.
if (!obj_ptr) {
@@ -1300,7 +1278,44 @@
return -1;
}//if
- obj_ptr = have_obj_named(vendor.inv, i_th, item, pc.SEE_BIT, ROOM);
+ if (! (obj_ptr = have_obj_named(vendor.inv, i_th, item, pc.SEE_BIT, ROOM)) ) {
+ //maybe they are trying to purchase by inventory index id?
+ Cell<object*> cell(vendor.inv);
+ object* tmp_ptr = NULL;
+ static int item_counts[NUMBER_OF_ITEMS + 1];
+ int cnt;
+ int id_num;
+ cnt = id_num = 0;
+
+ memset(item_counts, 0, sizeof(int) * (NUMBER_OF_ITEMS + 1));
+
+ vendor.inv.head(cell);
+ while ( (tmp_ptr = cell.next()) ) {
+ item_counts[tmp_ptr->getIdNum()]++;
+ }
+
+ vendor.inv.head(cell);
+ while ( (tmp_ptr = cell.next()) ) {
+ id_num = tmp_ptr->getIdNum();
+
+ //already done it
+ if (!tmp_ptr->in_list && (item_counts[id_num] == -1)) {
+ continue;
+ }
+
+ if (detect(pc.SEE_BIT, (tmp_ptr->OBJ_VIS_BIT | ROOM.getVisBit()))) {
+
+ cnt++;
+ if (i_th == cnt) {
+ obj_ptr = tmp_ptr;
+ break;
+ }
+
+ item_counts[id_num] = -1;
+ }//if detectable
+ }//while
+ }//if we had to dig via index numbers...
+
if (!obj_ptr) {
Sprintf(buf, "%S doesn't dispense that.\n",
long_name_of_obj(vendor, pc.SEE_BIT));
Modified: trunk/mud/grrmud/server/vehicle.cc
===================================================================
--- trunk/mud/grrmud/server/vehicle.cc 2004-12-07 08:58:09 UTC (rev 739)
+++ trunk/mud/grrmud/server/vehicle.cc 2004-12-10 08:12:05 UTC (rev 740)
@@ -129,6 +129,7 @@
int vehicle::move(int see_bit, int i_th, const String& exit_direction) {
int dest;
+ int i_th_incr = 0;
String buf(200);
if (mudlog.ofLevel(DBG)) {
@@ -145,6 +146,20 @@
//log("Got exit_dr_ptr.\n");
+ //if our vehicle creates a south in room and then tries to go south we end
+ //up self-containing. Now of course one can set i_th in the path, but then
+ //again, this gets ridiculously annoying on very long paths. It's also
+ //highly prone to human error. In the event that we attempt to
+ //self-contain, walk through all the doors (increasingly from i_th as
+ //passed) until we (hopefully) find one that isn't us. In the event that we
+ //fail to locate one, things should work as they did before (see below).
+ //Please note that we only attempt doors in the direction requested.
+ while ( exit_dr_ptr && ( abs(exit_dr_ptr->destination) == getRoomNum() ) ) {
+ exit_dr_ptr = door::findDoor(room_list[in_room].DOORS, i_th+i_th_incr,
+ &exit_direction, see_bit, room_list[in_room].getVisBit());
+ i_th_incr++;
+ }
+
if (!exit_dr_ptr) {
mudlog.log(WRN, "WARNING: destination dr_ptr is NULL in move_room.\n");
Sprintf(buf, "Your vehicle cannot go %S.\n", &exit_direction);
@@ -223,7 +238,7 @@
if (!isStealthy()) { //if not stealth
if (isAtDestination() &&
tmp_ptr->dr_data->isOpen() &&
- tmp_ptr->dr_data->canClose()) {
+ tmp_ptr->dr_data->isCloseable()) {
if (dr_ptr) {
Sprintf(buf, "The %S closes.\n", name_of_door(*dr_ptr, ~0));
showAllCept(buf);
@@ -291,8 +306,30 @@
}
}//while
+ buf = getPassengerMessage();
+ if (buf.Strlen() > 0) {
+ showAllCept(buf);
+ }//if
+
+ if (vehicle_flags.get(7)) { //if can see out
+ critter* cptr;
+ Cell<critter*> ccll(CRITTERS);
+
+ while ((cptr = ccll.next())) {
+ do_look(1, &NULL_STRING, *cptr, room_list[in_room],
+ TRUE); /* ignore brief */
+ }//while
+ }//if can see out
+
if (isAtDestination()) { //in other words, the one its in NOW
- if (!isStealthy() && tmp_ptr->dr_data->isClosed()) {
+
+ //Eventually I'd like this configurable on the vehicle itself. If it's
+ //not here and we have a relatively fast vehicle it's close to
+ //impossible to catch it with the door open.
+ ticks_till_next_stop += 15;
+
+ if (!isStealthy() && tmp_ptr->dr_data->isClosed() &&
+ tmp_ptr->dr_data->isOpenable() ) {
if (dr_ptr) {
Sprintf(buf, "The %S opens.\n", name_of_door(*dr_ptr, ~0));
showAllCept(buf);
@@ -313,21 +350,6 @@
tmp_ptr->dr_data->open(); //make it open
}//if
- buf = getPassengerMessage();
- if (buf.Strlen() > 0) {
- showAllCept(buf);
- }//if
-
- if (vehicle_flags.get(7)) { //if can see out
- critter* cptr;
- Cell<critter*> ccll(CRITTERS);
-
- while ((cptr = ccll.next())) {
- do_look(1, &NULL_STRING, *cptr, room_list[in_room],
- TRUE); /* ignore brief */
- }//while
- }//if can see out
-
return TRUE;
}//move
More information about the ScryMUD
mailing list