Better checks for client data util
This commit is contained in:
@@ -51,12 +51,19 @@ function getGameAreas(gameId) {
|
|||||||
* @return {ClientData} The player/client's data (class instancee)
|
* @return {ClientData} The player/client's data (class instancee)
|
||||||
*/
|
*/
|
||||||
function getPlayerData(client) {
|
function getPlayerData(client) {
|
||||||
if (client != null) {
|
if (client == null) {
|
||||||
if (isClientInitialized(client)) {
|
return false;
|
||||||
return getServerData().clients[getPlayerId(client)];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
if (!isClientInitialized(client)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof getServerData().clients[getPlayerId(client)] == "undefined") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getServerData().clients[getPlayerId(client)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -426,11 +433,11 @@ function isClientInitialized(client) {
|
|||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//if (playerInitialized[getPlayerId(client)] == false) {
|
if (playerInitialized[getPlayerId(client)] == true) {
|
||||||
// return false;
|
return true;
|
||||||
//}
|
}
|
||||||
|
|
||||||
return (typeof getServerData().clients[getPlayerId(client)] != "undefined");
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user