BUILD MENU UNDO/REDO -- 0.1.2.0 EXPERIMENTAL

This is a test build, not a verified production release. Lua and simulated
history tests pass; the mod has NOT been run inside Farming Simulator 25.
The retail landscaping implementation is omitted from the bundled SDK, so
some hook signatures were inferred from the earlier construction system.
Terrain texture get/set functions and their weight behavior need in-game
verification. The mod refuses to initialize if required functions are absent.

CHANGES IN 0.1.2.0
- Uses registered BMUR_UNDO and BMUR_REDO game input actions.
- Resolves the live GUI screen and recognizes terrain brushes without isa().
- Guards the live camera input callback already registered with the game.
- Handles field info layers as bit-vector maps.
- Adds bmurStatus to report input and history state in the developer console.
- Previous version's Ctrl+Z failure was reproduced in the running game.
  This revision is awaiting the next live test.

CHANGES IN 0.1.1.0
- Fixes the startup failure shown in the game log: the original build passed
  a nil terrain global into getTerrainHeightmapUnitSize. Initialization now
  waits for the live mission terrainRootNode and uses it for every snapshot.
- Suppresses construction-camera zoom while Left Ctrl+Z is held over a
  supported brush. Plain Z still reaches the regular zoom callback.
- Adds shortcut polling as a fallback for GUI keyboard event routing.
- Regression tests cover these cases with simulated engine callbacks.
  This revision still needs in-game validation of the restoration APIs.

INSTALL
Copy FS25_BuildMenuUndoRedo.zip, without unzipping it, to your FS25 mods folder.
Remove the old extracted BuildMenuUndoRedo mod folder or old ZIP first; do
not keep both copies. Restart FS25 so it reloads the script. Enable Build Menu
Undo/Redo in the save's mod selection screen. Version should be 0.1.2.0.
Use a COPY of a save for the initial test.

KEYS (while a Paint, Terraform or Foliage brush is selected)
Left Ctrl + Z                    Undo last completed stroke
Left Shift + Left Ctrl + Z       Redo last undone stroke
Release the mouse tool before undo/redo. Holding Z fires once per press.
Right Ctrl does not activate these shortcuts; Left Shift selects redo.

HISTORY
One press/drag/release of a tool is one stroke. Up to 20 strokes are held in
memory. A new recorded edit clears redo. History resets on loading another
save or quitting. The actual resulting terrain is saved normally by FS25.
Original landscaping charges are retained; undo/redo does not change money.
Buildings, trees, fences and demolition are outside the undo scope.
Multiplayer is disabled. There is no multiplayer synchronization protocol.

IMPLEMENTATION LIMITS / TEST PRIORITIES
- The standard FS25 weight-map grid is assumed to be twice the height-map
  resolution. Custom maps may require a different paintStep adapter.
- Height, paint weights, crop/decoration density, field density and loose
  material density are captured where exposed by the map's APIs.
- Check meadow, grass, shrub, field destruction and loose material cases.
  Map-specific density planes that are not exposed in the expected tables
  are not captured. Tire-track decals and terrain displacement are not
  restored. No guarantee is made for custom terrain or foliage systems.
- More than 250,000 samples in one stroke clears history with a message.
  Large brushes and long drags can reach this limit and may pause the game.
- Outside changes to recorded samples invalidate history instead of being
  overwritten. An unrecordable stroke also clears history.
- Restoration is checked by reading data back. A failure clears history and
  attempts rollback. Rollback itself cannot be guaranteed on an unsupported
  engine; the log reports any failure. This is why the first test must use
  a disposable copy of a save.

IN-GAME ACCEPTANCE CHECK
1. On a copied save, paint one small patch. Undo, redo, and compare its edges
   and blends to the original. Test two overlapping strokes in both orders.
2. Raise/lower, smooth, flatten and slope terrain. Undo and redo each.
3. Paint and erase grass/shrubs, including over a field. Undo and redo each.
4. Undo, make a new stroke, then redo: the old redo must be gone.
5. Hold Z: only one operation. Use Right Ctrl+Z: no operation.
6. Save/reload: terrain persists and history is empty.
7. Check log.txt for '[Build Menu Undo/Redo]', warnings and Lua errors.

SOURCE
The source is included in the ZIP under scripts/BuildMenuUndoRedo.lua.
No GIANTS or third-party mod code is bundled.
