OpenXcom Forum

OpenXcom Forks => OXCE Suggestions NEW => OpenXcom Extended (OXCE) => OXCE Suggestions Archive => Topic started by: Finnik on July 10, 2022, 07:35:04 pm

Title: [Suggestion] warn the player before aborting craft conversion
Post by: Finnik on July 10, 2022, 07:35:04 pm
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?
Title: Re: [Suggestion] warn the player before aborting craft conversion
Post by: Meridian on July 11, 2022, 12:22:45 am
Sounds good.

Wanna PR it?
Title: Re: [Suggestion] warn the player before aborting craft conversion
Post by: Finnik on July 11, 2022, 05:25:01 pm
Sure!  :D
Title: Re: [Suggestion] warn the player before aborting craft conversion
Post by: Finnik 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?
Title: Re: [Suggestion] warn the player before aborting craft conversion
Post by: Meridian 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