Renamed *MissionAccess functions

Added legacy wrappers and updated the documentation.
master
Mark 2018-04-05 19:34:16 +02:00
parent 065c8b7d96
commit 4212310a9f
7 changed files with 41 additions and 25 deletions

View File

@ -68,7 +68,7 @@
<row>
<col>MissionAccess</col>
<col>String</col>
<col>The scenario will only load if the player gained this password in another scenario. See script function <funclink>GainMissionAccess</funclink>().</col>
<col>The scenario will only load if the player gained this password in another scenario. See script function <funclink>GainScenarioAccess</funclink>().</col>
</row>
<row>
<col>Secret</col>

View File

@ -4,28 +4,29 @@
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>GainMissionAccess</title>
<title>GainScenarioAccess</title>
<category>System</category>
<version>1.0 OC</version>
<version>9.0 OC, previously known as GainMissionAccess from 1.0 to 8.1 OC</version>
<syntax>
<rtype>bool</rtype>
<params>
<param>
<type>string</type>
<name>password</name>
<desc>Password to be added to the list.</desc>
<desc>This scenario access password will be added to the list.</desc>
</param>
</params>
</syntax>
<desc>Adds a password to the list of gained mission access passwords. All players on this computer can then start scenarios which require this password (defined in Scenario.txt). In a sequence of mission scenarios each scenario should give access to the next one.</desc>
<desc>Adds a password to the list of gained scenario access passwords. All players on this computer can then start scenarios which require this password (defined in Scenario.txt). In a sequence of mission scenarios each scenario should give access to the next one.</desc>
<remark>If the engine runs in developer mode, stored registry information is not properly updated. To test this function, start the engine in player mode.</remark>
<examples>
<example>
<code>GainMissionAccess(&quot;WipfeMonsterSchnee&quot;);</code>
<text>Gives the mission password WipfeMosterSchnee to the player.</text>
<code>GainScenarioAccess(&quot;WipfeMonsterSchnee&quot;);</code>
<text>Gives the scenario access password WipfeMosterSchnee to the player.</text>
</example>
</examples>
<related><funclink>GetMissionAccess</funclink></related>
<related><funclink>GetScenarioAccess</funclink></related>
</func>
<author>Marky</author><date>2018-04</date>
<author>Sven2</author><date>2001-11</date>
</funcs>

View File

@ -37,7 +37,7 @@
</syntax>
<desc>Gain a scenario achievement. Gained achievements are represented as small symbols beside the scenario name in the selection screen.</desc>
<remark>Make sure the gain the achievement before players are saved, i.e. before the game is evaluated. Otherwise, gained achievements are not stored.</remark>
<related><funclink>GainMissionAccess</funclink></related>
<related><funclink>GainScenarioAccess</funclink></related>
<related><emlink href="scenario/ParameterDefs.xml">Scenario parameter definitions</emlink></related>
</func>
<author>Sven2</author><date>2014-09</date>

View File

@ -4,33 +4,34 @@
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>GetMissionAccess</title>
<title>GetScenarioAccess</title>
<category>System</category>
<version>1.0 OC</version>
<version>9.0 OC, previously known as GetMissionAccess from 1.0 to 8.1 OC</version>
<syntax>
<rtype>bool</rtype>
<params>
<param>
<type>string</type>
<name>mission_access</name>
<desc>Mission access to be checked.</desc>
<name>password</name>
<desc>Scenario access password to be checked.</desc>
</param>
</params>
</syntax>
<desc>Determines whether the player already has the specified mission access password.</desc>
<desc>Determines whether the player already has the specified scenario access password.</desc>
<remark>In a network game, this function always returns <code>false</code>. Otherwise differing local values might cause synchronization problems.</remark>
<examples>
<example>
<code><funclink>if</funclink> (!GetMissionAccess(&quot;DasWarHarteArbeit&quot;))
<code><funclink>if</funclink> (!GetScenarioAccess(&quot;DasWarHarteArbeit&quot;))
{
<funclink>GainMissionAccess</funclink>(&quot;DasWarHarteArbeit&quot;);
<funclink>GainScenarioAccess</funclink>(&quot;DasWarHarteArbeit&quot;);
<funclink>Message</funclink>(&quot;Congratulations, you are here for the first time!&quot;);
}</code>
<text>Displays a message if the mission access password "DasWarHarteArbeit" was not yet gained and then gives this mission access.</text>
<text>Displays a message if the scenario access password "DasWarHarteArbeit" was not yet gained and then grants this scenario access.</text>
</example>
</examples>
<related><funclink>GainMissionAccess</funclink></related>
<related><funclink>GainScenarioAccess</funclink></related>
</func>
<author>Marky</author><date>2018-04</date>
<author>Sven2</author><date>2001-11</date>
<author>matthes</author><date>2005-02</date>
</funcs>

