View Issue Details

IDProjectCategoryView StatusLast Update
0003093FSSCPscriptingpublic2014-09-21 14:47
ReporterParias Assigned Tom_m  
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.7.2 RC1 
Target Version3.7.2 
Summary0003093: mn.getMissionFilenname() doesn't returna value if in GS_STATE_BRIEFING
DescriptionFor a project I'm working on, I need the ability to get the currently-loaded mission filename while I'm in the GS_STATE_BRIEFING state. However, it looks like by design in lua.cpp, this function will only return a value if GM_IN_MISSION is valid. Here's the function (starting at line 15132):

====
ADE_FUNC(getMissionFilename, l_Mission, NULL, "Gets mission filename", "string", "Mission filename, or empty string if game is not in a mission")
{
    if (!(Game_mode & GM_IN_MISSION))
        return ade_set_error(L, "s", "");

    return ade_set_args(L, "s", Game_current_mission_filename);
}
====

If I comment out the if --> return bit, my script function (which hooks into the start of GS_STATE_BRIEFING) works exactly as expected and correctly returns the currently-loaded mission as soon as I enter the briefing stage. As an alternate option, I tried appending a check for gameseq_get_state(gameseq_get_depth()) == GS_STATE_BRIEFING onto the end of the if statement, but I couldn't seem to get this to work (it would still fail execution and bump a nil value back) so I just left it all commented out for now.

Is this check for GM_IN_MISSION needed? I would figure if we're trying to get the current mission filename when we're not in a valid state to do so (i.e. main menu or something) it would just return nil anyways. Am I misunderstanding how this works?
TagsNo tags attached.

Activities

Goober5000

2014-09-17 01:52

administrator   ~0016281

Assigning to m!m to see what he might have to say about this.

m_m

2014-09-17 08:48

developer   ~0016285

I looked through the code and removing the GM_IN_MISSION check should work fine.
Game_current_mission_filename should always be a valid string but if no mission is loaded it will be an empty string.

m_m

2014-09-21 14:47

developer   ~0016287

Fix committed to trunk@11077.

Related Changesets

fs2open: trunk r11077

2014-09-21 11:23

m_m


Ported: N/A

Details Diff
Fix for Mantis 3093: mn.getMissionFilenname() doesn't return a value if in GS_STATE_BRIEFING Affected Issues
0003093
mod - /trunk/fs2_open/code/parse/lua.cpp Diff File

Issue History

Date Modified Username Field Change
2014-08-14 15:43 Parias New Issue
2014-09-17 01:52 Goober5000 Target Version => 3.7.2
2014-09-17 01:52 Goober5000 Note Added: 0016281
2014-09-17 01:52 Goober5000 Assigned To => m_m
2014-09-17 01:52 Goober5000 Status new => assigned
2014-09-17 08:48 m_m Note Added: 0016285
2014-09-21 14:47 m_m Changeset attached => fs2open trunk r11077
2014-09-21 14:47 m_m Note Added: 0016287
2014-09-21 14:47 m_m Status assigned => resolved
2014-09-21 14:47 m_m Resolution open => fixed