ClaimEvent() crashes engine if called outside event

Started by Khris, Thu 15/05/2014 00:59:38

Previous topic - Next topic

Khris

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.)

BigMc

I'd say it belongs in the tracker. Every crash is a bug.

Crimson Wizard

#2
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.

Khris

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.

Crimson Wizard

#4
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?

Khris

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.

SMF spam blocked by CleanTalk