igrik,
Algor, поскольку функции уже давно могут проверять синтаксис, с которым передали параметр, то есть возможность реализовать ЕРМ-подобные команды, пусть и в ограниченном виде.
Code:
[+] Added possibility to query syntax, that was used for particular function parameter.
!!FU:S#1/?$2;
#1 - argument index
?$2 - syntax type (0 - get, 1 - set, 2 - add)
Add syntax is applied via 'd' prefix like FU:Pd200.
Using this receiver scriptmakers can write functions which act the same as normal ERM commands.
For instance, one function to get/set/add dwelling population amount.
Скажем, если передали -200, вы установите -200 значение. А если d-200, то вычтите 200 из значения.
Пример из библиотеки Эры:
Archer30, the crash is in ReceiveCreatures function. TUM uses Amethyst, so it's majaczek issue, I suppose:
Code:
void ReceiveCreatures(int len,Byte *buf)
{
#include "templ.h"
int i,j,k,num;
num=len/sizeof(_CrState_);
if(len!=(int)(num*sizeof(_CrState_))){ MError("Wrong length of sent Modified Creatures"); RETURNV };
if((num<0)||(num>MONNUM)){ MError("Incorrect number of Modified Creature"); RETURNV }
for(i=0;i<len;i++) ((Byte *)CrState)[i]=buf[i];
for(j=0;j<num;j++){
i=CrState[j].Index;
if((i<0)||(i>MONNUM)){ MError("Incorrect index of Modified Creature"); RETURNV }
MonTable[i].Group=CrState[j].Group;
MonTable[i].SubGroup=CrState[j].SubGroup; // CRASH
MonTable[i].Flags=CrState[j].Flags;
for(k=0;k<7;k++) MonTable[i].CostRes[k]=CrState[j].CostRes[k];
MonTable[i].Fight=CrState[j].Fight;
MonTable[i].AIvalue=CrState[j].AIvalue;
MonTable[i].Grow=CrState[j].Grow;
MonTable[i].HGrow=CrState[j].HGrow;
MonTable[i].HitPoints=CrState[j].HitPoints;
MonTable[i].Speed=CrState[j].Speed;
MonTable[i].Attack=CrState[j].Attack;
MonTable[i].Defence=CrState[j].Defence;
MonTable[i].DamageL=CrState[j].DamageL;
MonTable[i].DamageH=CrState[j].DamageH;
MonTable[i].NShots=CrState[j].NShots;
MonTable[i].HasSpell=CrState[j].HasSpell;
MonTable[i].AdvMapL=CrState[j].AdvMapL;
MonTable[i].AdvMapH=CrState[j].AdvMapH;
}
RETURNV
}