Fix event leaks, employee clone, DetailWindow refresh, and dead code#40
Draft
Fix event leaks, employee clone, DetailWindow refresh, and dead code#40
Conversation
Owner
Trawis
commented
Apr 29, 2026
- SubscribeToEvents/UnsubscribeFromEvents: replace lambda wrappers with method groups so -= actually removes the registered handler (lambdas always create new delegate instances, so the old -= was a no-op, stacking duplicate handlers on every scene load)
- DetailWindowTrainer: add Reset() and call it on MainMenu load so Install() runs again when the player starts a second game session
- SetCreativity clone: fix the DetailWindow refresh condition — compared actor directly (CurrentEmployee is Actor) and call Show(actor) instead of the unreachable employee comparison that was always false after the actor.employee swap
- SetCreativity clone: copy the missing Employee fields that were silently dropped: NickName, Founder, MadeCEO, Dismissed, Retired, PreviousEmployment, AgeMonth, SkillCeiling, LowestSatisfaction, DemandsMet, DemandsRequested, CustomBenefits, LeadProjects, LeadProjectsFix
- SellProductStock: moved dialog after the product check so it does not fire when there is nothing to sell
- ForceBankruptAction: removed leftover DevConsole debug log
- Removed DisableSkillDecay (declared but never implemented) and ReduceBoxPrice (AI.BoxPrice is a compile-time const, runtime assignment has no effect) from Helpers.Settings and all call sites
- Fix typos: "setted up" -> "set" (x3), "takovered" -> "taken over"
- SubscribeToEvents/UnsubscribeFromEvents: replace lambda wrappers with method groups so -= actually removes the registered handler (lambdas always create new delegate instances, so the old -= was a no-op, stacking duplicate handlers on every scene load) - DetailWindowTrainer: add Reset() and call it on MainMenu load so Install() runs again when the player starts a second game session - SetCreativity clone: fix the DetailWindow refresh condition — compared actor directly (CurrentEmployee is Actor) and call Show(actor) instead of the unreachable employee comparison that was always false after the actor.employee swap - SetCreativity clone: copy the missing Employee fields that were silently dropped: NickName, Founder, MadeCEO, Dismissed, Retired, PreviousEmployment, AgeMonth, SkillCeiling, LowestSatisfaction, DemandsMet, DemandsRequested, CustomBenefits, LeadProjects, LeadProjectsFix - SellProductStock: moved dialog after the product check so it does not fire when there is nothing to sell - ForceBankruptAction: removed leftover DevConsole debug log - Removed DisableSkillDecay (declared but never implemented) and ReduceBoxPrice (AI.BoxPrice is a compile-time const, runtime assignment has no effect) from Helpers.Settings and all call sites - Fix typos: "setted up" -> "set" (x3), "takovered" -> "taken over" https://claude.ai/code/session_019b1PQK6ghTTzhvH2saDTam
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 2 high |
🟢 Metrics 0 complexity · 0 duplication
Metric Results Complexity 0 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
RemoveSoft: replace broken dummy-company Trade() approach with MarketSimulation.ArchiveProduct(product, true), which cleanly removes acquired products without needing a funded SimulatedCompany. ReduceBoxPrice: AI.BoxPrice is a compile-time literal constant and cannot be set at runtime. Rewritten as a per-hour refund: tracks BoxesShipped delta each in-game hour and refunds 62.5f per box (equivalent to the original 50% price reduction target), credited via MakeTransaction. Both features restored in SettingsWindow UI. https://claude.ai/code/session_019b1PQK6ghTTzhvH2saDTam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.