Game Development Community

No to Mission modified prompt still saves - FIXED

by Nathan Bowhay - ESAL · in Torque 3D Professional · 03/30/2011 (12:41 pm) · 4 replies

If you create a new mission or open an existing mission there is a check like this:

%saveFirst = MessageBox("Mission Modified", "Would you like to save changes to the current mission "" @
         $Server::MissionFile @ "" before creating a new mission?", "SaveDontSave", "Question") == $MROk;

That prompts you if you want to save after making modifications to the mission. if you click no it still saves.

First is seems like when you pass it SaveDontSave it doesn't return what $MROk is equal to ("Ok"), second shouldn't it be a string compare? cause both seem to return strings not a number (bool, int...).

Note: I marked Beta 3, because I know this happens in Beta 3, but my guess is it happens in all the T3D builds.

#1
03/30/2011 (12:55 pm)
Yep, thanks for reporting Nathan. Fixed in 1.1 already for final release (THREED-1489).

Problem is that enums are treated in two different ways in the console stuff. For fields, they are usually stored as plain-text strings whereas for functions, they are often returned as numeric values for which a number of global variables supplies the meaning. This is what happened here with messageBox().

For engineAPI there is, however, only one single mapping and when messageBox() was switched, it broke the function. Reverted that in head.
#2
03/30/2011 (1:16 pm)
Ahhh, cool deal!
#3
04/19/2011 (4:45 pm)
Ouch!! A pretty gross thing slipped into my change there. Leads to a bad crash in the evaluator.

The respective lines in platform/nativeDialogs/msgBox.cpp need to be replaced with:

AFTER_MODULE_INIT( Sim )
{
   #if !defined( _XBOX ) && !defined( TORQUE_DEDICATED )
   Con::addConstant( "$MROk", TypeS32, &gsOK, "Determines the ok button press state in a message box.\n"
	   "@ingroup Platform" );
   Con::addConstant( "$MRCancel", TypeS32, &gsCancel, "Determines the cancel button press state in a message box.\n"
	   "@ingroup Platform" );
   Con::addConstant( "$MRRetry", TypeS32, &gsRetry, "Determines the retry button press state in a message box.\n"
	   "@ingroup Platform");
   Con::addConstant( "$MRDontSave", TypeS32, &gsDontSave, "Determines the don't save button press state in a message box.\n"
	   "@ingroup Platform" );
   #endif
}