|
@@ -7,6 +7,7 @@
|
|
|
#include "AsynchronCall.h"
|
|
|
#include "Entity.h"
|
|
|
#include "AddEntityUpdate.h"
|
|
|
+#include "EntityRemovedUpdate.h"
|
|
|
|
|
|
using namespace Framework;
|
|
|
|
|
@@ -307,11 +308,15 @@ void Game::thread()
|
|
|
{
|
|
|
if (!player->isOnline())
|
|
|
{
|
|
|
+ std::cout << "player " << player->zEntity()->getName() << " disconnected.\n";
|
|
|
Datei pFile;
|
|
|
pFile.setDatei(path + "/player/" + player->zEntity()->getName());
|
|
|
+ pFile.erstellen();
|
|
|
if (pFile.open(Datei::Style::schreiben))
|
|
|
PlayerEntityType::INSTANCE->saveEntity(player->zEntity(), &pFile);
|
|
|
+ pFile.close();
|
|
|
removed.add(index, 0);
|
|
|
+ this->requestWorldUpdate(new EntityRemovedUpdate(player->zEntity()->getId(), player->zEntity()->getCurrentDimensionId(), player->zEntity()->getPosition()));
|
|
|
}
|
|
|
index++;
|
|
|
}
|
|
@@ -345,7 +350,7 @@ void Game::thread()
|
|
|
if (tickCounter >= 1000)
|
|
|
{
|
|
|
std::cout << "Average Tick time: " << (totalTickTime / 1000) << "\n";
|
|
|
- if ((totalTickTime / 1000) * 30 > 1)
|
|
|
+ if ((totalTickTime / 1000) * 20 > 1)
|
|
|
{
|
|
|
std::cout << "The game runns slower than normal.\n";
|
|
|
}
|
|
@@ -427,6 +432,7 @@ void Game::api(Framework::StreamReader* zRequest, GameClient* zOrigin)
|
|
|
}
|
|
|
if (target)
|
|
|
target->inventoryApi(zRequest, &response, zOrigin->zEntity());
|
|
|
+ break;
|
|
|
}
|
|
|
default:
|
|
|
std::cout << "received unknown api request in game with type " << (int)type << "\n";
|
|
@@ -450,7 +456,7 @@ void Game::sendMessage(NetworkMessage* zResponse, Entity* zTargetPlayer)
|
|
|
{
|
|
|
for (auto client : *clients)
|
|
|
{
|
|
|
- if (client->zEntity() == zTargetPlayer)
|
|
|
+ if (client->zEntity()->getId() == zTargetPlayer->getId())
|
|
|
{
|
|
|
client->sendResponse(zResponse);
|
|
|
break;
|
|
@@ -482,6 +488,7 @@ GameClient* Game::addPlayer(FCKlient* client, Framework::Text name)
|
|
|
cs.lock();
|
|
|
Datei pFile;
|
|
|
pFile.setDatei(path + "/player/" + name);
|
|
|
+ std::cout << "player " << name.getText() << " connected.\n";
|
|
|
Player* player;
|
|
|
bool isNew = 0;
|
|
|
if (!pFile.existiert() || !pFile.open(Datei::Style::lesen))
|