Add Rebuild X Keyboard Commands#2129
Add Rebuild X Keyboard Commands#2129CnCRAZER wants to merge 7 commits intoPhobos-developers:developfrom
Conversation
Introduce BuildLastOfTab commands to re-queue the last produced item from each sidebar tab (Power/Infrastructure, Defense/Combat, Infantry, Vehicles/Aircraft). Adds BuildLastOfTab.cpp/.h with a templated CommandClass (explicit instantiations for tabs 0..3) and UI strings. Register the new commands in Commands.cpp and add sources to the Visual Studio project file. Add per-tab last-built tracking to HouseExt (LastBuiltPerTab, LastBuiltRTTIPerTab, LastBuiltIsNavalPerTab), initialize defaults, and include them in serialization. Add a hook (Hooks.BuildLastTab.cpp) into HouseClass object delivery to update the per-tab last-built info when the current player's factory delivers an object.
Document four new keyboard commands (Rebuild Structure, Rebuild Defense, Rebuild Infantry, Rebuild Vehicle) in docs/User-Interface.md, add a What's New entry in docs/Whats-New.md, and credit RAZER in CREDITS.md. Adds brief descriptions and localization note for the new commands.
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
TaranDahl
left a comment
There was a problem hiding this comment.
Code looks good.
But there are design problems that need to be addressed.
docs/User-Interface.md
Outdated
| - Re-queue the last produced Infantry you built. | ||
|
|
||
| ### `[ ]` Rebuild Vehicle | ||
| - Re-queue the last produced Vehicle you built. |
There was a problem hiding this comment.
I think it would be best to handle Aircraft and Ship separately as well.
There was a problem hiding this comment.
So 3 potential keybinds for last tab? Vehicle / navy / aircraft?
There was a problem hiding this comment.
Implemented this change. Let me know what you think
There was a problem hiding this comment.
So 3 potential keybinds for last tab? Vehicle / navy / aircraft?
Yeah. In short, the key should bind to the production line instead of the tab.
In addition, the old code should be modified to ensure consistency (i.e., set the shortcut keys according to the production line instead of the tab).
Introduce dedicated rebuild commands for tab 3: RebuildVehicle, RebuildAircraft and RebuildNaval. Adds new header/source (src/Commands/RebuildTab3Subtypes.*), registers the commands in Commands.cpp and includes them in the VCXPROJ and project includes. Track per-subtype last-built data in HouseExt (Body.h/Body.cpp) including type indices and RTTI, persist them in serialization, and update the existing BuildLastTab hook to maintain these per-subtype fields. Commands enqueue Produce events and focus the sidebar to tab 3 when executed, with UI strings loaded via GeneralUtils.
Introduce dedicated Rebuild Aircraft and Rebuild Naval commands and remove the Vehicle entry from the generic BuildLast tab set. Update BuildLastOfTab to use 3 tabs (Structure, Defense, Infantry) by shrinking the name/description/UI arrays and the static_assert, and remove the template instantiation/registration for the 4th tab. Register the new RebuildVehicle, RebuildAircraft and RebuildNaval commands in Commands.cpp instead of using a mixed Vehicle/Aircraft entry. Update docs: User-Interface.md wording ("Unit") and add UI entries for Rebuild Aircraft and Rebuild Naval, and Whats-New.md to list the new commands.
This pull request introduces a set of new keyboard commands that allow players to quickly re-queue the last produced unit or building of various types directly from the sidebar. These "Rebuild" commands are implemented with supporting infrastructure for tracking the last built item per sidebar tab and per subtype (vehicle, aircraft, naval), and are fully integrated into the command registration and serialization systems. Documentation and credits have also been updated accordingly.
New "Rebuild" Commands Functionality:
Rebuild Structure,Rebuild Defense,Rebuild Infantry,Rebuild Vehicle,Rebuild Aircraft, andRebuild Naval. These commands allow the player to quickly re-queue the last produced item of the corresponding type. [1] [2] [3] [4] [5] [6] [7]Sidebar Tab and Subtype Tracking:
HouseExtextension. This enables the new commands to function reliably and recall the correct unit/building type. [1] [2] [3] [4]Project and Build Integration:
Phobos.vcxproj) and ensured all new commands are registered at runtime. [1] [2] [3] [4] [5]Documentation and Credits:
These changes collectively enhance the user interface by providing convenient hotkeys for quickly rebuilding recently produced units and structures, improving gameplay efficiency and quality of life.