mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-10 02:53:51 +00:00
refactor(editor): extract items.json mutation handlers into cli_items_mutate.cpp
Moves the three items.json mutation handlers (--set-item,
--copy-zone-items, --clone-item) out of main.cpp into a new
cli_items_mutate.{hpp,cpp} module. All three operate on the
same {"items": [...]} schema; --set-item supports both
id-lookup ("123") and index-lookup ("#0") with strict
"only changed fields are written" semantics, --copy-zone-items
has replace and --merge modes, --clone-item auto-assigns the
smallest unused id.
main.cpp shrinks by 316 lines (5,087 to 4,771) and finally
drops below 5K. items.json now has its full mutation surface
in one focused module instead of scattered through the
megafile.
This commit is contained in:
parent
f29cf0f29c
commit
6430a3f554
4 changed files with 387 additions and 320 deletions
18
tools/editor/cli_items_mutate.hpp
Normal file
18
tools/editor/cli_items_mutate.hpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
namespace cli {
|
||||
|
||||
// Dispatch the items.json mutation handlers — edit / duplicate /
|
||||
// transfer item records in a zone's items.json.
|
||||
// --set-item edit fields on an existing item by id or #idx
|
||||
// --copy-zone-items copy items between zones (replace or merge)
|
||||
// --clone-item duplicate an item with a fresh id
|
||||
//
|
||||
// Returns true if matched; outRc holds the exit code.
|
||||
bool handleItemsMutate(int& i, int argc, char** argv, int& outRc);
|
||||
|
||||
} // namespace cli
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue