Check returning value
Posted: Wed Aug 13, 2014 8:46 pm
The action script for units, CHECK_UNIT_ACTION, is supposed it return a value.
To catch this value I believed a must use:
int ret;
ret = CHECK_UNIT_RESUPPLY(me, unit, tilex, tiley);
But I'm getting not the expected value:
FUNCTION UISETUP_UNIT_ACTION(me, tilex, tiley)
{
int unit;
int ret;
ret = CHECK_UNIT_RESUPPLY(me, unit, tilex, tiley);
StartString() ;
if(ret<0)
{
PrintString("IDS_TT_CANNOTRESUPPLY") ;
}
else
{
PrintString("IDS_TT_RESUPPLY") ;
}
}
I put Log just at the end of the CHECK_UNIT_ACTION:
Log ("returned", ret);
Return ret;
And I see in the log window two values: -1, 8, so which one is catching the UISETUP_UNIT_ACTION?
To catch this value I believed a must use:
int ret;
ret = CHECK_UNIT_RESUPPLY(me, unit, tilex, tiley);
But I'm getting not the expected value:
FUNCTION UISETUP_UNIT_ACTION(me, tilex, tiley)
{
int unit;
int ret;
ret = CHECK_UNIT_RESUPPLY(me, unit, tilex, tiley);
StartString() ;
if(ret<0)
{
PrintString("IDS_TT_CANNOTRESUPPLY") ;
}
else
{
PrintString("IDS_TT_RESUPPLY") ;
}
}
I put Log just at the end of the CHECK_UNIT_ACTION:
Log ("returned", ret);
Return ret;
And I see in the log window two values: -1, 8, so which one is catching the UISETUP_UNIT_ACTION?