From: Laszlo T. <ave...@us...> - 2004-08-30 21:37:00
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/CREImporter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32645 Modified Files: CREImp.cpp Log Message: using malloc/free instead of vectors in CREImporter Index: CREImp.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/CREImporter/CREImp.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** CREImp.cpp 25 Aug 2004 12:44:08 -0000 1.44 --- CREImp.cpp 30 Aug 2004 21:36:51 -0000 1.45 *************** *** 419,433 **** // Reading spellbook ! std::vector<CREKnownSpell*> known_spells; ! std::vector<CREMemorizedSpell*> memorized_spells; str->Seek( act->KnownSpellsOffset, GEM_STREAM_START ); for (i = 0; i < act->KnownSpellsCount; i++) { ! known_spells.push_back( GetKnownSpell() ); } str->Seek( act->MemorizedSpellsOffset, GEM_STREAM_START ); for (i = 0; i < act->MemorizedSpellsCount; i++) { ! memorized_spells.push_back( GetMemorizedSpell() ); } --- 419,433 ---- // Reading spellbook ! CREKnownSpell **known_spells=(CREKnownSpell **) calloc(act->KnownSpellsCount, sizeof(CREKnownSpell *) ); ! CREMemorizedSpell **memorized_spells=(CREMemorizedSpell **) calloc(act->KnownSpellsCount, sizeof(CREKnownSpell *) ); str->Seek( act->KnownSpellsOffset, GEM_STREAM_START ); for (i = 0; i < act->KnownSpellsCount; i++) { ! known_spells[i]=GetKnownSpell(); } str->Seek( act->MemorizedSpellsOffset, GEM_STREAM_START ); for (i = 0; i < act->MemorizedSpellsCount; i++) { ! memorized_spells[i]=GetMemorizedSpell(); } *************** *** 436,440 **** CRESpellMemorization* sm = GetSpellMemorization(); ! unsigned int j=known_spells.size(); while(j--) { CREKnownSpell* spl = known_spells[j]; --- 436,440 ---- CRESpellMemorization* sm = GetSpellMemorization(); ! unsigned int j=act->KnownSpellsCount; while(j--) { CREKnownSpell* spl = known_spells[j]; *************** *** 454,458 **** } ! i=known_spells.size(); while(i--) { if(known_spells[i]) { --- 454,458 ---- } ! i=act->KnownSpellsCount; while(i--) { if(known_spells[i]) { *************** *** 461,465 **** } } ! i=memorized_spells.size(); while(i--) { if(memorized_spells[i]) { --- 461,467 ---- } } ! free(known_spells); ! ! i=act->MemorizedSpellsCount; while(i--) { if(memorized_spells[i]) { *************** *** 468,472 **** } } ! // act->spellbook.dump(); act->Init(); //applies effects, updates Modified --- 470,474 ---- } } ! free(memorized_spells); act->Init(); //applies effects, updates Modified |