SLIC-Reference : StealSpecificAdvance
CTP2 Bureau
The Modding
Knowledgebase
Apolyton CTP2 forums
Apolyton CTP2 archives
Source Code Project SVN

SLIC-Reference : : StealSpecificAdvance  

Type: void

A spy steals a specific advance from a city

Can only be used from a message box with a city in context. This uses a drop down menu. This is a left over function from CtP1, is not guaranteed to work.

Source:

SFN_ERROR Slic_StealSpecificAdvance::Call(SlicArgList *args)
{
	if (args->Count() != 0)
		return SFN_ERROR_NUM_ARGS;

	SlicObject *context = g_slicEngine->GetContext();
	Message message;
	g_slicEngine->GetCurrentMessage(message);

	if(message == Message())
		return SFN_ERROR_NOT_IN_BUTTON;

	AdvanceType adv = message.GetSelectedAdvance();

	Unit u = context->GetUnit(0);
	sint32 owner = u.GetOwner();

	if(g_network.IsClient()) {
		if(u.GetOwner() == g_selected_item->GetVisiblePlayer()) {
			g_network.SendAction(new NetAction(NET_ACTION_STEAL_TECHNOLOGY,
										   u.m_id, context->GetCity(0).m_id,
										   adv));
		}
	}

	ORDER_RESULT res = u.StealTechnology(context->GetCity(0), adv);
	if(res != ORDER_RESULT_ILLEGAL) {
		sint32 index = g_orderInfoMap[UNIT_ORDER_STEAL_TECHNOLOGY];
		OrderInfo *oi = NULL;
		if(index >= 0 && index < g_numOrderInfo) {
			oi = &g_orderInfo[index];
		}

		if(oi && oi->m_goldCost > 0) {
			g_player[owner]->m_gold->SubGold(oi->m_goldCost);
		}

		if(g_theUnitPool->IsValid(u)) {
			u.SetFlag(k_UDF_USED_SPECIAL_ACTION_THIS_TURN);
			if(oi && oi->m_moveCost > 0) {
				bool out_of_fuel;
				u.DeductMoveCost(oi->m_moveCost, out_of_fuel);
			}
			u.ClearFlag(k_UDF_FIRST_MOVE);
		}
	}
	return SFN_ERROR_OK;
}

Information last updated by BureauBert on 23.11.2010

User Comments:

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.

Subject / Title*:
Text:*
(A maximum of characters left)
Your name:*
Your website (URL):

*) Required fields

Unkown Tag: Name

  Administration
This site is currently maintained by: BureauBert (Webmaster)  Maquiladora (Manager)  Legal Notice: Legal Notice Statistics: 123873 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne
Share this page:  VK Facebook Twitter LiveJournal OK MR Google+ LinkedIn tumblr Pinterest Blogger Digg Evernote