Browse Source

Fix "db" command

develop
Anton Tarasenko 2 years ago
parent
commit
759d1d3840
  1. 26
      sources/Commands/ACommandDB.uc

26
sources/Commands/ACommandDB.uc

@ -113,8 +113,15 @@ protected function BuildData(CommandDataBuilder builder)
protected function PushPlayer(EPlayer nextPlayer, Database callDatabase) protected function PushPlayer(EPlayer nextPlayer, Database callDatabase)
{ {
queueWaitingListPlayers[queueWaitingListPlayers.length] = local EPlayer playerCopy;
EPlayer(nextPlayer.Copy());
if (nextPlayer != none) {
playerCopy = EPlayer(nextPlayer.Copy());
}
if (callDatabase != none) {
callDatabase.NewRef();
}
queueWaitingListPlayers[queueWaitingListPlayers.length] = playerCopy;
queueWaitingListDatabases[queueWaitingListDatabases.length] = callDatabase; queueWaitingListDatabases[queueWaitingListDatabases.length] = callDatabase;
} }
@ -128,9 +135,10 @@ protected function EPlayer PopPlayer(Database relevantDatabase)
while (i < queueWaitingListDatabases.length) while (i < queueWaitingListDatabases.length)
{ {
if (queueWaitingListDatabases[i] != relevantDatabase) if (queueWaitingListDatabases[i].IsEqual(relevantDatabase))
{ {
result = queueWaitingListPlayers[i]; result = queueWaitingListPlayers[i];
queueWaitingListDatabases[i].FreeSelf();
queueWaitingListPlayers.Remove(i, 1); queueWaitingListPlayers.Remove(i, 1);
queueWaitingListDatabases.Remove(i, 1); queueWaitingListDatabases.Remove(i, 1);
break; break;
@ -235,11 +243,11 @@ private function DBPointerPair TryLoadingDB(BaseText databaseLink)
if (databaseLink == none) { if (databaseLink == none) {
return result; return result;
} }
result.database = _.db.Load(databaseLink); result.database = _server.db.Load(databaseLink);
if (result.database == none) { if (result.database == none) {
return result; return result;
} }
result.pointer = _.db.GetPointer(databaseLink); result.pointer = _server.db.GetPointer(databaseLink);
return result; return result;
} }
@ -248,12 +256,12 @@ protected function CreateDatabase(EPlayer instigator, Text databaseName)
if (instigator == none) { if (instigator == none) {
return; return;
} }
if (_.db.ExistsLocal(databaseName)) if (_server.db.ExistsLocal(databaseName))
{ {
callerConsole.WriteLine(T(TDB_ALREADY_EXISTS)); callerConsole.WriteLine(T(TDB_ALREADY_EXISTS));
return; return;
} }
if (_.db.NewLocal(databaseName) != none) { if (_server.db.NewLocal(databaseName) != none) {
callerConsole.WriteLine(T(TDB_CREATED)); callerConsole.WriteLine(T(TDB_CREATED));
} }
else { else {
@ -266,7 +274,7 @@ protected function DeleteDatabase(EPlayer instigator, Text databaseName)
if (instigator == none) { if (instigator == none) {
return; return;
} }
if (_.db.DeleteLocal(databaseName)) { if (_server.db.DeleteLocal(databaseName)) {
callerConsole.WriteLine(T(TDA_DELETED)); callerConsole.WriteLine(T(TDA_DELETED));
} }
else { else {
@ -283,7 +291,7 @@ protected function ListDatabases(EPlayer instigator)
if (instigator == none) { if (instigator == none) {
return; return;
} }
availableDatabases = _.db.ListLocal(); availableDatabases = _server.db.ListLocal();
console = callerConsole; console = callerConsole;
console.Write(T(TAVAILABLE_DATABASES)); console.Write(T(TAVAILABLE_DATABASES));
for (i = 0; i < availableDatabases.length; i += 1) for (i = 0; i < availableDatabases.length; i += 1)

Loading…
Cancel
Save