![]() |
CTP2 Bureau The Modding Knowledgebase |
|
Apolyton CTP2 forums Apolyton CTP2 archives Source Code Project SVN |
![]() |
Search the site: |
SLIC-Reference :
|
Arguments: | player, advance[, reason] | Type: | void |
Give the player the advance specified |
Since CTP2 AE the function accepts "reason" as an optional, third parameter. |
tested
working
//---------------------------------------------------------------------------- // // Name : Slic_GrantAdvance::Call // // Description: Give an advance to a player. // // Parameters : args[0] : the player to receive the advance // args[1] : the advance // args[2] (optional) : a reason why the advance is given // // Globals : g_gevManager : game event handler // // Returns : SFN_ERROR : indication whether the command has been // passed to the game event handler // // Remark(s) : * SFN_ERROR_OK is returned when the command has been passed to // the event handler. // Other return values indicate errors in the number or type of // the arguments. // // * SFN_ERROR_OK does not indicate the result of the command // execution: when e.g. the player already has the advance, // SFN_ERROR_OK will be returned, but nothing will happen. // //---------------------------------------------------------------------------- SFN_ERROR Slic_GrantAdvance::Call(SlicArgList *args) { if ((args->Count() < 2) || (args->Count() > 3)) { return SFN_ERROR_NUM_ARGS; } PLAYER_INDEX player; if (!args->GetPlayer(0, player)) { return SFN_ERROR_TYPE_ARGS; } sint32 adv; if (args->GetInt(1, adv)) { if (adv >= g_theAdvanceDB->NumRecords()) { return SFN_ERROR_NOT_ADVANCE; } } else { return SFN_ERROR_TYPE_ARGS; } sint32 reason = CAUSE_SCI_UNKNOWN; if (args->Count() >= 3) { if (args->GetInt(2, reason)) { if ((reason < 0) || (reason > CAUSE_SCI_INITIAL)) { return SFN_ERROR_OUT_OF_RANGE; } } else { return SFN_ERROR_TYPE_ARGS; } } g_gevManager->AddEvent(GEV_INSERT_Tail, GEV_GrantAdvance, GEA_Player, player, GEA_Int, adv, GEA_Int, reason, GEA_End ); return SFN_ERROR_OK; } |
Using this form you may add your own observations concerning the above item, e.g. additional hints for usage, limitations, oddities etc. Please note this is not the place for asking questions or carrying out discussions about modding - please refer to the Apolyton CTP2 Modification Forum on that purpose.
*) Required fields
No user comments yet. |
![]() |
This site is currently maintained by: BureauBert (Webmaster) Maquiladora (Manager) Legal Notice: Legal Notice Statistics: 96259 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne |