Commit 9ea2cd0
Refactor CityManager: Extract Dedicated Services for Calculation, Happiness, Optimization, and Turn Processing (#200)
* feat(city): extract city logic into dedicated services for modularity
- Extract CityCalculationService for pure city output and corruption calculations
- Extract CityHappinessService for detailed city happiness management
- Extract CityOptimizationService for citizen assignment optimization
- Extract CityTurnProcessingService for comprehensive city turn processing
- Refactor CityManager to initialize and integrate these services
This modularization reduces complexity in CityManager, improves testability, and prepares for better maintainability and future enhancements.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* refactor(city-manager): delegate city logic to dedicated services
- Extracted city turn processing, calculation, happiness, and optimization logic into separate services.
- Replaced in-class implementations with calls to CityTurnProcessingService, CityCalculationService, CityHappinessService, and CityOptimizationService.
- Simplified CityManager by delegating complex city state updates and calculations to specialized services.
- Improved modularity and maintainability by isolating concerns into dedicated service classes.
- Updated imports and initialization to integrate new services.
- Removed legacy inline implementations for food/growth, production, happiness, corruption, and citizen optimization.
- Preserved public method interfaces while redirecting logic to services for easier testing and future enhancements.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
* refactor(city-manager): refactor CityTurnProcessingService initialization and method access
- Move initialization of CityTurnProcessingService to setMapManager when all dependencies are available.
- Properly delegate processFoodAndGrowth method as public in CityTurnProcessingService.
- Add lightweight refreshCityOutputs method for output recalculation without government effects.
- Clean up commented out code and improve dependency handling in CityManager.
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
---------
Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>1 parent 9030123 commit 9ea2cd0Copy full SHA for 9ea2cd0
File tree
Expand file treeCollapse file tree
5 files changed
+2424
-544
lines changedOpen diff view settings
Filter options
- apps/server/src/game
- managers
- services
Expand file treeCollapse file tree
5 files changed
+2424
-544
lines changedOpen diff view settings
0 commit comments