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.
protected function Execute(HashTable arguments) {}
/// Fill `currentAnnouncements` here!!!
/// Override this method to:
///
/// 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();
for (i = 0; i < currentPlayers.length; i += 1) {
writer = currentPlayers[i].BorrowConsole();
writer.WriteLine(editedOutcomeMessage);
writer.Write(editedOutcomeMessage);
writer.Write(P(" / "));
writer.WriteLine(summaryLine);
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
iter = HashTableIterator(completedReplacements.Iterate());
while (!iter.HasFinished()) {
nextFunctionInstance = none;
nextFunctionName = Text(iter.GetKey());
nextSources = ByteArrayBox(originalScriptCodes.GetItem(nextFunctionName));
if (nextSources != none ) {
@ -75,6 +76,7 @@ public final function _drop() {
if (nextFunctionInstance != none) {
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 Text rootRecordName;
local LocalDatabase newConfig;
local LocalDatabaseInstance newLocalDBInstance;
local LocalDatabaseInstance newLocalDBInstance, result;
local Text dbKey;
if (databaseName == none) {
return none;
}
CreateLocalDBMapIfMissing();
if (loadedLocalDatabases.HasKey(databaseName))
dbKey = databaseName.Copy();
if (loadedLocalDatabases.HasKey(dbKey))
{
return LocalDatabaseInstance(loadedLocalDatabases
.GetItem(databaseName));
result = LocalDatabaseInstance(loadedLocalDatabases.GetItem(dbKey));
_.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.
newConfig = class'LocalDatabase'.static.Load(databaseName);
newConfig = class'LocalDatabase'.static.Load(dbKey);
if (newConfig == none) {
_.memory.Free(dbKey);
return none;
}
if (!newConfig.HasDefinedRoot() && !newConfig.ShouldCreateIfMissing()) {
_.memory.Free(dbKey);
return none;
}
newLocalDBInstance = LocalDatabaseInstance(_.memory.Allocate(localDBClass));
dbKey = databaseName.Copy();
loadedLocalDatabases.SetItem(dbKey, newLocalDBInstance);
dbKey.FreeSelf();
if (newConfig.HasDefinedRoot())
{
rootRecordName = newConfig.GetRootName();
rootRecord = class'DBRecord'.static
.LoadRecord(rootRecordName, databaseName);
rootRecord = class'DBRecord'.static.LoadRecord(rootRecordName, dbKey);
}
else
{
rootRecord = class'DBRecord'.static.NewRecord(databaseName);
rootRecord = class'DBRecord'.static.NewRecord(dbKey);
rootRecordName = _.text.FromString(string(rootRecord.name));
newConfig.SetRootName(rootRecordName);
newConfig.Save();
}
newLocalDBInstance.Initialize(newConfig, rootRecord);
_.logger.Auto(infoLocalDatabaseLoaded).Arg(databaseName.Copy());
_.logger.Auto(infoLocalDatabaseLoaded).Arg(dbKey);
_.memory.Free(rootRecordName);
_.memory.Free(newLocalDBInstance);
return newLocalDBInstance;
}

Loading…
Cancel
Save