Commit graph

2 commits

Author SHA1 Message Date
Kelsi
630c8bce29 fix(quality): real auto-save bug + clear all compiler warnings
The compiler-warning sweep surfaced one real behavioral bug and a
handful of cosmetic noise:

REAL BUG — editor_app.cpp:1069 misleading-indentation:

    if (objectPlacer_.objectCount() > 0 || npcSpawner_.spawnCount() > 0)
        objectsDirty_ = true; autoSavePendingChanges_ = true;

The trailing `autoSavePendingChanges_ = true;` was OUTSIDE the if, so
the auto-save flag was set unconditionally on every reload — meaning
zones with zero objects/NPCs were getting needlessly auto-saved. Wrap
both writes in braces so they share the guard.

Cosmetic / noise — also fixed so the warning channel stays useful:

- cli_mesh_io.cpp:193,194,333 — same misleading-indentation pattern
  (`if (a) x; if (b) y;` chained on one line). Replaced with std::clamp.
- cli_for_each.cpp:26,114,116 — `\\` at end of `//` comment was
  treated as line-continuation, silently extending the comment to the
  next line. Replaced the trailing-backslash convention with literal
  "(continued)" markers in the example shell command.
- world_map/input_handler.cpp:14 — unused `cosmicEnabled` parameter
  marked [[maybe_unused]].
- wowee_player_spawn_profiles.cpp:75 — unused CLS_PALADIN constant
  marked [[maybe_unused]] (kept to document the bit layout).
- wowee_crafting_recipes.cpp — three unused `using R = …` aliases
  removed.
- cli_data_tree.cpp:609, cli_format_validate.cpp:950 — unused argc
  parameters marked [[maybe_unused]] in handlers I touched recently.

CMakeLists.txt: editor's CLI handlers all share `(int& i, int argc,
char** argv)` so they can plug into a function-pointer table; many
handlers don't reference argc. Added -Wno-unused-parameter to the
editor target rather than littering 30+ handler signatures with
[[maybe_unused]] noise. Main wowee target keeps the warning enabled.

Result: clean build with -Wall -Wextra -Wpedantic, zero warnings in
our code (the remaining ones are all in extern/ third-party headers).
2026-05-13 20:05:52 -07:00
Kelsi
02564171b5 refactor(editor): extract for-each batch runners into cli_for_each.cpp
Moves the two batch-runner handlers (--for-each-zone,
--for-each-tile) out of main.cpp into a new
cli_for_each.{hpp,cpp} module. Both substitute `{}` with the
iterated path (find -exec convention) and shell-escape every
token before passing to std::system. Exit code is the failure
count, capped at 255 so the shell can still see it.

main.cpp shrinks by 157 lines (2,964 to 2,807).
2026-05-09 09:23:23 -07:00