//----------------------------------------------------------------------------- void evaltime(unsigned char *str, struct tm *time) { time->tm_hour = evalint(str , 1); time->tm_min = evalint(str + 1, 1); time->tm_sec = evalint(str + 2, 1); mktime(time); }
//----------------------------------------------------------------------------- void evaldate(unsigned char *str, struct tm *date) { date->tm_mday = evalint(str , 1); date->tm_mon = evalint(str + 1, 1) - 1; date->tm_year = evalint(str + 2, 1) + 100; mktime(date); }
static void applyMOD(void) { Integer x = evalint(getN(1), template_mod->value); Integer y = evalint(getN(2), template_mod->value); if(y==0) makeconstant(ERROR, template_mod->value); else makeINT(x%y); }
static void applyDIV(void) { Integer x = evalint(getN(1), template_div->value); Integer y = evalint(getN(2), template_div->value); if(y==0) makeconstant(ERROR, template_div->value); else makeINT(x/y); }
number WEAPONINDEX_THOMPSON projectile "thompsonbullet" numprojectiles 1 speed 0 } //end weaponinfo //=========================================================================== // Flamethrower //=========================================================================== projectileinfo //for Flamethrower { name "fuel" damage 9999 // take into account flames last longer radius 500 damagetype $evalint(DAMAGETYPE_IMPACT|DAMAGETYPE_RADIAL) } weaponinfo //Flamethrower { name "Flamethrower" number WEAPONINDEX_FLAMETHROWER projectile "fuel" numprojectiles 1 speed 700 } //end weaponinfo //=========================================================================== // Panzerfaust //===========================================================================
int input() { CHAR *p; ival i = 0; value *l; int c; char vty; int (*infunc)(void); int firsttime=0; int noerr; int frfile = 0; STR st = NULL; infunc = in1line; c=getch(); if(c=='"'){ p=line; while(*point && *point != '"'){ *p++ = *point++; i++; } if(*point) point++; if(getch()!=';') error(SYNTAX); *p=0; firsttime++; } else if(c=='#'){ i=evalint(); if(getch()!=',') error(SYNTAX); _curinfile = getf(i, _READ); infunc = in1file; frfile = 1; } else point--; l= (value *)getname(0); vty=vartype; for(;;){ if(!frfile){ if(!firsttime){ *line='?'; i=1; } firsttime=0; VOID edit(i,i,(ival)0); if(trapped){ point=savepoint; /* restore point to start of in. */ return(-1); /* will trap at start of this in. */ } in1iline = line + i; } do { /* ignore leading spaces */ while( (c = (*infunc)()) == ' '); if(!c && vty != SVAL) continue; pushback = c; if(vty == SVAL){ st = ALLOC_STR( (ival)LOC_BUF_SIZ); noerr = getstrdt(infunc, st); } else noerr = getdata(infunc); if(noerr) while( (c = (*infunc)()) == ' '); if(!noerr || (c && c != ',')){ if(vty == SVAL && st != NULL) FREE_STR(st); if(frfile) error(26); prints("Bad data redo\n"); break; } if(vty == SVAL) stringassign( (stringp)l, curentry, st, 0); else putin(l, (int)vty); if(getch()!=','){ point--; normret; } l= (value *)getname(0); vty=vartype; } while(c); } }