![]() |
CTP2 Bureau The Modding Knowledgebase |
|
Apolyton CTP2 forums Apolyton CTP2 archives Source Code Project SVN |
![]() |
Search the site: |
SLIC-Reference :
|
Arguments: | city, building | Type: | int |
Returns true if the city has a building of the given type |
Building is a quoted string corresponding to the name in buildings.txt. Example:
if(CityHasBuilding(city[0], "IMPROVE_TEMPLE")) { //do stuff } //returns 1 if city[0] has a temple |
tested
working
SFN_ERROR Slic_CityHasBuilding::Call(SlicArgList *args) { BOOL res; Unit city; if(args->Count() != 2) { return SFN_ERROR_NUM_ARGS; } res = args->GetCity(0, city); if(!res) return SFN_ERROR_TYPE_BUILTIN; if(args->m_argValue[1].m_type != SA_TYPE_HARD_STRING) return SFN_ERROR_TYPE_ARGS; const char *name = args->m_argValue[1].m_symbol->GetName(); StringId sname; if(!g_theStringDB->GetStringID(name, sname)) { return SFN_ERROR_UNKNOWN_BUILDING; } for(sint32 i = 0; i < g_theBuildingDB->NumRecords(); i++) { if(g_theBuildingDB->Get(i)->m_name == sname) { if(city.HaveImprovement(i)) { m_result.m_int = 1; } else { m_result.m_int = 0; } return SFN_ERROR_OK; } } return SFN_ERROR_UNKNOWN_BUILDING; } |
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: 107653 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne |