9
3

LoginAccount.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. */
  6. #include "LoginAccount.h"
  7. LoginAccount::LoginAccount(){
  8. }
  9. LoginAccount::~LoginAccount(){
  10. vector<CharSelectProfile*>::iterator iter;
  11. for(iter = charlist.begin(); iter != charlist.end(); iter++){
  12. safe_delete(*iter);
  13. }
  14. }
  15. void LoginAccount::flushCharacters ( )
  16. {
  17. vector<CharSelectProfile*>::iterator iter;
  18. for(iter = charlist.begin(); iter != charlist.end(); iter++){
  19. safe_delete(*iter);
  20. }
  21. charlist.clear ( );
  22. }
  23. CharSelectProfile* LoginAccount::getCharacter(char* name){
  24. vector<CharSelectProfile*>::iterator char_iterator;
  25. CharSelectProfile* profile = 0;
  26. EQ2_16BitString temp;
  27. for(char_iterator = charlist.begin(); char_iterator != charlist.end(); char_iterator++){
  28. profile = *char_iterator;
  29. temp = profile->packet->getType_EQ2_16BitString_ByName("name");
  30. if(strcmp(temp.data.c_str(), name)==0)
  31. return profile;
  32. }
  33. return 0;
  34. }
  35. void LoginAccount::removeCharacter(char* name){
  36. vector<CharSelectProfile*>::iterator iter;
  37. CharSelectProfile* profile = 0;
  38. EQ2_16BitString temp;
  39. for(iter = charlist.begin(); iter != charlist.end(); iter++){
  40. profile = *iter;
  41. temp = profile->packet->getType_EQ2_16BitString_ByName("name");
  42. if(strcmp(temp.data.c_str(), name)==0){
  43. safe_delete(*iter);
  44. charlist.erase(iter);
  45. return;
  46. }
  47. }
  48. }