Skip to content

Tradeship Rework#95

Merged
1brucben merged 20 commits into
v0.2.0from
tradeship2
Nov 18, 2025
Merged

Tradeship Rework#95
1brucben merged 20 commits into
v0.2.0from
tradeship2

Conversation

@1brucben
Copy link
Copy Markdown
Owner

This pull request introduces a new Trade tab in the control panel UI, improves trade ship management and visibility, adds a debug pointer coordinates overlay, and refactors trade-related game logic for better maintainability and extensibility. The changes also include minor UI and code improvements for clarity and robustness.

Trade System and UI Improvements

  • Added a new "Trade" tab to the control panel (ControlPanel2) that displays active trade ships, their statuses, queued trade ship construction, and a demand indicator. This includes a new _renderTradeTab() method for detailed trade ship and port information. [1] [2] [3]
  • Improved trade ship status reporting with _computeTradeShipStatus() to provide more accurate and user-friendly descriptions of ship states.
  • Updated message type color mapping to support new trade-related message types for better feedback in the UI. [1] [2] [3]

Game Logic and Trade Management

  • Registered TradeManagerExecution and CapitalRecalculationExecution in the game runner to centralize trade demand/supply assignment and periodically compute player capitals, supporting the new trade system. [1] [2]
  • Added a gdpFactor() method to the game configuration interface for future economic calculations related to trade and player GDP.

Debugging and UI Enhancements

  • Added a new PointerCoordsLayer for displaying world coordinates next to the mouse pointer in debug mode, improving development and map navigation. [1] [2] [3] [4]
  • Improved modal close button styling for better readability and accessibility.

Code Quality and Robustness

  • Switched from || to ?? for default values to handle falsy values more robustly in several places. [1] [2]
  • Restored light DOM rendering for the control panel to maintain compatibility with legacy CSS and querySelector usage.

These changes collectively enhance the user experience around trade ships, improve maintainability of the codebase, and add useful debugging tools for development.

- Introduced a centralized trade system with demand accumulation and route management.
- Enhanced WarshipExecution to engage trade ships based on war status and embargo rules.
- Added trade route metadata to Unit interface for tracking trade route owners and cargo.
- Implemented CapturedTradeShipReturnExecution to handle captured trade ships returning to ports.
- Updated UnitImpl to manage trade route owners and cargo gold.
- Created TradeManagerExecution to manage trade routes, including spawning trade ships and handling replacements.
- Added tests for trade manager functionality, including trade completion, interception of neutral ships, and payout verification.
@1brucben 1brucben merged commit 7e716c0 into v0.2.0 Nov 18, 2025
5 of 7 checks passed
@El-Magico777 El-Magico777 added this to the v0.1.11 milestone Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants