diff --git a/LibBSP/src/Extensions/StringExtensions.cs b/LibBSP/src/Extensions/StringExtensions.cs index daf321b..0657195 100644 --- a/LibBSP/src/Extensions/StringExtensions.cs +++ b/LibBSP/src/Extensions/StringExtensions.cs @@ -87,17 +87,17 @@ namespace LibBSP { if (c == separator) { switch (options) { case StringSplitOptions.RemoveEmptyEntries: { - if (current.Length > 0) { - results.Add(current.ToString()); - } - current.Length = 0; - break; - } - case StringSplitOptions.None: { + if (current.Length > 0) { results.Add(current.ToString()); - current.Length = 0; - break; } + current.Length = 0; + break; + } + case StringSplitOptions.None: { + results.Add(current.ToString()); + current.Length = 0; + break; + } } } else { current.Append(c); diff --git a/LibBSP/src/Structs/Common/Entity.cs b/LibBSP/src/Structs/Common/Entity.cs index 85890b4..d76b2be 100644 --- a/LibBSP/src/Structs/Common/Entity.cs +++ b/LibBSP/src/Structs/Common/Entity.cs @@ -127,7 +127,7 @@ namespace LibBSP { /// /// Allows an attribute to be accessed easily using Entity[""] notation. - /// If an attribute doesn't exist, it returns the empty string. This emulates the behavior of the engines. + /// If an attribute doesn't exist, it returns the empty string. This emulates the behavior of the engines. /// /// /// It's up to the developer to ensure the empty string doesn't cause problems, rather than returning null! @@ -328,21 +328,12 @@ namespace LibBSP { } } else { if (!ContainsKey(key)) { - Add(key, val); + this[key] = val; } } } } - /// - /// Adds the key/value pair to this Entity - /// - /// Name of the attribute to add - /// Value of the attribute to add - public new void Add(string key, string value) { - this[key] = value; - } - /// /// Gets a string representation of this Entity. /// @@ -411,9 +402,8 @@ namespace LibBSP { /// /// Tries to determine what Source engine input this entity would perform when "fired". /// "Firing" an entity is used in practically all other engines for entity I/O, but - /// Source replaced it with the input/output system which, while more powerful, makes - /// my job that much harder. There is no generic "Fire" input, so I need to give a - /// best guess as to the action that will actually be performed. + /// Source replaced it with the input/output system which is more powerful. A best match + /// action must be found for the action the entity would have taken in other enignes. /// /// The best match action for what this entity would do when fired in other engines public string OnFire() { @@ -476,7 +466,7 @@ namespace LibBSP { /// /// Tries to determine what action in Source Engine's Entity I/O would be equivalent - /// to "enabling" the entity in prior engines + /// to "enabling" the entity in prior engines. /// /// The best match action for what this entity would do when enabled in other engines public string OnEnable() { @@ -525,7 +515,7 @@ namespace LibBSP { /// /// Tries to determine what action in Source Engine's Entity I/O would be equivalent - /// to "disabling" the entity in prior engines + /// to "disabling" the entity in prior engines. /// /// The best match action for what this entity would do when disabled in other engines public string OnDisable() { @@ -573,8 +563,8 @@ namespace LibBSP { } /// - /// Tries to determine which "Output" in Source Engine this Entity would use - /// to "fire" its targets in prior engines + /// Tries to determine which "Output" in Source Engine an Entity would use + /// to "fire" its targets in prior engines. /// /// The best match "Output" for this Entity public string FireAction() { @@ -607,7 +597,8 @@ namespace LibBSP { } /// - /// Gets a numeric value as a float. + /// Gets a numeric attribute as a float. Throws if the attribute could not be converted to a numerical value + /// and no was provided. /// /// Name of the attribute to retrieve /// Value to return if doesn't exist, or couldn't be converted @@ -624,7 +615,8 @@ namespace LibBSP { } /// - /// Gets a numeric value as an int. + /// Gets a numeric attribute as an int. Throws if the attribute could not be converted to a numerical value + /// and no was provided. /// /// Name of the attribute to retrieve /// Value to return if doesn't exist, or couldn't be converted @@ -641,8 +633,8 @@ namespace LibBSP { } /// - /// Gets a Vector value as a Vector4. This will only read as many values as are in the value, and can be - /// implicitly converted to Vector3, Vector2, or Color. + /// Gets a Vector attribute as a Vector4. This will only read as many values as are in the attribute, and can be + /// implicitly converted to Vector3, Vector2, or Color. Throws if the attribute could not be converted to a Vector. /// /// Name of the attribute to retrieve /// Vector representation of the components of the attribute @@ -667,6 +659,7 @@ namespace LibBSP { /// /// Object to compare to /// Less than zero if this entity is first, 0 if they occur at the same time, greater than zero otherwise + /// was not of type Entity public int CompareTo(object obj) { if (obj == null) { return 1; } Entity other = obj as Entity; @@ -689,7 +682,7 @@ namespace LibBSP { } /// - /// Factory method for a Lump. + /// Factory method for an Entities object from a byte array. /// /// The data to parse /// The map type @@ -759,7 +752,7 @@ namespace LibBSP { public string param; public double delay; public int fireOnce; - // As I recall, these are Dark Messiah only. I have no idea what they are for. + // As I recall, these exist in Dark Messiah only. I have no idea what they are for. public string unknown0; public string unknown1; }