![]() |
CTP2 Bureau The Modding Knowledgebase |
|
Apolyton CTP2 forums Apolyton CTP2 archives Source Code Project SVN |
![]() |
Search the site: |
SLIC-Reference :
|
Arguments: | player, advance_name | Type: | int |
Returns true if the player has the advance |
Returns 1 if the player has the advance, 0 otherwise. This can be used with GrantAdvance; example:
//check to see if the player has Agriculture if(!HasAdvance(player[0], AdvanceDB(ADVANCE_AGRICULTURE)) { //if not, then give it to them GrantAdvance(player[0], AdvanceDB(ADVANCE_AGRICULTURE)); } |
tested
working
SFN_ERROR Slic_HasAdvance::Call(SlicArgList *args) { if (args->Count() != 2) return SFN_ERROR_NUM_ARGS; sint32 player; if(!args->GetPlayer(0, player)) return SFN_ERROR_TYPE_ARGS; //Added by Martin Ghmann to overload this function to allow also advance //indices directly instead of advance strings only. sint32 adv; if(args->m_argValue[1].m_type == SA_TYPE_STRING){ for(adv = 0; adv < g_theAdvanceDB->NumRecords(); adv++) { if(g_theAdvanceDB->Get(adv)->m_name == args->m_argValue[1].m_int) break; } } else if(!args->GetInt(1, adv)) return SFN_ERROR_TYPE_ARGS; if(adv >= g_theAdvanceDB->NumRecords()) { return SFN_ERROR_NOT_ADVANCE; } if(player < 0 || player >= k_MAX_PLAYERS) return SFN_ERROR_OUT_OF_RANGE; if(!g_player[player]) { return SFN_ERROR_DEAD_PLAYER; } m_result.m_int = g_player[player]->HasAdvance(adv); DPRINTF(k_DBG_SLIC, ("Slic_HasAdvance: %d\n", m_result.m_int)); 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: 102516 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne |