(See other message for info) #define ZCMD (zone_table[zone].cmd[cmd_no]) #define S_ROOM(i, num) (shop_index[i].in_room[(num)]) #define S_PRODUCT(i, num) (shop_index[i].producing[(num)]) #define S_KEEPER(i) (shop_index[i].keeper) ACMD(do_move_element) { char *arg = get_buffer(MAX_INPUT_LENGTH), *arg2 = get_buffer(MAX_INPUT_LENGTH); VNum orig, targ; RNum real_orig; SInt32 znum, znum2, i, n; UInt32 zone, cmd_no, room, dir; struct int_list *trig; two_arguments(argument, arg, arg2); if (!*arg || !*arg2) { switch (subcmd) { case SCMD_RMOVE: send_to_char("Usage: rmove <orig> <new>\r\n",ch); break; case SCMD_OMOVE: send_to_char("Usage: omove <orig> <new>\r\n",ch); break; case SCMD_MMOVE: send_to_char("Usage: mmove <orig> <new>\r\n",ch); break; case SCMD_TMOVE: send_to_char("Usage: tmove <orig> <new>\r\n",ch); break; default: send_to_char("Hm, reached default case on do_move_element.\r\n", ch); mudlogf(BRF, LVL_STAFF, TRUE, "SYSERR:: invalid SCMD passed to do_move_element! (SCMD = %d)", subcmd); } } else { orig = atoi(arg); targ = atoi(arg2); znum = real_zone(orig); znum2 = real_zone(targ); if ((znum == -1) || (znum2== -1)) { ch->send("Zone %d does not exist.\r\n", (znum == -1) ? (orig / 100) : (targ / 100)); } else if (get_zone_perms(ch, znum) && get_zone_perms(ch, znum2)) { switch (subcmd) { case SCMD_RMOVE: if ((real_orig = real_room(orig)) != NOWHERE) { if (real_room(targ) == NOWHERE) { world[real_orig].number = targ; ch->send("Room %d moved to %d.", orig, targ); olc_add_to_save_list(zone_table[znum].number, OLC_SAVE_ROOM); olc_add_to_save_list(zone_table[znum2].number, OLC_SAVE_ROOM); // First find all rooms linked to this, and mark them changed for (zone = 0; zone <= top_of_zone_table; zone++) for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) switch(ZCMD.command) { case 'M': case 'O': if (ZCMD.arg3 == real_orig) olc_add_to_save_list(zone_table[zone].number, OLC_SAVE_ZONE); break; case 'D': case 'R': if (ZCMD.arg1 == real_orig) olc_add_to_save_list(zone_table[zone].number, OLC_SAVE_ZONE); break; case 'T': if ((ZCMD.arg1 == WLD_TRIGGER) && (ZCMD.arg4 == real_orig)) olc_add_to_save_list(zone_table[zone].number, OLC_SAVE_ZONE); break; } for (room = 0; room <= top_of_world; room++) for (dir = 0; dir < NUM_OF_DIRS; dir++) if (EXITN(room, dir)) if (EXITN(room, dir)->to_room == real_orig) olc_add_to_save_list(zone_table[znum2].number, OLC_SAVE_ROOM); for (i = 0; i <= top_shop; i++) for (n = 0; S_ROOM(i, n) != -1; n++) if (S_ROOM(i, n) == real_orig) olc_add_to_save_list(zone_table[real_zone(SHOP_NUM(i))].number, OLC_SAVE_SHOP); } else send_to_char("You can't replace an existing room.", ch); } else send_to_char("No such room exists.", ch); break; case SCMD_OMOVE: if ((real_orig = real_object(orig)) != NOTHING) { if (real_object(targ) == NOTHING) { obj_index[real_orig].vnum = targ; ch->send("Obj %d moved to %d.", orig, targ); olc_add_to_save_list(zone_table[znum].number, OLC_SAVE_OBJ); olc_add_to_save_list(zone_table[znum2].number, OLC_SAVE_OBJ); // First find all rooms linked to this, and mark them changed for (zone = 0; zone <= top_of_zone_table; zone++) for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) switch(ZCMD.command) { case 'P': if (ZCMD.arg3 == real_orig) olc_add_to_save_list(zone_table[zone].number, OLC_SAVE_ZONE); break; case 'O': case 'G': case 'E': if (ZCMD.arg1 == real_orig) olc_add_to_save_list(zone_table[zone].number, OLC_SAVE_ZONE); break; case 'R': if (ZCMD.arg2 == real_orig) olc_add_to_save_list(zone_table[zone].number, OLC_SAVE_ZONE); break; default: continue; } for (i = 0; i <= top_shop; i++) for (n = 0; S_PRODUCT(i, n) != -1; n++) if (S_PRODUCT(i, n) == real_orig) olc_add_to_save_list(zone_table[real_zone(SHOP_NUM(i))].number, OLC_SAVE_SHOP); } else send_to_char("You can't replace an existing object.", ch); } else send_to_char("No such object exists.", ch); break; case SCMD_MMOVE: if ((real_orig = real_mobile(orig)) != NOBODY) { if (real_mobile(targ) == NOBODY) { mob_index[real_orig].vnum = targ; ch->send("Mob %d moved to %d.", orig, targ); olc_add_to_save_list(zone_table[znum].number, OLC_SAVE_MOB); olc_add_to_save_list(zone_table[znum2].number, OLC_SAVE_MOB); // First find all rooms linked to this, and mark them changed for (zone = 0; zone <= top_of_zone_table; zone++) for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) if ((ZCMD.command == 'M') && (ZCMD.arg1 == real_orig)) olc_add_to_save_list(zone_table[zone].number, OLC_SAVE_ZONE); for (i = 0; i <= top_shop; i++) if (S_KEEPER(i) == real_orig) olc_add_to_save_list(zone_table[real_zone(SHOP_NUM(i))].number, OLC_SAVE_SHOP); } else send_to_char("You can't replace an existing mobile.", ch); } else send_to_char("No such mobile exists.", ch); break; case SCMD_TMOVE: if ((real_orig = real_mobile(orig)) != NOBODY) { if (real_mobile(targ) == NOBODY) { trig_index[real_orig].vnum = targ; ch->send("Obj %d moved to %d.", orig, targ); olc_add_to_save_list(zone_table[znum].number, OLC_SAVE_TRIGGER); olc_add_to_save_list(zone_table[znum2].number, OLC_SAVE_TRIGGER); // First find all rooms linked to this, and mark them changed for (zone = 0; zone <= top_of_zone_table; zone++) for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++) if ((ZCMD.command == 'T') && (ZCMD.arg2 == real_orig)) olc_add_to_save_list(zone_table[zone].number, OLC_SAVE_ZONE); for (i = 0; i <= top_of_mobt; i++) for (trig = mob_index[i].triggers; trig; trig = trig->next) if (trig->i == orig) { trig->i = targ; olc_add_to_save_list(zone_table[real_zone(mob_index[i].vnum)].number, OLC_SAVE_MOB); } for (i = 0; i <= top_of_objt; i++) for (trig = obj_index[i].triggers; trig; trig = trig->next) if (trig->i == orig) { trig->i = targ; olc_add_to_save_list(zone_table[real_zone(obj_index[i].vnum)].number, OLC_SAVE_OBJ); } } else send_to_char("You can't replace an existing trigger.", ch); } else send_to_char("No such trigger exists.", ch); break; default: send_to_char("Hm, reached default case on do_move_element.\r\n", ch); mudlogf(BRF, LVL_STAFF, TRUE, "SYSERR:: invalid SCMD passed to do_move_element! (SCMD = %d)", subcmd); break; } } } release_buffer(arg); release_buffer(arg2); } +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST