mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 04:15:33 +00:00
[Server] Use lowCamelCase in Cell
This commit is contained in:
parent
08f78e21c1
commit
bbc062de62
3 changed files with 29 additions and 29 deletions
|
@ -9,7 +9,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
void Cell::AddPlayer(Player *player)
|
||||
void Cell::addPlayer(Player *player)
|
||||
{
|
||||
auto it = find(player->cells.begin(), player->cells.end(), this);
|
||||
if(it == player->cells.end())
|
||||
|
@ -17,7 +17,7 @@ void Cell::AddPlayer(Player *player)
|
|||
players.push_back(player);
|
||||
}
|
||||
|
||||
void Cell::RemovePlayer(Player *player)
|
||||
void Cell::removePlayer(Player *player)
|
||||
{
|
||||
for(Iterator it = players.begin(); it != players.end(); it++)
|
||||
{
|
||||
|
@ -51,24 +51,24 @@ CellController::~CellController()
|
|||
|
||||
CellController *CellController::sThis = nullptr;
|
||||
|
||||
void CellController::Create()
|
||||
void CellController::create()
|
||||
{
|
||||
sThis = new CellController;
|
||||
}
|
||||
|
||||
void CellController::Destroy()
|
||||
void CellController::destroy()
|
||||
{
|
||||
assert(sThis);
|
||||
delete sThis;
|
||||
sThis = nullptr;
|
||||
}
|
||||
|
||||
CellController *CellController::Get()
|
||||
CellController *CellController::get()
|
||||
{
|
||||
return sThis;
|
||||
}
|
||||
|
||||
Cell *CellController::GetCellByXY(int x, int y)
|
||||
Cell *CellController::getCellByXY(int x, int y)
|
||||
{
|
||||
auto it = find_if(cells.begin(), cells.end(), [x, y](const Cell *c) {
|
||||
return c->cell.mData.mX == x && c->cell.mData.mY == y;
|
||||
|
@ -78,7 +78,7 @@ Cell *CellController::GetCellByXY(int x, int y)
|
|||
return *it;
|
||||
}
|
||||
|
||||
Cell *CellController::GetCellByID(std::string cellid)
|
||||
Cell *CellController::getCellByID(std::string cellid)
|
||||
{
|
||||
auto it = find_if(cells.begin(), cells.end(), [cellid](const Cell *c) {
|
||||
return c->cell.mName == cellid;
|
||||
|
@ -88,7 +88,7 @@ Cell *CellController::GetCellByID(std::string cellid)
|
|||
return *it;
|
||||
}
|
||||
|
||||
Cell *CellController::AddCell(ESM::Cell cellData)
|
||||
Cell *CellController::addCell(ESM::Cell cellData)
|
||||
{
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Loaded cells: %d", cells.size());
|
||||
|
@ -110,7 +110,7 @@ Cell *CellController::AddCell(ESM::Cell cellData)
|
|||
|
||||
}
|
||||
|
||||
void CellController::RemoveCell(Cell *cell)
|
||||
void CellController::removeCell(Cell *cell)
|
||||
{
|
||||
if(cell == nullptr)
|
||||
return;
|
||||
|
@ -126,10 +126,10 @@ void CellController::RemoveCell(Cell *cell)
|
|||
}
|
||||
}
|
||||
|
||||
void CellController::RemovePlayer(Cell *cell, Player *player)
|
||||
void CellController::removePlayer(Cell *cell, Player *player)
|
||||
{
|
||||
|
||||
cell->RemovePlayer(player);
|
||||
cell->removePlayer(player);
|
||||
|
||||
if(cell->players.empty())
|
||||
{
|
||||
|
@ -145,20 +145,20 @@ void CellController::update(Player *player)
|
|||
{
|
||||
if(cell.type == mwmp::CellState::LOAD)
|
||||
{
|
||||
Cell *c = AddCell(cell.cell);
|
||||
c->AddPlayer(player);
|
||||
Cell *c = addCell(cell.cell);
|
||||
c->addPlayer(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Unload cell: %d %d %s", cell.cell.mData.mX, cell.cell.mData.mY, cell.cell.mName.c_str());
|
||||
Cell *c;
|
||||
if(!cell.cell.isExterior())
|
||||
c = GetCellByID(cell.cell.mName);
|
||||
c = getCellByID(cell.cell.mName);
|
||||
else
|
||||
c = GetCellByXY(cell.cell.getGridX(), cell.cell.getGridY());
|
||||
c = getCellByXY(cell.cell.getGridX(), cell.cell.getGridY());
|
||||
|
||||
if(c != nullptr)
|
||||
RemovePlayer(c, player);
|
||||
removePlayer(c, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,20 +21,20 @@ private:
|
|||
|
||||
CellController(CellController&); // not used
|
||||
public:
|
||||
static void Create();
|
||||
static void Destroy();
|
||||
static CellController *Get();
|
||||
static void create();
|
||||
static void destroy();
|
||||
static CellController *get();
|
||||
public:
|
||||
typedef std::deque<Cell*> TContainer;
|
||||
typedef TContainer::iterator TIter;
|
||||
|
||||
Cell * AddCell(ESM::Cell cell);
|
||||
void RemoveCell(Cell *);
|
||||
Cell * addCell(ESM::Cell cell);
|
||||
void removeCell(Cell *);
|
||||
|
||||
void RemovePlayer(Cell *cell, Player *player);
|
||||
void removePlayer(Cell *cell, Player *player);
|
||||
|
||||
Cell *GetCellByXY(int x, int y);
|
||||
Cell *GetCellByID(std::string cellid);
|
||||
Cell *getCellByXY(int x, int y);
|
||||
Cell *getCellByID(std::string cellid);
|
||||
|
||||
void update(Player *player);
|
||||
|
||||
|
@ -51,8 +51,8 @@ public:
|
|||
typedef std::deque<Player*> TPlayers;
|
||||
typedef TPlayers::iterator Iterator;
|
||||
|
||||
void AddPlayer(Player *player);
|
||||
void RemovePlayer(Player *player);
|
||||
void addPlayer(Player *player);
|
||||
void removePlayer(Player *player);
|
||||
|
||||
TPlayers getPlayers();
|
||||
private:
|
||||
|
|
|
@ -30,7 +30,7 @@ Networking::Networking(RakNet::RakPeerInterface *peer)
|
|||
this->peer = peer;
|
||||
players = Players::getPlayers();
|
||||
|
||||
CellController::Create();
|
||||
CellController::create();
|
||||
|
||||
playerController = new PlayerPacketController(peer);
|
||||
worldController = new WorldPacketController(peer);
|
||||
|
@ -49,7 +49,7 @@ Networking::~Networking()
|
|||
{
|
||||
Script::Call<Script::CallbackIdentity("OnServerExit")>(false);
|
||||
|
||||
CellController::Destroy();
|
||||
CellController::destroy();
|
||||
|
||||
sThis = 0;
|
||||
delete playerController;
|
||||
|
@ -185,7 +185,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
myPacket->Read(player);
|
||||
|
||||
CellController::Get()->update(player);
|
||||
CellController::get()->update(player);
|
||||
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerCellState")>(player->getId());
|
||||
|
||||
|
|
Loading…
Reference in a new issue