From: Andrew C. <ac...@us...> - 2003-11-03 00:26:16
|
Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1:/tmp/cvs-serv4348/src/server Modified Files: creationmanager.cpp creationmanager.h Log Message: Started work on the life events for character creation. Added new table for this. Index: creationmanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/creationmanager.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** creationmanager.cpp 21 Oct 2003 00:29:27 -0000 1.10 --- creationmanager.cpp 3 Nov 2003 00:26:12 -0000 1.11 *************** *** 51,55 **** { ! if ( !(LoadCPValues() && LoadCreationChoices()) ) return false; --- 51,57 ---- { ! if ( !( LoadCPValues() && ! LoadCreationChoices() && ! LoadLifeEvents()) ) return false; *************** *** 128,133 **** } ! bool psCharCreationManager::LoadCreationChoices() ! { Result result( db->Select("SELECT * from character_creation") ); --- 130,168 ---- } ! bool psCharCreationManager::LoadLifeEvents() ! { ! Result events( db->Select("SELECT * from char_create_life") ); ! ! if ( events.Count() == 0 ) ! return false; ! ! for ( unsigned int x = 0; x < events.Count(); x++ ) ! { ! LifeEventChoice* choice = new LifeEventChoice; ! choice->id = events[x].GetInt(0); ! choice->name = events[x][1]; ! choice->description = events[x][2]; ! choice->common = events[x].GetInt(3); ! ! Result adds( db->Select("SELECT adds_choice from char_create_life_relations WHERE adds_choice IS NOT NULL AND choice=%d", choice->id) ); ! for ( int addIndex = 0; addIndex < adds.Count(); addIndex++ ) ! { ! choice->adds.Push( adds[addIndex].GetInt(0) ); ! } ! ! Result removes( db->Select("SELECT removes_choice from char_create_life_relations WHERE removes_choice IS NOT NULL AND choice=%d", choice->id) ); ! for ( int removesIndex = 0; removesIndex < removes.Count(); removesIndex++ ) ! { ! choice->removes.Push( removes[removesIndex].GetInt(0) ); ! } ! ! lifeEvents.Push( choice ); ! } ! ! return true; ! } ! ! bool psCharCreationManager::LoadCreationChoices() ! { Result result( db->Select("SELECT * from character_creation") ); *************** *** 171,175 **** return true; ! } --- 206,210 ---- return true; ! } Index: creationmanager.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/creationmanager.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** creationmanager.h 10 Oct 2003 22:54:36 -0000 1.5 --- creationmanager.h 3 Nov 2003 00:26:12 -0000 1.6 *************** *** 54,58 **** }; //////////////////////////////////////////////////// ! public: --- 54,72 ---- }; //////////////////////////////////////////////////// ! ! ////////////////////////////////////////////////////// ! // Structure for cached character creation life event ! ////////////////////////////////////////////////////// ! struct LifeEventChoice ! { ! int id; // ID in database ! csString name; // Name of the event ! csString description; // Description of the event ! csArray<int> adds; // List of choices that this events adds. ! csArray<int> removes; // List of choices that this event removes. ! int common; // Is this a generic available event. ! }; ! ////////////////////////////////////////////////////// ! public: *************** *** 79,82 **** --- 93,98 ---- bool LoadCreationChoices(); + bool LoadLifeEvents(); + csRef<MsgHandler> msgHandler; RaceCP* raceCPValues; *************** *** 85,88 **** --- 101,105 ---- csArray<CreationChoice*> parentData; csPDelArray<CreationChoice> childhoodData; + csPDelArray<LifeEventChoice> lifeEvents; /** Takes a string name of a choice and converts it to it's enum value. |