bool PDefScripts::LoadFromDef( PTokenList *Tokens ) { int Idx = 0; for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ ) { switch ( Idx ) { case 0 : // setentry continue; case 1 : // index mIndex = atoi(i->c_str()); break; case 2 : mIdentifier = *i; CleanUpString(&mIdentifier); break; case 3 : mLuaFile = *i; CleanUpString(&mLuaFile); break; case 4 : mScriptHeader = *i; CleanUpString(&mScriptHeader); break; continue; } } return true; }
bool PDefCharAction::LoadFromDef( PTokenList *Tokens ) { int Idx = 0; int maxFields = 2; for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ ) { switch ( Idx ) { case 0 : // setentry break; case 1 : mIndex = atoi( i->c_str() ); break; case 2 : { mNumOfSsq = atoi( i->c_str() ); if ( mNumOfSsq > 8 ) mNumOfSsq = 8; maxFields = 2 + 2 * mNumOfSsq; break; } default : if (( Idx >= 3 ) && ( Idx <= maxFields ) ) { if ( Idx & 1 ) { mSsqId[( Idx - 3 ) / 2] = atoi( i->c_str() ); } else { mModFactor[( Idx - 3 ) / 2] = atof( i->c_str() ); } } break; } if ( Idx >= maxFields ) break; } return (( Idx == maxFields ) ); }
bool PDefShot::LoadFromDef( PTokenList *Tokens ) { int Idx = 0; for ( PTokenList::iterator i = Tokens->begin(); i != Tokens->end(); i++, Idx++ ) { switch ( Idx ) { case 0 : // setentry break; case 1 : mIndex = atoi( i->c_str() ); break; case 2 : mDamageId = atoi( i->c_str() ); break; case 3 : mMass = atoi( i->c_str() ); break; case 4 : mRadius = atoi( i->c_str() ); break; case 5 : mSpeed = atof( i->c_str() ); break; default : break; } if ( Idx >= 5 ) break; } return (( Idx >= 5 ) ); }