PlayerCreator.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:1k
源码类别:

模拟服务器

开发平台:

C/C++

  1. #ifndef CPlayerCreatorH
  2. #define CPlayerCreatorH
  3. #include "S3DBInterface.h"
  4. #include <map>
  5. #include <vector>
  6. #ifndef NAME_LEN
  7. #define NAME_LEN 32
  8. #endif
  9. class CPlayerCreator
  10. {
  11. public:
  12. #define MAX_PLAYERTYPE_VALUE 10
  13. #define MAX_NEWPLAYER_BUFFER 5000
  14. #define PLAYERCREATOR_FILE "settings\player\newplayerini%02d.ini"
  15. #define REVIVALID_FILENAME "settings\player\revivalid.ini"
  16. typedef struct tagRoleGeneratorParam
  17. {
  18. char szAccName[NAME_LEN];
  19. char szName[NAME_LEN];
  20. int nSeries;
  21. int nSex;
  22. int nMapID;
  23. } ROLEPARAM, NEAR *PROLEPARAM, FAR *LPROLEPARAM;
  24. private:
  25. BYTE* m_pRoleData[MAX_PLAYERTYPE_VALUE];
  26. typedef std::vector< unsigned > stdRevivalID;
  27. typedef std::map< size_t, stdRevivalID > stdMapID2RID;
  28. stdMapID2RID m_theMapID2RID;
  29. public:
  30. CPlayerCreator();
  31. ~CPlayerCreator();
  32. enum enumSearchType
  33. {
  34. enumRandom
  35. };
  36. const TRoleData* GetRoleData( unsigned int &uDataLength, LPROLEPARAM lpParam );
  37. unsigned GetRevivalID( size_t nMapID, UINT nType = enumRandom );
  38. private:
  39. bool Init();
  40. bool GetRoleDataFromIni( BYTE* pData, const char* szFileName );
  41. };
  42. #endif