Code: Select all
bool MQ2TimerType::GETMETHOD()
{
#define pPtr ((PMQTIMER)VarPtr.Ptr)
if (!VarPtr.Ptr)
return false;
PMQ2TYPEMETHOD pMethod=MQ2TimerType::FindMethod(Method);
if (!pMethod)
{
return false;
}
switch((TimerMethods)pMethod->ID)
{
case Reset:
pPtr->Current=pPtr->Original;
return true;
case Expire:
pPtr->Current=1; // Will expire in a 10th of a second
return true;
case Set:
if (argc)
{
MQ2TimerType::FromString(VarPtr,argv[0]);
return true;
}
}
return false;
#undef pPtr
}
Code: Select all
static enum TimerMembers
{
Value=1,
OriginalValue=2,
};
static enum TimerMethods
{
Reset=1,
Expire=2,
Set=3,
};
MQ2TimerType():MQ2Type("timer")
{
TypeMember(Value);
TypeMember(OriginalValue);
TypeMethod(Reset);
TypeMethod(Expire);
TypeMethod(Set);
}