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

SLIC-Reference : : GetCounterProposalResult  

Arguments: sender, receiver, player, type Type: int

Like GetNewProposalResult

Type: 0 = science, 1 = gold, 2 = production, 3 = regard

Source:

// INT GetCounterProposalResult(sender,receiver,player,type);  // like GetNewProposalResult	 
// type: 0 = science, 1 = gold, 2 = production, 3 = regard

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

	sint32 argNum = 0;
    PLAYER_INDEX sender;
    PLAYER_INDEX receiver;
	PLAYER_INDEX player;	
	sint32 type;

	if(!args->GetPlayer(argNum++, sender))
		return SFN_ERROR_TYPE_ARGS;

    if(sender < 0 || sender >= k_MAX_PLAYERS)
		return SFN_ERROR_OUT_OF_RANGE;

    if(!args->GetPlayer(argNum++, receiver))
		return SFN_ERROR_TYPE_ARGS;

    if(!args->GetPlayer(argNum++, player))
		return SFN_ERROR_TYPE_ARGS;

    if(!args->GetInt(argNum++, type))
		return SFN_ERROR_TYPE_ARGS;

    Response response=Diplomat::GetDiplomat(sender).GetMyLastResponse(receiver);

    DiplomacyResult sender_result;
	DiplomacyResult receiver_result;
	ProposalAnalysis::ComputeResult(response,sender_result, receiver_result);

    if (player==sender){
	    switch(type){
	        case 0:m_result.m_int = sender_result.science;
               return SFN_ERROR_OK;
	        case 1:m_result.m_int = sender_result.gold;
               return SFN_ERROR_OK;
            case 2:m_result.m_int = sender_result.production;
               return SFN_ERROR_OK;
            case 3:m_result.m_int = sender_result.regard;
               return SFN_ERROR_OK;
		    default:m_result.m_int = 0;
		}
	}

    if (player==receiver){
        switch(type){
	        case 0:m_result.m_int = receiver_result.science;
                return SFN_ERROR_OK;
	        case 1:m_result.m_int = receiver_result.gold;
                return SFN_ERROR_OK;
            case 2:m_result.m_int = receiver_result.production;
                return SFN_ERROR_OK;
            case 3:m_result.m_int = receiver_result.regard;
                return SFN_ERROR_OK;
		    default:m_result.m_int = 0;
		}
	}
	
	return SFN_ERROR_OK;
}

Information last updated by BureauBert on 26.06.2009

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

No user comments yet.

  Administration
This site is currently maintained by: BureauBert (Webmaster)  Maquiladora (Manager)  Legal Notice: Legal Notice Statistics: 123632 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