I think you're right - that patch seem to be missing something.
Code:
diff -uN src/db.c new-src/db.c
--- src/db.c Mon Jan 17 22:36:46 2000
+++ new-src/db.c Thu Jan 20 00:41:22 2000
@@ -1439,7 +1439,7 @@
void load_zones(FILE * fl, char *zonename)
{
static zone_rnum zone = 0;
- int cmd_no, num_of_cmds = 0, line_num = 0, tmp, error;
+ int cmd_no, num_of_cmds = 0, line_num = 0, tmp, error, arg_num;
char *ptr, buf[256], zname[256];
char t1[80], t2[80];
@@ -1506,9 +1506,13 @@
ZCMD.sarg2 = str_dup(t2);
}
} else {
- if (sscanf(ptr, " %d %d %d %d ", &tmp, &ZCMD.arg1, &ZCMD.arg2,
- &ZCMD.arg3) != 4)
- error = 1;
+ if ((arg_num = sscanf(ptr, " %d %d %d %d %d ", &tmp, &ZCMD.arg1, &ZCMD.arg2,
+ &ZCMD.arg3, &ZCMD.arg4)) != 5){
+ if (arg_num != 4)
+ error = 1;
+ else
+ ZCMD.arg4 = 0;
+ }
}
ZCMD.if_flag = tmp;
@@ -1832,47 +1836,61 @@
int room_vnum, room_rnum;
struct char_data *tmob=NULL; /* for trigger assignment */
struct obj_data *tobj=NULL; /* for trigger assignment */
+ int mob_load = FALSE; /* ### */
+ int obj_load = FALSE; /* ### */
+
for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) {
- if (ZCMD.if_flag && !last_cmd)
+ if (ZCMD.if_flag && !last_cmd && !mob_load && !obj_load)
continue;
+ if (!ZCMD.if_flag) { /* ### */
+ mob_load = FALSE;
+ obj_load = FALSE;
+ }
+
switch (ZCMD.command) {
case '*': /* ignore command */
last_cmd = 0;
break;
case 'M': /* read a mobile */
- if (mob_index[ZCMD.arg1].number < ZCMD.arg2) {
+ if ((mob_index[ZCMD.arg1].number < ZCMD.arg2) &&
+ (number(1, 100) >= ZCMD.arg4)) {
mob = read_mobile(ZCMD.arg1, REAL);
char_to_room(mob, ZCMD.arg3);
load_mtrigger(mob);
tmob = mob;
last_cmd = 1;
+ mob_load = TRUE;
} else
last_cmd = 0;
break;
case 'O': /* read an object */
- if (obj_index[ZCMD.arg1].number < ZCMD.arg2) {
+ if ((obj_index[ZCMD.arg1].number < ZCMD.arg2) &&
+ (number(1, 100) >= ZCMD.arg4)) {
if (ZCMD.arg3 >= 0) {
obj = read_object(ZCMD.arg1, REAL);
obj_to_room(obj, ZCMD.arg3);
load_otrigger(obj);
last_cmd = 1;
tobj = obj;
+ obj_load = TRUE;
} else {
obj = read_object(ZCMD.arg1, REAL);
obj->in_room = NOWHERE;
last_cmd = 1;
+ obj_load = TRUE;
}
} else
last_cmd = 0;
break;
case 'P': /* object to object */
- if (obj_index[ZCMD.arg1].number < ZCMD.arg2) {
+ if ((obj_index[ZCMD.arg1].number < ZCMD.arg2) &&
+ obj_load && (number(1, 100) >= ZCMD.arg4)) {
obj = read_object(ZCMD.arg1, REAL);
if (!(obj_to = get_obj_num(ZCMD.arg3))) {
ZONE_ERROR("target obj not found, command disabled");
@@ -1893,7 +1911,8 @@
ZCMD.command = '*';
break;
}
- if (obj_index[ZCMD.arg1].number < ZCMD.arg2) {
+ if ((obj_index[ZCMD.arg1].number < ZCMD.arg2) &&
+ mob_load && (number(1, 100) >= ZCMD.arg3)) {
obj = read_object(ZCMD.arg1, REAL);
load_otrigger(obj);
tobj = obj;
@@ -1909,7 +1928,8 @@
ZCMD.command = '*';
break;
}
- if (obj_index[ZCMD.arg1].number < ZCMD.arg2) {
+ if ((obj_index[ZCMD.arg1].number < ZCMD.arg2) &&
+ mob_load && (number(1, 100) >= ZCMD.arg4)) {
if (ZCMD.arg3 < 0 || ZCMD.arg3 >= NUM_WEARS) {
ZONE_ERROR("invalid equipment pos number");
} else {
diff -uN src/db.h new-src/db.h
--- src/db.h Fri Nov 26 23:02:54 1999
+++ new-src/db.h Thu Jan 20 00:36:16 2000
@@ -141,6 +141,7 @@
int arg1; /* */
int arg2; /* Arguments to the command */
int arg3; /* */
+ int arg4; /* percentages variable */
int line; /* line number this command appears on */
char *sarg1; /* string argument */
char *sarg2; /* string argument */
I can't guarantee it will work as good as the other patch did, but it might just work.