[ScryMUD] SVN Commit Info r739 - branches/version-2-1/mud/grrmud/server
scrymud at wanfear.com
scrymud at wanfear.com
Tue Dec 7 00:58:10 PST 2004
Author: eroper
Date: 2004-12-07 00:58:09 -0800 (Tue, 07 Dec 2004)
New Revision: 739
Modified:
branches/version-2-1/mud/grrmud/server/gen_cmds.spec
branches/version-2-1/mud/grrmud/server/misc.cc
branches/version-2-1/mud/grrmud/server/misc.h
Log:
"verifydoors" now takes a zone number.
It will now list the following (potential) issues
* Rooms that have exits to room numbers that don't really exist.
* Rooms that exit to rooms with no way back.
* Rooms that exit to rooms with a non-reflexive way back.
A note to any builders reading this:
Just because "verifydoors" lists something doesn't mean it should be fixed.
There are in fact some very good reasons for one-way or weird-way doors. This
is being added as an auditing tool so we can find the mistakes, not break the
intentionally weird connections.
Note to self:
Find "abandoned" rooms, i.e. rooms that have no way in.
Find "jail" rooms with no way out.
--Khaav
Modified: branches/version-2-1/mud/grrmud/server/gen_cmds.spec
===================================================================
--- branches/version-2-1/mud/grrmud/server/gen_cmds.spec 2004-12-07 02:25:24 UTC (rev 738)
+++ branches/version-2-1/mud/grrmud/server/gen_cmds.spec 2004-12-07 08:58:09 UTC (rev 739)
@@ -954,7 +954,7 @@
return value_set(i, &(cooked_strs[1]), j, k, l, pc);
# IMM Commands - V
verifydoors ~
-return verifydoors(pc);
+return verifydoors(i, pc);
visible ~
return visible(pc);
Modified: branches/version-2-1/mud/grrmud/server/misc.cc
===================================================================
--- branches/version-2-1/mud/grrmud/server/misc.cc 2004-12-07 02:25:24 UTC (rev 738)
+++ branches/version-2-1/mud/grrmud/server/misc.cc 2004-12-07 08:58:09 UTC (rev 739)
@@ -3139,22 +3139,28 @@
return(&output);
}
-int verifydoors(critter &pc) {
+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()) ) {
+ 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] "
@@ -3163,9 +3169,9 @@
pc.show(buf);
continue;
}
- if ( !
- dr_ptr->findDoorByDest(dr_ptr->getDestRoom()->doors,
- cur_rm_num) ) {
+ 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",
@@ -3175,7 +3181,34 @@
&(rm_ptr->short_desc),
&(dr_ptr->getDestRoom()->short_desc));
pc.show(buf);
- }//if it isn't reflexive.
+ //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.
Modified: branches/version-2-1/mud/grrmud/server/misc.h
===================================================================
--- branches/version-2-1/mud/grrmud/server/misc.h 2004-12-07 02:25:24 UTC (rev 738)
+++ branches/version-2-1/mud/grrmud/server/misc.h 2004-12-07 08:58:09 UTC (rev 739)
@@ -187,7 +187,7 @@
void do_tick();
void do_mini_tick(); //every round of battle....
bool isNightTime();
-int verifydoors(critter &pc);
+int verifydoors(int i_th, critter &pc);
String *colorize(const char *input, critter &pc, hilite_type hl_type);
More information about the ScryMUD
mailing list