Function: SetNextScenario

Renamed and documented the former function SetNextMission. Added a script wrapper for the old function that issues a warning. Renaming is based on the fact that the docu speaks of scenarios, and other functions, such as GainScenarioAchievement already use this terminology
master
Mark 2018-04-04 21:17:16 +02:00
parent 82e674ddb8
commit 1682f62df8
3 changed files with 71 additions and 2 deletions

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>SetNextScenario</title>
<category>Player</category>
<version>9.0 OC</version>
<syntax>
<rtype>bool</rtype>
<params>
<param>
<type>string</type>
<name>scenario_name</name>
<desc>This is the path to the scenario file that should be started next. The path is relative to the game folder. Scenario paths contain all .oc* paths and the "\" file separators have to be escaped, e.g. "Missions.ocf\\Raid.ocs".</desc>
</param>
<param>
<type>caption</type>
<name>string</name>
<desc>Text that is displayed on the button that launches the scenario.</desc>
<optional />
</param>
<param>
<type>description</type>
<name>string</name>
<desc>Description text for the button.</desc>
<optional />
</param>
</params>
</syntax>
<desc>If you call this function in a scenario you will get an option to launch another, or the same scenario, in the scenario end screen.</desc>
<remark>You can call this function multiple times during the scenario, but only the last call before the game is over is binding.</remark>
<examples>
<example>
<code>SetNextScenario(&quot;Missions.ocf\\Raid.ocs&quot;, &quot;Start the raid mission.&quot;, &quot;Launches another scenario.&quot;);</code>
<text>Defines, that the next scenario will be the "Raid" mission.</text>
</example>
<example>
<code>SetNextScenario(&quot;MyScenarioFolder.ocf\\MyScenario.ocs&quot;, &quot;Restart round.&quot;, &quot;Start this scenario from the beginning.&quot;);</code>
<text>If called in "MyScenarioFolder.ocf\MyScenario.ocs" this can be used to add a retry-option to that scenario.</text>
</example>
</examples>
<related><funclink>GainMissionAccess</funclink>, <funclink>GetMissionAccess</funclink></related>
<related><emlink href="scenario/ParameterDefs.xml">Scenario parameter definitions</emlink></related>
</func>
<author>Marky</author><date>2018-04</date>
</funcs>

View File

@ -0,0 +1,21 @@
/**
Legacy.c
Contains legacy code that will be removed after some time.
@author Marky
*/
/* -- Scenario stuff -- */
global func SetNextMission(string filename, string title, string description)
{
LogLegacyWarning("SetNextMission", "SetNextScenario");
return SetNextScenario(filename, title, description);
}
/* -- Internal helpers -- */
global func LogLegacyWarning(string function_name, string replacement_name)
{
Log("WARNING: Do not use the legacy function \"%s\" anymore; use \"%s\" instead.", function_name, replacement_name);
}

View File

@ -2549,7 +2549,7 @@ static bool FnPauseGame(C4PropList * _this, bool fToggle)
return true;
}
static bool FnSetNextMission(C4PropList * _this, C4String *szNextMission, C4String *szNextMissionText, C4String *szNextMissionDesc)
static bool FnSetNextScenario(C4PropList * _this, C4String *szNextMission, C4String *szNextMissionText, C4String *szNextMissionDesc)
{
if (!szNextMission || !szNextMission->GetData().getLength())
{
@ -2929,7 +2929,7 @@ void InitGameFunctionMap(C4AulScriptEngine *pEngine)
::AddFunc(p, "PauseGame", FnPauseGame, false);
F(PathFree);
F(PathFree2);
F(SetNextMission);
F(SetNextScenario);
F(GetPlayerControlState);
F(SetPlayerControlEnabled);
F(GetPlayerControlEnabled);