diff options
| author | historia <[not public]> | 2026-09-18 16:13:49 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 16:13:49 -0400 |
| commit | 194164a77eb4f2479b94c19e6f0e1278ab608781 (patch) | |
| tree | 53413add8ed6f32a34d1733397e380cc98ef70ef /internal/game/cmd_room_mob.go | |
| parent | 67e01aab85607b9e601185c7d62dff576af3bb43 (diff) | |
| download | thehouseoficarus-194164a77eb4f2479b94c19e6f0e1278ab608781.tar.gz | |
fix: more casino, economy, gameplay, security, and world data hardening gaps
Diffstat (limited to 'internal/game/cmd_room_mob.go')
| -rw-r--r-- | internal/game/cmd_room_mob.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/game/cmd_room_mob.go b/internal/game/cmd_room_mob.go index ced170f..ce729d4 100644 --- a/internal/game/cmd_room_mob.go +++ b/internal/game/cmd_room_mob.go @@ -2,7 +2,6 @@ package game import ( "fmt" - "os" "gopkg.in/yaml.v3" "thehouseoficarus/internal/net" @@ -44,7 +43,10 @@ func (g *Game) roomAddMob(sess *net.Session, args []string) { path, _ := g.World.GetRoomPath(p.RoomID) data, _ := yaml.Marshal(room) - os.WriteFile(path, data, 0644) + if err := writeRoomFile(path, data); err != nil { + sess.WriteLine(fmt.Sprintf("Error saving room: %v", err)) + return + } sess.WriteLine(fmt.Sprintf("Added mob '%s' to room.", mobID)) } @@ -77,6 +79,9 @@ func (g *Game) roomRemMob(sess *net.Session, args []string) { path, _ := g.World.GetRoomPath(p.RoomID) data, _ := yaml.Marshal(room) - os.WriteFile(path, data, 0644) + if err := writeRoomFile(path, data); err != nil { + sess.WriteLine(fmt.Sprintf("Error saving room: %v", err)) + return + } sess.WriteLine(fmt.Sprintf("Removed mob '%s' from room.", mobID)) } |
