|
@@ -41,15 +41,18 @@ RegisteredPlayer::RegisteredPlayer(Framework::StreamReader* zReader)
|
|
delete[] buffer;
|
|
delete[] buffer;
|
|
}
|
|
}
|
|
|
|
|
|
-int RegisteredPlayer::getId() const {
|
|
|
|
|
|
+int RegisteredPlayer::getId() const
|
|
|
|
+{
|
|
return id;
|
|
return id;
|
|
}
|
|
}
|
|
|
|
|
|
-Framework::Text RegisteredPlayer::getName() const {
|
|
|
|
|
|
+Framework::Text RegisteredPlayer::getName() const
|
|
|
|
+{
|
|
return name;
|
|
return name;
|
|
}
|
|
}
|
|
|
|
|
|
-Framework::Text RegisteredPlayer::getSecret() const {
|
|
|
|
|
|
+Framework::Text RegisteredPlayer::getSecret() const
|
|
|
|
+{
|
|
return secret;
|
|
return secret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -83,7 +86,8 @@ PlayerRegister::PlayerRegister(Framework::Text worldPath)
|
|
regDat.close();
|
|
regDat.close();
|
|
}
|
|
}
|
|
|
|
|
|
-Framework::Text PlayerRegister::addPlayer(Framework::Text name) {
|
|
|
|
|
|
+Framework::Text PlayerRegister::addPlayer(Framework::Text name)
|
|
|
|
+{
|
|
cs.lock();
|
|
cs.lock();
|
|
int nextId = 0;
|
|
int nextId = 0;
|
|
for (RegisteredPlayer* player : players)
|
|
for (RegisteredPlayer* player : players)
|
|
@@ -97,6 +101,7 @@ Framework::Text PlayerRegister::addPlayer(Framework::Text name) {
|
|
}
|
|
}
|
|
RegisteredPlayer* p = new RegisteredPlayer(nextId, name);
|
|
RegisteredPlayer* p = new RegisteredPlayer(nextId, name);
|
|
players.add(p);
|
|
players.add(p);
|
|
|
|
+ save();
|
|
cs.unlock();
|
|
cs.unlock();
|
|
return p->getSecret();
|
|
return p->getSecret();
|
|
}
|
|
}
|
|
@@ -116,7 +121,8 @@ bool PlayerRegister::hasPlayer(Framework::Text name)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int PlayerRegister::getPlayerId(Framework::Text name) {
|
|
|
|
|
|
+int PlayerRegister::getPlayerId(Framework::Text name)
|
|
|
|
+{
|
|
cs.lock();
|
|
cs.lock();
|
|
for (RegisteredPlayer* player : players)
|
|
for (RegisteredPlayer* player : players)
|
|
{
|
|
{
|