improved player data ram storage read & write

This commit is contained in:
Steffen Schröder 2014-07-29 00:05:27 +02:00
parent 8d7f6bc62b
commit 20f769c496

View File

@ -209,11 +209,9 @@ class PlayerDataManager {
$meta = $this->metaData[$className . $dataName];
//Check if data is already in the ram
if (isset($this->storedData[$player->index])) {
if (isset($this->storedData[$player->index][$meta->dataId])) {
return $this->storedData[$player->index][$meta->dataId];
}
// Check if data is already in the ram
if (isset($this->storedData[$player->index]) && isset($this->storedData[$player->index][$meta->dataId])) {
return $this->storedData[$player->index][$meta->dataId];
}
$mysqli = $this->maniaControl->database->mysqli;
@ -296,10 +294,11 @@ class PlayerDataManager {
}
$statement->close();
//FIXME store changed value
if (isset($this->storedData[$player->index]) && isset($this->storedData[$player->index][$dataId])) {
unset($this->storedData[$player->index][$dataId]);
// Store changed value
if (!isset($this->storedData[$player->index])) {
$this->storedData[$player->index] = array();
}
$this->storedData[$player->index][$dataId] = $value;
return true;
}