1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 23:49:55 +00:00
openmw-tes3mp/apps/openmw-mp/Cell.hpp

77 lines
1.5 KiB
C++
Raw Normal View History

2017-02-19 05:26:42 +00:00
//
// Created by koncord on 18.02.17.
//
#ifndef OPENMW_CELL_HPP
#define OPENMW_CELL_HPP
#include <deque>
#include <string>
#include <components/esm/records.hpp>
#include <components/openmw-mp/Base/BaseEvent.hpp>
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
2017-02-19 05:26:42 +00:00
class Player;
class Cell;
class CellController
{
private:
CellController();
~CellController();
CellController(CellController&); // not used
public:
2017-02-19 08:07:44 +00:00
static void create();
static void destroy();
static CellController *get();
2017-02-19 05:26:42 +00:00
public:
typedef std::deque<Cell*> TContainer;
typedef TContainer::iterator TIter;
2017-02-19 08:07:44 +00:00
Cell * addCell(ESM::Cell cell);
void removeCell(Cell *);
2017-02-19 05:26:42 +00:00
2017-02-19 08:07:44 +00:00
void removePlayer(Cell *cell, Player *player);
void deletePlayer(Player *player);
2017-02-19 05:26:42 +00:00
Cell *getCell(ESM::Cell *esmCell);
2017-02-19 08:07:44 +00:00
Cell *getCellByXY(int x, int y);
Cell *getCellByName(std::string cellName);
2017-02-19 05:26:42 +00:00
void update(Player *player);
private:
static CellController *sThis;
TContainer cells;
};
class Cell
{
friend class CellController;
public:
Cell(ESM::Cell cell);
typedef std::deque<Player*> TPlayers;
2017-02-22 04:03:03 +00:00
typedef TPlayers::const_iterator Iterator;
Iterator begin() const;
Iterator end() const;
2017-02-19 05:26:42 +00:00
2017-02-19 08:07:44 +00:00
void addPlayer(Player *player);
void removePlayer(Player *player);
2017-02-19 05:26:42 +00:00
TPlayers getPlayers() const;
void sendToLoaded(mwmp::WorldPacket *worldPacket, mwmp::BaseEvent *baseEvent) const;
std::string getDescription() const;
2017-02-19 05:26:42 +00:00
private:
TPlayers players;
ESM::Cell cell;
};
#endif //OPENMW_CELL_HPP