From: Keith F. <ven...@us...> - 2006-04-17 05:49:07
|
Update of /cvsroot/planeshift/planeshift/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24486/src/client/gui Modified Files: pawscharpick.cpp Log Message: - Implemented a timed cache for objects which are expensive to create and sometimes reused. It is part of CacheManager. - Updated account login, char list sending, psCharacter and another CharacterList object to use the timed cache. Now disconnect/reconnect attempts or failed password attempts will not hit the database again. Objects are deleted after two minutes of inactivity. - Rewrote and restructured how the initial character list is sent to the client. Now all characters go as a single message instead of the PAWS window counting how many it has received and not enabling the buttons until all are received. - Took out leftover printfs from tutorial and prox triggers, which are bogging down the server on laanx. Index: pawscharpick.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/pawscharpick.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** pawscharpick.cpp 22 Feb 2006 22:19:42 -0000 1.56 --- pawscharpick.cpp 17 Apr 2006 05:49:00 -0000 1.57 *************** *** 67,71 **** if(msgHandler) { ! msgHandler->Unsubscribe( this, MSGTYPE_CHARACTERDATA ); msgHandler->Unsubscribe( this, MSGTYPE_CHAR_DELETE ); } --- 67,71 ---- if(msgHandler) { ! msgHandler->Unsubscribe( this, MSGTYPE_AUTHAPPROVED ); msgHandler->Unsubscribe( this, MSGTYPE_CHAR_DELETE ); } *************** *** 79,84 **** // Subscribe our message types that we are interested in. ! if ( !msgHandler->Subscribe( this, MSGTYPE_CHARACTERDATA ) ) return false; ! if ( !msgHandler->Subscribe( this, MSGTYPE_CHAR_DELETE ) ) return false; view = (pawsObjectView*)FindWidget("PaperDollView"); --- 79,84 ---- // Subscribe our message types that we are interested in. ! msgHandler->Subscribe(this,MSGTYPE_AUTHAPPROVED); ! msgHandler->Subscribe( this, MSGTYPE_CHAR_DELETE ); view = (pawsObjectView*)FindWidget("PaperDollView"); *************** *** 96,130 **** // Incomming character description. At the moment it is just the // character name and the factory of the mesh. ! case MSGTYPE_CHARACTERDATA: { ! // Set the name of the character in the right button. ! char buff[100]; ! sprintf(buff, "SelectCharacter%d", charactersFound ); ! pawsButton* button = (pawsButton*)FindWidget( buff ); ! csString name( me->GetStr() ); ! button->SetText( name ); ! button->Show(); ! sprintf(buff, "ImgCharacter%d", charactersFound ); ! pawsWidget* radio = FindWidget(buff); ! radio->Show(); ! ! csString race ( me->GetStr() ); ! csString factName ( me->GetStr() ); ! csString traits ( me->GetStr() ); ! csString equipment( me->GetStr() ); ! ! char fileName[100]; ! ! // Store the factory name and file name for the mesh ! sprintf( fileName, "/planeshift/models/%s/%s.cal3d", factName.GetData(),factName.GetData() ); ! ! models[charactersFound].fileName = fileName; ! models[charactersFound].factName = factName; ! models[charactersFound].race = race; ! models[charactersFound].traits = traits; ! models[charactersFound].equipment = equipment; ! charactersFound++; ! ! SelectCharacter(0,FindWidget("SelectCharacter0")); // If we have all the chars we have then turn on the rest of the --- 96,134 ---- // Incomming character description. At the moment it is just the // character name and the factory of the mesh. ! case MSGTYPE_AUTHAPPROVED: { ! psAuthApprovedMessage msg(me); ! ! for (int i=0; i < msg.msgNumOfChars; i++) ! { ! csString name,race,factName,traits,equipment; ! ! msg.GetCharacter(me,name,race,factName, traits,equipment); ! ! // Set the name of the character in the right button. ! char buff[100]; ! sprintf(buff, "SelectCharacter%d", charactersFound ); ! pawsButton* button = (pawsButton*)FindWidget( buff ); ! button->SetText( name ); ! button->Show(); ! sprintf(buff, "ImgCharacter%d", charactersFound ); ! pawsWidget* radio = FindWidget(buff); ! radio->Show(); ! ! ! char fileName[100]; ! ! // Store the factory name and file name for the mesh ! sprintf( fileName, "/planeshift/models/%s/%s.cal3d", factName.GetData(),factName.GetData() ); ! ! models[charactersFound].fileName = fileName; ! models[charactersFound].factName = factName; ! models[charactersFound].race = race; ! models[charactersFound].traits = traits; ! models[charactersFound].equipment = equipment; ! charactersFound++; ! ! SelectCharacter(0,FindWidget("SelectCharacter0")); ! } // If we have all the chars we have then turn on the rest of the *************** *** 150,156 **** // If there's some char created then show delete option pawsWidget* deleteCharBut = FindWidget("delete"); ! if (deleteCharBut) deleteCharBut->Show(); } - return; } --- 154,160 ---- // If there's some char created then show delete option pawsWidget* deleteCharBut = FindWidget("delete"); ! if (deleteCharBut) ! deleteCharBut->Show(); } return; } |