|
|
@ -137,28 +137,31 @@ protected function Finalizer() |
|
|
|
* (allocated). To set initial config on this `Feature`'s start - specify it |
|
|
|
* (allocated). To set initial config on this `Feature`'s start - specify it |
|
|
|
* as a parameter to `EnableMe()` method. |
|
|
|
* as a parameter to `EnableMe()` method. |
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* Method will do nothing if `newConfigName` parameter is set to `none`. |
|
|
|
|
|
|
|
* |
|
|
|
* @param newConfigName Name of the config to apply to the caller `Feature`. |
|
|
|
* @param newConfigName Name of the config to apply to the caller `Feature`. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public final function ApplyConfig(Text newConfigName) |
|
|
|
public final function ApplyConfig(Text newConfigName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
local AssociativeArray newConfigData; |
|
|
|
local FeatureConfig newConfig; |
|
|
|
newConfigData = configClass.static.LoadData(newConfigName); |
|
|
|
if (newConfigName == none) { |
|
|
|
if (newConfigData == none) |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
newConfig = configClass.static.GetConfigInstance(newConfigName); |
|
|
|
|
|
|
|
if (newConfig == none) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_.logger.Auto(errorBadConfigData).ArgClass(class); |
|
|
|
_.logger.Auto(errorBadConfigData).ArgClass(class); |
|
|
|
// Fallback to "default" config |
|
|
|
// Fallback to "default" config |
|
|
|
newConfigName = _.text.FromString(defaultConfigName); |
|
|
|
newConfigName = _.text.FromString(defaultConfigName); |
|
|
|
configClass.static.NewConfig(newConfigName); |
|
|
|
configClass.static.NewConfig(newConfigName); |
|
|
|
newConfigData = configClass.static.LoadData(newConfigName); |
|
|
|
newConfig = configClass.static.GetConfigInstance(newConfigName); |
|
|
|
} |
|
|
|
} |
|
|
|
SwapConfig(currentConfig, newConfigData); |
|
|
|
else { |
|
|
|
if (currentConfig != none) { |
|
|
|
newConfigName = newConfigName.Copy(); |
|
|
|
currentConfig.Empty(true); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SwapConfig(newConfig); |
|
|
|
_.memory.Free(currentConfigName); |
|
|
|
_.memory.Free(currentConfigName); |
|
|
|
_.memory.Free(currentConfig); |
|
|
|
currentConfigName = newConfigName; |
|
|
|
currentConfigName = newConfigName.Copy(); |
|
|
|
|
|
|
|
currentConfig = newConfigData; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -289,18 +292,15 @@ protected function OnDisabled() { } |
|
|
|
* Will be called whenever caller `Feature` class must change it's config |
|
|
|
* Will be called whenever caller `Feature` class must change it's config |
|
|
|
* parameters. This can be done both when the `Feature` is enabled or disabled. |
|
|
|
* parameters. This can be done both when the `Feature` is enabled or disabled. |
|
|
|
* |
|
|
|
* |
|
|
|
* @param previousConfigData Config data that was previously set for this |
|
|
|
* @param newConfigData New config that caller `Feature`'s class must use. |
|
|
|
* `Feature` class. `none` is passed iff config is set for the first time. |
|
|
|
* We pass `FeatureConfig` value for performance and simplicity reasons, |
|
|
|
* @param newConfigData New config data that caller `Feature`'s class |
|
|
|
* but to keep Acedia working correctly and in an expected way you |
|
|
|
* must use. Guaranteed to not be `none`. |
|
|
|
* MUST AVOID MODIFYING THIS VALUE IN ANY WAY WHATSOEVER. |
|
|
|
|
|
|
|
* Guaranteed to not be `none`. |
|
|
|
* |
|
|
|
* |
|
|
|
* AVOID MANUALLY CALLING IT. |
|
|
|
* AVOID MANUALLY CALLING THIS METHOD. |
|
|
|
* DO NOT DEALLOCATE PASSED VALUES. |
|
|
|
|
|
|
|
* DO NOT USE PASSED VALUES OUTSIDE OF THIS METHOD CALL. |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected function SwapConfig( |
|
|
|
protected function SwapConfig(FeatureConfig newConfig){} |
|
|
|
AssociativeArray previousConfigData, |
|
|
|
|
|
|
|
AssociativeArray newConfigData) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function SetListenersActiveStatus(bool newStatus) |
|
|
|
private static function SetListenersActiveStatus(bool newStatus) |
|
|
|
{ |
|
|
|
{ |
|
|
|