From 2703cbcf258e4658a9287799572f5c2e3310189b Mon Sep 17 00:00:00 2001 From: kinther Date: Thu, 25 Sep 2025 09:35:23 -0700 Subject: [PATCH] Add rsave command --- lib/world/rsv/1.rsv | 21 +++++++++++++++++++++ src/act.h | 1 + src/act.wizard.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/db.h | 1 + src/interpreter.c | 1 + 5 files changed, 64 insertions(+) diff --git a/lib/world/rsv/1.rsv b/lib/world/rsv/1.rsv index e69de29..913c037 100644 --- a/lib/world/rsv/1.rsv +++ b/lib/world/rsv/1.rsv @@ -0,0 +1,21 @@ +#R 100 1758817753 +. +#R 134 1758817885 +O 132 0 200 0 0 +X 0 0 +X 1 0 +X 2 0 +X 3 0 +W 0 0 +W 1 0 +W 2 0 +W 3 0 +V 0 8 +V 1 0 +V 2 0 +V 3 0 +V 4 0 +V 5 0 +V 6 0 +V 7 0 +. diff --git a/src/act.h b/src/act.h index 2f974ec..c3529ac 100644 --- a/src/act.h +++ b/src/act.h @@ -327,6 +327,7 @@ ACMD(do_recent); ACMD(do_restore); void return_to_char(struct char_data * ch); ACMD(do_return); +ACMD(do_rsave); ACMD(do_saveall); ACMD(do_send); ACMD(do_set); diff --git a/src/act.wizard.c b/src/act.wizard.c index 198ba88..20c5281 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -35,6 +35,7 @@ #include "quest.h" #include "ban.h" #include "screen.h" +#include "roomsave.h" /* local utility functions with file scope */ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg); @@ -5876,4 +5877,43 @@ ACMD(do_msave) } inv_free_all(&inv); +} + +ACMD(do_rsave) +{ + room_rnum rnum = IN_ROOM(ch); + + if (IS_NPC(ch)) { + send_to_char(ch, "Mobiles can’t use this.\r\n"); + return; + } + if (rnum == NOWHERE || rnum < 0 || rnum >= top_of_world) { + send_to_char(ch, "You are not in a valid room.\r\n"); + return; + } + + zone_rnum znum = world[rnum].zone; + if (znum < 0 || znum > top_of_zone_table) { + send_to_char(ch, "This room is not attached to a valid zone.\r\n"); + return; + } + + /* Builder permission: reuse your standard zone edit check */ + if (!can_edit_zone(ch, znum)) { + send_to_char(ch, "You don’t have permission to modify zone %d.\r\n", + zone_table[znum].number); + return; + } + + /* Save immediately, regardless of ROOM_SAVE flag */ + if (RoomSave_now(rnum)) { + send_to_char(ch, "rsave: room %d saved to roomsave file for zone %d.\r\n", + GET_ROOM_VNUM(rnum), zone_table[znum].number); + mudlog(CMP, GET_LEVEL(ch), TRUE, "RSAVE OK: %s saved room %d (zone %d).", + GET_NAME(ch), GET_ROOM_VNUM(rnum), zone_table[znum].number); + } else { + send_to_char(ch, "rsave: failed to save room %d.\r\n", GET_ROOM_VNUM(rnum)); + mudlog(BRF, GET_LEVEL(ch), TRUE, "RSAVE FAIL: %s room %d (zone %d).", + GET_NAME(ch), GET_ROOM_VNUM(rnum), zone_table[znum].number); + } } \ No newline at end of file diff --git a/src/db.h b/src/db.h index 05ea14d..7cb864f 100644 --- a/src/db.h +++ b/src/db.h @@ -257,6 +257,7 @@ void free_help_table(void); void free_player_index(void); void load_help(FILE *fl, char *name); void new_mobile_data(struct char_data *ch); +void equip_mob_from_loadout(struct char_data *mob); zone_rnum real_zone(zone_vnum vnum); room_rnum real_room(room_vnum vnum); diff --git a/src/interpreter.c b/src/interpreter.c index 92a788c..0234489 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -261,6 +261,7 @@ cpp_extern const struct command_info cmd_info[] = { { "rlist" , "rlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_RLIST }, { "rcopy" , "rcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_REDIT }, { "roomflags", "roomflags", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_SHOWVNUMS }, + { "rsave" , "rsave" , POS_DEAD , do_rsave , LVL_BUILDER, 0 }, { "say" , "s" , POS_RESTING , do_say , 0, 0 }, { "score" , "sc" , POS_DEAD , do_score , 0, 0 },