Skip to content

Fix event leaks, employee clone, DetailWindow refresh, and dead code#40

Draft
Trawis wants to merge 2 commits intodevfrom
claude/code-review-fixes-HCI89
Draft

Fix event leaks, employee clone, DetailWindow refresh, and dead code#40
Trawis wants to merge 2 commits intodevfrom
claude/code-review-fixes-HCI89

Conversation

@Trawis
Copy link
Copy Markdown
Owner

@Trawis 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
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 29, 2026

Not up to standards ⛔

🔴 Issues 2 high

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
ErrorProne 2 high

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

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
@Trawis Trawis self-assigned this Apr 30, 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