2007-04-26 21:11:13 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* Copyright (C) 2007 by Lothar May *
|
|
|
|
|
* *
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
/* Player data. */
|
|
|
|
|
|
|
|
|
|
#ifndef _PLAYERDATA_H_
|
|
|
|
|
#define _PLAYERDATA_H_
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <list>
|
2007-04-27 21:35:18 +00:00
|
|
|
#include <map>
|
2007-04-26 21:11:13 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
2007-05-13 22:25:59 +00:00
|
|
|
class SessionData;
|
|
|
|
|
|
2007-04-26 21:11:13 +00:00
|
|
|
enum PlayerType
|
|
|
|
|
{
|
|
|
|
|
PLAYER_TYPE_COMPUTER,
|
2007-05-20 00:16:29 +00:00
|
|
|
PLAYER_TYPE_HUMAN,
|
2007-04-26 21:11:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PlayerData
|
|
|
|
|
{
|
|
|
|
|
public:
|
2007-05-08 06:45:46 +00:00
|
|
|
PlayerData(unsigned uniqueId, int number, PlayerType type);
|
2007-04-26 21:11:13 +00:00
|
|
|
~PlayerData();
|
|
|
|
|
|
|
|
|
|
const std::string &GetName() const
|
|
|
|
|
{return m_name;}
|
|
|
|
|
void SetName(const std::string &name)
|
|
|
|
|
{m_name = name;}
|
|
|
|
|
const std::string &GetAvatarFile() const
|
|
|
|
|
{return m_avatarFile;}
|
|
|
|
|
void SetAvatarFile(const std::string &avatarFile)
|
|
|
|
|
{m_avatarFile = avatarFile;}
|
2007-05-13 22:25:59 +00:00
|
|
|
boost::shared_ptr<SessionData> GetNetSessionData()
|
|
|
|
|
{return m_netSessionData;}
|
|
|
|
|
void SetNetSessionData(boost::shared_ptr<SessionData> session)
|
|
|
|
|
{m_netSessionData = session;}
|
2007-04-26 21:11:13 +00:00
|
|
|
PlayerType GetType() const
|
|
|
|
|
{return m_type;}
|
2007-04-26 23:07:08 +00:00
|
|
|
unsigned GetUniqueId() const
|
|
|
|
|
{return m_uniqueId;}
|
2007-05-06 23:27:08 +00:00
|
|
|
int GetNumber() const
|
|
|
|
|
{return m_number;}
|
2007-05-21 19:00:06 +00:00
|
|
|
void SetNumber(int number)
|
|
|
|
|
{m_number = number;}
|
2007-04-26 21:11:13 +00:00
|
|
|
|
2007-05-08 06:45:46 +00:00
|
|
|
bool operator<(const PlayerData &other)
|
|
|
|
|
{return m_number < other.GetNumber();}
|
|
|
|
|
|
2007-04-26 21:11:13 +00:00
|
|
|
private:
|
2007-05-13 22:25:59 +00:00
|
|
|
unsigned m_uniqueId;
|
|
|
|
|
int m_number;
|
|
|
|
|
std::string m_name;
|
|
|
|
|
std::string m_avatarFile;
|
|
|
|
|
PlayerType m_type;
|
|
|
|
|
boost::shared_ptr<SessionData> m_netSessionData;
|
2007-04-26 21:11:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::list<boost::shared_ptr<PlayerData> > PlayerDataList;
|
2007-04-27 21:35:18 +00:00
|
|
|
typedef std::map<unsigned, boost::shared_ptr<PlayerData> > PlayerDataMap;
|
2007-04-26 21:11:13 +00:00
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|