[Scummvm-devel] To all engine maintainers. Detector failure behaviour.
max at quendi.de
Wed Apr 26 00:45:01 CEST 2006
Am 26.04.2006 um 01:48 schrieb Eugene Sandulenko:
> To return to launcher you should return valid Engine object by
> Engine_BLAH_create() function. Particularly for Scumm engine this
> can be
> an empty object which will do nothing, just display that message. I
> implement it little later. Currently most engines return NULL in this
> case plugin code which produces useless 'Cannot instantiate engine'
> message which may mean anything.
> So, what do you think? If you agree to this approach, please,
> it in your engine.
I disagree with the approach.
If the engine/plugin fails to find a game, it should not create and
return a fake engine object. Rather, Engine_FOO_create() should
return one of multiple possible error ids. The error message itself
should be displayed by the code which creates the engines, which
currently resides in main.cpp.
Reasoning: This will ensure that the error messages are uniform
across all engines, avoid creating fake error objects which have no
purpose other than to display an error mesage.
Of course this require a few changes, but mostly trivial ones:
* We need to define a set of proper error return values for the
engines (this was on the TODO anyway).
* We need to modify the engines to properly return those error codes
* We need to modify the code in main.cpp to detect and handle those
error situations. It will then print a nice appropriate error message
based on the error code.
If we want to be uberflexibel, we could even allow engines to set an
error string, which contains some additional information.
More information about the Scummvm-devel