static void forstat (LexState *ls, int line) { /* forstat -> FOR (fornum | forlist) END */ FuncState *fs = GetCurrentFuncState( ls ); TString *varname; BlockCnt bl; enterblock(fs, &bl, 1); /* scope for loop and control variables */ luaX_next(ls); /* skip `for' */ varname = str_checkname(ls); /* first variable name */ switch (ls->t.token) { case '=': fornum(ls, varname, line); break; case ',': case TK_IN: forlist(ls, varname); break; default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); break; } check_match(ls, TK_END, TK_FOR, line); leaveblock(fs); /* loop scope (`break' jumps to this point) */ }
static void forstat (LexState *ls, int line) { /* forstat -> fornum | forlist */ FuncState *fs = ls->fs; TString *varname; BlockCnt bl; enterblock(fs, &bl, 0); /* block to control variable scope */ next(ls); /* skip `for' */ varname = str_checkname(ls); /* first variable name */ switch (ls->t.token) { case '=': fornum(ls, varname, line); break; case ',': case TK_IN: forlist(ls, varname); break; default: luaX_syntaxerror(ls, "`=' or `in' expected"); } check_match(ls, TK_END, TK_FOR, line); leaveblock(fs); }
void Faction::Writeout(Aoutfile *f) { f->PutInt(num); for (int i=0; i<NFACTYPES; i++) f->PutInt(type[i]); f->PutInt(lastchange); f->PutInt(lastorders); f->PutInt(unclaimed); f->PutStr(*name); f->PutStr(*address); f->PutStr(*password); f->PutInt(times); f->PutInt(showunitattitudes); f->PutInt(temformat); skills.Writeout(f); items.Writeout(f); f->PutInt(defaultattitude); f->PutInt(attitudes.Num()); forlist((&attitudes)) ((Attitude *) elem)->Writeout(f); }
void Object::Writeout(Aoutfile *f) { f->PutInt(num); if (IsFleet()) f->PutStr(ObjectDefs[O_FLEET].name); else if (type != -1) f->PutStr(ObjectDefs[type].name); else f->PutStr("NO_OBJECT"); f->PutInt(incomplete); f->PutStr(*name); if (describe) { f->PutStr(*describe); } else { f->PutStr("none"); } f->PutInt(inner); if (Globals->PREVENT_SAIL_THROUGH && !Globals->ALLOW_TRIVIAL_PORTAGE) f->PutInt(prevdir); else f->PutInt(-1); f->PutInt(runes); f->PutInt(units.Num()); forlist ((&units)) ((Unit *) elem)->Writeout(f); WriteoutFleet(f); }
void Object::Writeout(Aoutfile *f) { f->PutInt(num); if (type != -1) f->PutStr(ObjectDefs[type].name); else f->PutStr("NO_OBJECT"); f->PutInt(incomplete); f->PutStr(*name); if (describe) { f->PutStr(*describe); } else { f->PutStr("none"); } f->PutInt(inner); if(type == O_ESEAPORTAL) f->PutInt(mageowner); f->PutInt(hexside); /* Hexside Patch 030825 BS */ if (Globals->PREVENT_SAIL_THROUGH && !Globals->ALLOW_TRIVIAL_PORTAGE) f->PutInt(prevdir); else f->PutInt(-1); f->PutInt(runes); f->PutInt(units.Num()); forlist ((&units)) ((Unit *) elem)->Writeout(f); }