From: Jarda B. <edh...@us...> - 2004-08-29 21:25:49
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8325/plugins/Core Modified Files: Spellbook.h Spellbook.cpp Log Message: Implemented spell access fns in Spellbook, added corresponding functions to GUIScript Index: Spellbook.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Spellbook.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Spellbook.h 20 Jul 2004 22:32:10 -0000 1.5 --- Spellbook.h 29 Aug 2004 21:25:36 -0000 1.6 *************** *** 43,46 **** --- 43,47 ---- const int NUM_SPELL_TYPES = 3; + // !!! Keep these synchronized with GUIDefines.py !!! typedef enum ieSpellType { IE_SPELL_TYPE_PRIEST = 0, *************** *** 96,101 **** //int AddMemorizedSpell(CREMemorizedSpell* spell); ! int GetKnownSpellsCount(int type, int level); ! int GetMemorizedSpellsCount(int type, int level); //int GetKnownSpellsCountOnLevel( int level ); --- 97,105 ---- //int AddMemorizedSpell(CREMemorizedSpell* spell); ! unsigned int GetKnownSpellsCount(int type, int level); ! CREKnownSpell* GetKnownSpell(int type, int level, int index); ! unsigned int GetMemorizedSpellsCount(int type, int level); ! CREMemorizedSpell* GetMemorizedSpell(int type, int level, int index); ! //int GetKnownSpellsCountOnLevel( int level ); Index: Spellbook.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Spellbook.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Spellbook.cpp 22 Aug 2004 23:19:04 -0000 1.12 --- Spellbook.cpp 29 Aug 2004 21:25:36 -0000 1.13 *************** *** 96,99 **** --- 96,127 ---- } + unsigned int Spellbook::GetKnownSpellsCount(int type, int level) + { + if (type >= NUM_SPELL_TYPES || level >= spells[type].size()) + return 0; + return spells[type][level]->known_spells.size(); + } + + CREKnownSpell* Spellbook::GetKnownSpell(int type, int level, int index) + { + if (type >= NUM_SPELL_TYPES || level >= spells[type].size() || index >= spells[type][level]->known_spells.size()) + return NULL; + return spells[type][level]->known_spells[index]; + } + + unsigned int Spellbook::GetMemorizedSpellsCount(int type, int level) + { + if (type >= NUM_SPELL_TYPES || level >= spells[type].size()) + return 0; + return spells[type][level]->memorized_spells.size(); + } + + CREMemorizedSpell* Spellbook::GetMemorizedSpell(int type, int level, int index) + { + if (type >= NUM_SPELL_TYPES || level >= spells[type].size() || index >= spells[type][level]->memorized_spells.size()) + return NULL; + return spells[type][level]->memorized_spells[index]; + } + bool Spellbook::AddSpellMemorization(CRESpellMemorization* sm) { |