View File

@ -41,7 +41,7 @@
<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><funclink>GainScenarioAccess</funclink>, <funclink>GetScenarioAccess</funclink></related>
<related><emlink href="scenario/ParameterDefs.xml">Scenario parameter definitions</emlink></related>
</func>
<author>Marky</author><date>2018-04</date>

View File

@ -5,11 +5,25 @@
@author Marky
*/
static const VERSION_10_0_OC = "10.0";
/* -- Scenario stuff -- */
global func GainMissionAccess(string password)
{
LogLegacyWarning("GainMissionAccess", "GainScenarioAccess", VERSION_10_0_OC);
return GainScenarioAccess(password);
}
global func GetMissionAccess(string password)
{
LogLegacyWarning("GetMissionAccess", "GetScenarioAccess", VERSION_10_0_OC);
return GetScenarioAccess(password);
}
global func SetNextMission(string filename, string title, string description)
{
LogLegacyWarning("SetNextMission", "SetNextScenario", "10.0");
LogLegacyWarning("SetNextMission", "SetNextScenario", VERSION_10_0_OC);
return SetNextScenario(filename, title, description);
}

View File

@ -685,7 +685,7 @@ static bool FnGameOver(C4PropList * _this, long iGameOverValue /* provided for f
return !!Game.DoGameOver();
}
static bool FnGainMissionAccess(C4PropList * _this, C4String *szPassword)
static bool FnGainScenarioAccess(C4PropList * _this, C4String *szPassword)
{
if (std::strlen(Config.General.MissionAccess)+std::strlen(FnStringPar(szPassword))+3>CFG_MaxString) return false;
SAddModule(Config.General.MissionAccess,FnStringPar(szPassword));
@ -1432,14 +1432,14 @@ static long FnSetMaxPlayer(C4PropList * _this, long iTo)
return true;
}
static bool FnGetMissionAccess(C4PropList * _this, C4String *strMissionAccess)
static bool FnGetScenarioAccess(C4PropList * _this, C4String *strMissionAccess)
{
// safety
if (!strMissionAccess) return false;
// non-sync mode: warn
if (::Control.SyncMode())
Log("Warning: using GetMissionAccess may cause desyncs when playing records!");
Log("Warning: using GetScenarioAccess may cause desyncs when playing records!");
return SIsModule(Config.General.MissionAccess, FnStringPar(strMissionAccess));
}
@ -2861,7 +2861,7 @@ void InitGameFunctionMap(C4AulScriptEngine *pEngine)
F(SetPlayerViewLock);
F(DoBaseMaterial);
F(DoBaseProduction);
F(GainMissionAccess);
F(GainScenarioAccess);
F(IsNetwork);
F(IsEditor);
F(GetLeague);
@ -2872,7 +2872,7 @@ void InitGameFunctionMap(C4AulScriptEngine *pEngine)
F(SetMaxPlayer);
F(Object);
F(GetTime);
F(GetMissionAccess);
F(GetScenarioAccess);
F(MaterialName);
F(DrawMap);
F(DrawDefMap);