Author Topic: [Suggestion] warn the player before aborting craft conversion  (Read 2059 times)

Offline Finnik

  • Commander
  • *****
  • Posts: 505
  • Finnik#0257
    • View Profile
Hey!
Could be a rare case, but when I was analyzing code I noticed, that when you `void Production::startItem(Base * b, SavedGame * g, const Mod *m) const` and your project require the craft, it would be removed and deleted. But when we look to `refundItem`, we can see that there is no way to refund the craft in case we abort construction.

I understand how coplicated proper handling of this case, you can stuck with no free hangar space. But may be at least warn the player about consequences?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9047
    • View Profile
Re: [Suggestion] warn the player before aborting craft conversion
« Reply #1 on: July 11, 2022, 12:22:45 am »
Sounds good.

Wanna PR it?

Offline Finnik

  • Commander
  • *****
  • Posts: 505
  • Finnik#0257
    • View Profile
Re: [Suggestion] warn the player before aborting craft conversion
« Reply #2 on: July 11, 2022, 05:25:01 pm »
Sure!  :D

Offline Finnik

  • Commander
  • *****
  • Posts: 505
  • Finnik#0257
    • View Profile
Re: [Suggestion] warn the player before aborting craft conversion
« Reply #3 on: August 14, 2022, 01:54:55 pm »
I've tried to make some generic solution like `ErrorMessageState`, but can't see the way to implement it - I need to stop running the code in btnStop method and ask for confirmation.
I can't see any examples of that - all confirmation states hold the custom logic of confirmed action. I can't see an example of something like callbacks to parent state.
Should it be done in a form of custom state with own special logic, or is there some smart way to solve the problem with a general state?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9047
    • View Profile
Re: [Suggestion] warn the player before aborting craft conversion
« Reply #4 on: August 15, 2022, 11:25:17 am »
I don't see any need for a generic confirmation window

typical example:
parent: TransferItemsState
confirm: TransferConfirmState