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