Compare commits

..

4 Commits

Author SHA1 Message Date
Anton Tarasenko e8ae6fd8d1 Change votings to output outcome message in one line 1 year ago
Anton Tarasenko 93604c7690 Remove temporary comment 1 year ago
Anton Tarasenko 159f1dc5a1 Fix storing user groups in databases not working 1 year ago
Anton Tarasenko 15b1abc8c3 Fix infinite loop bug with UnflectAPI rollback 1 year ago
  1. 4
      sources/BaseAPI/API/Commands/Voting/Voting.uc
  2. 2
      sources/BaseAPI/API/Unflect/UnflectApi.uc
  3. 25
      sources/Data/Database/DBAPI.uc

4
sources/BaseAPI/API/Commands/Voting/Voting.uc

@ -526,7 +526,6 @@ public final function PrintVotingInfoFor(EPlayer requester) {
/// Override this to perform necessary logic after voting has succeeded. /// Override this to perform necessary logic after voting has succeeded.
protected function Execute(HashTable arguments) {} protected function Execute(HashTable arguments) {}
/// Fill `currentAnnouncements` here!!!
/// Override this method to: /// Override this method to:
/// ///
/// 1. Specify any of the messages inside `currentAnnouncements` to fit passed /// 1. Specify any of the messages inside `currentAnnouncements` to fit passed
@ -829,7 +828,8 @@ private final function AnnounceOutcome(BaseText outcomeMessage, optional EPlayer
currentPlayers = _.players.GetAll(); currentPlayers = _.players.GetAll();
for (i = 0; i < currentPlayers.length; i += 1) { for (i = 0; i < currentPlayers.length; i += 1) {
writer = currentPlayers[i].BorrowConsole(); writer = currentPlayers[i].BorrowConsole();
writer.WriteLine(editedOutcomeMessage); writer.Write(editedOutcomeMessage);
writer.Write(P(" / "));
writer.WriteLine(summaryLine); writer.WriteLine(summaryLine);
currentPlayers[i].Notify(editedOutcomeMessage, summaryLine,, P("voting")); currentPlayers[i].Notify(editedOutcomeMessage, summaryLine,, P("voting"));
} }

2
sources/BaseAPI/API/Unflect/UnflectApi.uc

@ -67,6 +67,7 @@ public final function _drop() {
// Drop is called when Acedia is shutting down, so releasing references isn't necessary // Drop is called when Acedia is shutting down, so releasing references isn't necessary
iter = HashTableIterator(completedReplacements.Iterate()); iter = HashTableIterator(completedReplacements.Iterate());
while (!iter.HasFinished()) { while (!iter.HasFinished()) {
nextFunctionInstance = none;
nextFunctionName = Text(iter.GetKey()); nextFunctionName = Text(iter.GetKey());
nextSources = ByteArrayBox(originalScriptCodes.GetItem(nextFunctionName)); nextSources = ByteArrayBox(originalScriptCodes.GetItem(nextFunctionName));
if (nextSources != none ) { if (nextSources != none ) {
@ -75,6 +76,7 @@ public final function _drop() {
if (nextFunctionInstance != none) { if (nextFunctionInstance != none) {
nextFunctionInstance.script = nextSources.Get(); nextFunctionInstance.script = nextSources.Get();
} }
iter.Next();
} }
} }

25
sources/Data/Database/DBAPI.uc

@ -250,48 +250,49 @@ public final function LocalDatabaseInstance LoadLocal(BaseText databaseName)
local DBRecord rootRecord; local DBRecord rootRecord;
local Text rootRecordName; local Text rootRecordName;
local LocalDatabase newConfig; local LocalDatabase newConfig;
local LocalDatabaseInstance newLocalDBInstance; local LocalDatabaseInstance newLocalDBInstance, result;
local Text dbKey; local Text dbKey;
if (databaseName == none) { if (databaseName == none) {
return none; return none;
} }
CreateLocalDBMapIfMissing(); CreateLocalDBMapIfMissing();
if (loadedLocalDatabases.HasKey(databaseName)) dbKey = databaseName.Copy();
if (loadedLocalDatabases.HasKey(dbKey))
{ {
return LocalDatabaseInstance(loadedLocalDatabases result = LocalDatabaseInstance(loadedLocalDatabases.GetItem(dbKey));
.GetItem(databaseName)); _.memory.Free(dbKey);
return result;
} }
// No need to check `databaseName` for being valid, // No need to check `dbKey` for being valid,
// since `Load()` will just return `none` if it is not. // since `Load()` will just return `none` if it is not.
newConfig = class'LocalDatabase'.static.Load(databaseName); newConfig = class'LocalDatabase'.static.Load(dbKey);
if (newConfig == none) { if (newConfig == none) {
_.memory.Free(dbKey);
return none; return none;
} }
if (!newConfig.HasDefinedRoot() && !newConfig.ShouldCreateIfMissing()) { if (!newConfig.HasDefinedRoot() && !newConfig.ShouldCreateIfMissing()) {
_.memory.Free(dbKey);
return none; return none;
} }
newLocalDBInstance = LocalDatabaseInstance(_.memory.Allocate(localDBClass)); newLocalDBInstance = LocalDatabaseInstance(_.memory.Allocate(localDBClass));
dbKey = databaseName.Copy();
loadedLocalDatabases.SetItem(dbKey, newLocalDBInstance); loadedLocalDatabases.SetItem(dbKey, newLocalDBInstance);
dbKey.FreeSelf(); dbKey.FreeSelf();
if (newConfig.HasDefinedRoot()) if (newConfig.HasDefinedRoot())
{ {
rootRecordName = newConfig.GetRootName(); rootRecordName = newConfig.GetRootName();
rootRecord = class'DBRecord'.static rootRecord = class'DBRecord'.static.LoadRecord(rootRecordName, dbKey);
.LoadRecord(rootRecordName, databaseName);
} }
else else
{ {
rootRecord = class'DBRecord'.static.NewRecord(databaseName); rootRecord = class'DBRecord'.static.NewRecord(dbKey);
rootRecordName = _.text.FromString(string(rootRecord.name)); rootRecordName = _.text.FromString(string(rootRecord.name));
newConfig.SetRootName(rootRecordName); newConfig.SetRootName(rootRecordName);
newConfig.Save(); newConfig.Save();
} }
newLocalDBInstance.Initialize(newConfig, rootRecord); newLocalDBInstance.Initialize(newConfig, rootRecord);
_.logger.Auto(infoLocalDatabaseLoaded).Arg(databaseName.Copy()); _.logger.Auto(infoLocalDatabaseLoaded).Arg(dbKey);
_.memory.Free(rootRecordName); _.memory.Free(rootRecordName);
_.memory.Free(newLocalDBInstance);
return newLocalDBInstance; return newLocalDBInstance;
} }

Loading…
Cancel
Save