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_object.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_object.go')
| -rw-r--r-- | internal/game/cmd_room_object.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/internal/game/cmd_room_object.go b/internal/game/cmd_room_object.go index 713a8f3..38b828a 100644 --- a/internal/game/cmd_room_object.go +++ b/internal/game/cmd_room_object.go @@ -2,7 +2,6 @@ package game import ( "fmt" - "os" "strings" "gopkg.in/yaml.v3" @@ -118,7 +117,10 @@ func (g *Game) roomAddLocalObj(sess *net.Session, name string, aliases []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 local object '%s' to room.", name)) } @@ -153,7 +155,10 @@ func (g *Game) roomRemLocalObj(sess *net.Session, name 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 local object '%s' from room.", name)) } @@ -217,7 +222,10 @@ func (g *Game) roomToggleHidden(sess *net.Session, input string, hidden bool) { 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 + } action := "Hidden" if !hidden { |
