Adventure Game Studio

AGS Development => Engine Development => Topic started by: Khris on Thu 15/05/2014 00:59:38

Title: ClaimEvent() crashes engine if called outside event
Post by: Khris on Thu 15/05/2014 00:59:38
I just found out about this more or less by accident: if you call ClaimEvent() in a situation where there wasn't a key press or mouse click, AGS will crash with the message: ClaimEvent(): no event to claim

This is pretty much a non-issue, but it means if you want to simulate a key press by calling something like on_key_press(eKeyT); and there's a ClaimEvent(), AGS will crash.
You can easily work around this of course by using an additional function, but should the engine really crash in this case? Instead of silently continuing?

(Didn't want to put this in the tracker since it's not really a bug.)
Title: Re: ClaimEvent() crashes engine if called outside event
Post by: BigMc on Fri 16/05/2014 11:24:35
I'd say it belongs in the tracker. Every crash is a bug.
Title: Re: ClaimEvent() crashes engine if called outside event
Post by: Crimson Wizard on Fri 16/05/2014 13:21:56
When the AGS game displays an error window, it is not a crash! It is error. Probably because engine does not support some behavior.

Crash - it is when program aborts/halts and Windows tells you it crashed (stop working); or AGS itself tells there was an unhandled exception (message with exception code etc).

Crash means that AGS could not detect error in time, and situation became worse.
Title: Re: ClaimEvent() crashes engine if called outside event
Post by: Khris on Sat 17/05/2014 16:48:19
I'd consider it a crash, since the engine can't recover from it.
It's not a bug though, because I was using ClaimEvent() wrong.
So it's only a bug in my game logic, not an engine bug. Thus, not really a tracker issue, since it doesn't require fixing.

I'm merely making the suggestion of amending the function to not halt the engine. It could simply throw a warning instead.
Title: Re: ClaimEvent() crashes engine if called outside event
Post by: Crimson Wizard on Sat 17/05/2014 20:07:06
Quote from: Khris on Sat 17/05/2014 16:48:19
I'm merely making the suggestion of amending the function to not halt the engine. It could simply throw a warning instead.
This is true.
There's one problem that prevented doing this: I don't know how to bring user's attention properly. Would a log be enough?
Title: Re: ClaimEvent() crashes engine if called outside event
Post by: Khris on Sun 18/05/2014 13:42:07
There already is a log; you'll get a file called "warnings.txt" inside the game folder if you for instance don't delete all DynamicSprites.