![]() |
CTP2 Bureau The Modding Knowledgebase |
|
Apolyton CTP2 forums Apolyton CTP2 archives Source Code Project SVN |
![]() |
![]() |
Search the Wiki: |
ActionsPagesRecent Changes SearchCreate a new page: ![]() |
AE Modding Wiki : Functions : PillageNew SLIC function: Pillage(): Well, as far as I am able to interpret the code below it frees the slaves, destroys all the buildings, and gives the gold to the capturing player. Is supposed to work in messages only, where the city is given from the context. Probably it currently doesn't work at all, since it is outcommented in the AE's script.slc. SFN_ERROR Slic_Pillage::Call(SlicArgList *args) { if (args->Count() > 0) return SFN_ERROR_NUM_ARGS; Unit city = g_slicEngine->GetContext()->GetCity(0); if (!city.IsValid()) { return SFN_ERROR_OK; } if(!city.GetData()->GetCityData()->CapturedThisTurn()) { if(g_network.IsClient()) { g_network.RequestResync(RESYNC_PROBABLE_CHEATER); } return SFN_ERROR_OK; } if(g_network.IsClient()) { g_network.SendAction(new NetAction(NET_ACTION_FREE_SLAVES, city.m_id)); } sint32 pl; if(!args->GetInt(0, pl)) return SFN_ERROR_TYPE_ARGS; sint32 amt; if(!args->GetInt(1, amt)) return SFN_ERROR_TYPE_ARGS; if(pl < 0 || pl >= k_MAX_PLAYERS) return SFN_ERROR_OUT_OF_RANGE; if(!g_player || !g_player[pl]) return SFN_ERROR_DEAD_PLAYER; sint32 p = 0; uint64 buildings = city->GetCityData()->GetEffectiveBuildings()&(((uint64)1<<(uint64)g_theBuildingDB->NumRecords())-1); for(sint32 i=0; buildings!=0; i++,buildings>>=1) { if ((buildings&0xFF) == 0) { buildings>>=8; i+=8; } if (buildings&1) { p += buildingutil_GetProductionCost(i, city->GetOwner()); city->GetCityData()->DestroyImprovement(i); } } amt = p / g_theGovernmentDB->Get(g_player[pl]->m_government_type)->GetBuildingRushModifier(); if (amt >= 0) g_player[pl]->m_gold->AddGold(amt); return SFN_ERROR_OK; } Page last modified on June 11, 2009, at 02:36 PM |
![]() |
AE Modding Wiki built with PmWiki Design: BureauBert |