Skip to content

Commit

Permalink
qtscript: More tutorial events needed.
Browse files Browse the repository at this point in the history
Adds: eventMenuDesign and eventMenuResearchSelected
  • Loading branch information
perim committed Dec 3, 2017
1 parent 2007f14 commit b5f8a07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hci.cpp
Expand Up @@ -1277,6 +1277,7 @@ INT_RETVAL intRunWidgets()
intAddDesign(false);
intMode = INT_DESIGN;
reticuleCallback(RETBUT_DESIGN);
triggerEvent(TRIGGER_MENU_DESIGN_UP);
break;

case IDRET_CANCEL:
Expand Down Expand Up @@ -2167,6 +2168,10 @@ static void intProcessStats(UDWORD id)
{
triggerEvent(TRIGGER_MENU_BUILD_SELECTED);
}
else if (objMode == IOBJ_RESEARCH)
{
triggerEvent(TRIGGER_MENU_RESEARCH_SELECTED);
}

// Set the object stats
compIndex = id - IDSTAT_START;
Expand Down
7 changes: 7 additions & 0 deletions src/qtscript.cpp
Expand Up @@ -1096,6 +1096,9 @@ bool triggerEvent(SCRIPT_TRIGGER_TYPE trigger, BASE_OBJECT *psObj)
case TRIGGER_MENU_BUILD_SELECTED:
callFunction(engine, "eventMenuBuildSelected", args);
break;
case TRIGGER_MENU_RESEARCH_SELECTED:
callFunction(engine, "eventMenuResearchSelected", args);
break;
case TRIGGER_MENU_BUILD_UP:
args += QScriptValue(true);
callFunction(engine, "eventMenuBuild", args);
Expand All @@ -1104,6 +1107,10 @@ bool triggerEvent(SCRIPT_TRIGGER_TYPE trigger, BASE_OBJECT *psObj)
args += QScriptValue(true);
callFunction(engine, "eventMenuResearch", args);
break;
case TRIGGER_MENU_DESIGN_UP:
args += QScriptValue(true);
callFunction(engine, "eventMenuDesign", args);
break;
case TRIGGER_MENU_MANUFACTURE_UP:
args += QScriptValue(true);
callFunction(engine, "eventMenuManufacture", args);
Expand Down
2 changes: 2 additions & 0 deletions src/qtscript.h
Expand Up @@ -52,10 +52,12 @@ enum SCRIPT_TRIGGER_TYPE
TRIGGER_DESIGN_SYSTEM,
TRIGGER_DESIGN_PROPULSION,
TRIGGER_DESIGN_QUIT,
TRIGGER_MENU_DESIGN_UP,
TRIGGER_MENU_BUILD_UP,
TRIGGER_MENU_BUILD_SELECTED,
TRIGGER_MENU_MANUFACTURE_UP,
TRIGGER_MENU_RESEARCH_UP,
TRIGGER_MENU_RESEARCH_SELECTED,
TRIGGER_OBJECT_RECYCLED
};

Expand Down

0 comments on commit b5f8a07

Please sign in to comment.