in Game Objectives,
    void setObjectiveComplete(int n);
    void setObjectiveIncomplete(int n);
    void setObjectiveFailed(int n);
    void setObjectiveHidden(int n);
    void setObjectiveVisible(int n);
Are the five most important functions. You can also expose, for scripting
purposes, the data-retrieving functions

    const std::string& getGameObjectiveText(int n);
    bool isObjectiveVisible(int n);
    bool isObjectiveComplete(int n);
    bool isObjectiveFailed(int n);
    GameObjectiveType getObjectiveType(int n);

However! The problem here is that n isn't the exact number as seen by the
script, like 1,2,3 ... 16.  N is just an index of the object. The script
sees the "script numbers", which are the ones shown in the GUI, and are set
and retrieved by

    void setScriptNumber(int n, int scriptNumber);
    int getScriptNumber(int n);

This is why in SGSL, the setObjectiveComplete functions and such look
through all of the objectives to find one with a matching 'script number'

void Story::objectiveFailed(GameGUI* gui)
{
    int n = line[++lineSelector].value;
    for(int i=0; i<gui->game.objectives.getNumberOfObjectives(); ++i)
    {
        if(gui->game.objectives.getScriptNumber(i) == n)
        {
            gui->game.objectives.setObjectiveFailed(i);
            break;
        }
    }
}

-- 
Extra cheese comes at a cost. Bradley Arsenault.
_______________________________________________
glob2-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/glob2-devel

Reply via email to