|
|
@ -28,6 +28,7 @@ var private BaseAliasSource weaponAliasSource; |
|
|
|
var private BaseAliasSource colorAliasSource; |
|
|
|
var private BaseAliasSource colorAliasSource; |
|
|
|
var private BaseAliasSource featureAliasSource; |
|
|
|
var private BaseAliasSource featureAliasSource; |
|
|
|
var private BaseAliasSource entityAliasSource; |
|
|
|
var private BaseAliasSource entityAliasSource; |
|
|
|
|
|
|
|
var private BaseAliasSource commandAliasSource; |
|
|
|
|
|
|
|
|
|
|
|
public function _reloadSources() |
|
|
|
public function _reloadSources() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -37,10 +38,12 @@ public function _reloadSources() |
|
|
|
_.memory.Free(colorAliasSource); |
|
|
|
_.memory.Free(colorAliasSource); |
|
|
|
_.memory.Free(featureAliasSource); |
|
|
|
_.memory.Free(featureAliasSource); |
|
|
|
_.memory.Free(entityAliasSource); |
|
|
|
_.memory.Free(entityAliasSource); |
|
|
|
|
|
|
|
_.memory.Free(commandAliasSource); |
|
|
|
weaponAliasSource = none; |
|
|
|
weaponAliasSource = none; |
|
|
|
colorAliasSource = none; |
|
|
|
colorAliasSource = none; |
|
|
|
featureAliasSource = none; |
|
|
|
featureAliasSource = none; |
|
|
|
entityAliasSource = none; |
|
|
|
entityAliasSource = none; |
|
|
|
|
|
|
|
commandAliasSource = none; |
|
|
|
feature = Aliases_Feature( |
|
|
|
feature = Aliases_Feature( |
|
|
|
class'Aliases_Feature'.static.GetEnabledInstance()); |
|
|
|
class'Aliases_Feature'.static.GetEnabledInstance()); |
|
|
|
if (feature == none) { |
|
|
|
if (feature == none) { |
|
|
@ -50,6 +53,7 @@ public function _reloadSources() |
|
|
|
colorAliasSource = feature.GetColorSource(); |
|
|
|
colorAliasSource = feature.GetColorSource(); |
|
|
|
featureAliasSource = feature.GetFeatureSource(); |
|
|
|
featureAliasSource = feature.GetFeatureSource(); |
|
|
|
entityAliasSource = feature.GetEntitySource(); |
|
|
|
entityAliasSource = feature.GetEntitySource(); |
|
|
|
|
|
|
|
commandAliasSource = feature.GetCommandSource(); |
|
|
|
_.memory.Free(feature); |
|
|
|
_.memory.Free(feature); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -101,7 +105,6 @@ public final function BaseAliasSource GetWeaponSource() |
|
|
|
* Returns `BaseAliasSource` that is designated in configuration files as |
|
|
|
* Returns `BaseAliasSource` that is designated in configuration files as |
|
|
|
* a source for color aliases. |
|
|
|
* a source for color aliases. |
|
|
|
* |
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* @return Reference to the `BaseAliasSource` that contains color aliases. |
|
|
|
* @return Reference to the `BaseAliasSource` that contains color aliases. |
|
|
|
* Can return `none` if no source for colors was configured or |
|
|
|
* Can return `none` if no source for colors was configured or |
|
|
|
* the configured source is incorrectly defined. |
|
|
|
* the configured source is incorrectly defined. |
|
|
@ -118,7 +121,6 @@ public final function BaseAliasSource GetColorSource() |
|
|
|
* Returns `BaseAliasSource` that is designated in configuration files as |
|
|
|
* Returns `BaseAliasSource` that is designated in configuration files as |
|
|
|
* a source for feature aliases. |
|
|
|
* a source for feature aliases. |
|
|
|
* |
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* @return Reference to the `BaseAliasSource` that contains feature aliases. |
|
|
|
* @return Reference to the `BaseAliasSource` that contains feature aliases. |
|
|
|
* Can return `none` if no source for features was configured or |
|
|
|
* Can return `none` if no source for features was configured or |
|
|
|
* the configured source is incorrectly defined. |
|
|
|
* the configured source is incorrectly defined. |
|
|
@ -135,7 +137,6 @@ public final function BaseAliasSource GetFeatureSource() |
|
|
|
* Returns `BaseAliasSource` that is designated in configuration files as |
|
|
|
* Returns `BaseAliasSource` that is designated in configuration files as |
|
|
|
* a source for entity aliases. |
|
|
|
* a source for entity aliases. |
|
|
|
* |
|
|
|
* |
|
|
|
* |
|
|
|
|
|
|
|
* @return Reference to the `BaseAliasSource` that contains entity aliases. |
|
|
|
* @return Reference to the `BaseAliasSource` that contains entity aliases. |
|
|
|
* Can return `none` if no source for entities was configured or |
|
|
|
* Can return `none` if no source for entities was configured or |
|
|
|
* the configured source is incorrectly defined. |
|
|
|
* the configured source is incorrectly defined. |
|
|
@ -148,6 +149,25 @@ public final function BaseAliasSource GetEntitySource() |
|
|
|
return entityAliasSource; |
|
|
|
return entityAliasSource; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Returns `BaseAliasSource` that is designated in configuration files as |
|
|
|
|
|
|
|
* a source for command aliases. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Command aliases values can have the format of "<command>" or |
|
|
|
|
|
|
|
* "<command> <sub-command>". |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return Reference to the `BaseAliasSource` that contains command aliases. |
|
|
|
|
|
|
|
* Can return `none` if no source for command was configured or |
|
|
|
|
|
|
|
* the configured source is incorrectly defined. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public final function BaseAliasSource GetCommandSource() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (commandAliasSource != none) { |
|
|
|
|
|
|
|
commandAliasSource.NewRef(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return commandAliasSource; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private final function Text ResolveWithSource( |
|
|
|
private final function Text ResolveWithSource( |
|
|
|
BaseText alias, |
|
|
|
BaseText alias, |
|
|
|
BaseAliasSource source, |
|
|
|
BaseAliasSource source, |
|
|
@ -311,6 +331,43 @@ public final function Text ResolveEntity( |
|
|
|
return ResolveWithSource(alias, entityAliasSource, copyOnFailure); |
|
|
|
return ResolveWithSource(alias, entityAliasSource, copyOnFailure); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Tries to look up a value stored for given alias in an `BaseAliasSource` |
|
|
|
|
|
|
|
* configured to store command aliases. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Command aliases values can have the format of "<command>" or |
|
|
|
|
|
|
|
* "<command> <sub-command>". |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* In Acedia aliases are typically prefixed with '$' to indicate that user |
|
|
|
|
|
|
|
* means to enter alias. This method is able to handle both aliases with and |
|
|
|
|
|
|
|
* without that prefix. This does not lead to conflicts, because '$' cannot |
|
|
|
|
|
|
|
* be a valid part of any alias. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Lookup of alias can fail if either alias does not exist in command alias |
|
|
|
|
|
|
|
* source or command alias source itself does not exist |
|
|
|
|
|
|
|
* (due to either faulty configuration or incorrect definition). |
|
|
|
|
|
|
|
* To determine if command alias source exists you can check |
|
|
|
|
|
|
|
* `_.alias.GetCommandSource()` value. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param alias Alias, for which method will attempt to |
|
|
|
|
|
|
|
* look up a value. Case-insensitive. |
|
|
|
|
|
|
|
* @param copyOnFailure Whether method should return copy of original |
|
|
|
|
|
|
|
* `alias` value in case caller source did not have any records |
|
|
|
|
|
|
|
* corresponding to `alias`. If `alias` was specified with '$' prefix - |
|
|
|
|
|
|
|
* it will be discarded. |
|
|
|
|
|
|
|
* @return If look up was successful - value, associated with the given |
|
|
|
|
|
|
|
* alias `alias`. If lookup was unsuccessful, it depends on `copyOnFailure` |
|
|
|
|
|
|
|
* flag: `copyOnFailure == false` means method will return `none` |
|
|
|
|
|
|
|
* and `copyOnFailure == true` means method will return `alias.Copy()`. |
|
|
|
|
|
|
|
* If `alias == none` method always returns `none`. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public final function Text ResolveCommand( |
|
|
|
|
|
|
|
BaseText alias, |
|
|
|
|
|
|
|
optional bool copyOnFailure) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return ResolveWithSource(alias, commandAliasSource, copyOnFailure); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Tries to look up a value stored for given alias in a custom alias source |
|
|
|
* Tries to look up a value stored for given alias in a custom alias source |
|
|
|
* with a given name `sourceName`. |
|
|
|
* with a given name `sourceName`. |
|
|
|