Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff api/Objects/Unit.cs @ 38:548cfc776f54
Fixes #34 - Remove "Choices" and "Base/Increment" from Category
* Remove Choices and Base/Increment from code
Re #47: Remove magic numbers
* Replace "-1" magic number with WarFoundryCore.INFINITY
* Use INFINITY instead of -1 in code
* Use INF in schemas instead of -1
* Handle and parse INF as a special value in XML Factory
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 19 Mar 2009 20:11:07 +0000 |
parents | 306558904c2a |
children | 3a90f70dac73 |
line wrap: on
line diff
--- a/api/Objects/Unit.cs Mon Mar 16 20:53:22 2009 +0000 +++ b/api/Objects/Unit.cs Thu Mar 19 20:11:07 2009 +0000 @@ -99,7 +99,7 @@ } else { - if (count == -1) + if (count == WarFoundryCore.INFINITY) { points+= size * equipItem.Cost; } @@ -288,7 +288,7 @@ } else { - if (amount >=1 || amount == -1) + if (amount >=1 || amount == WarFoundryCore.INFINITY) { amount = (float)Math.Round(amount); } @@ -307,7 +307,7 @@ if (amount!=oldAmount) { - if (amount > 0 || amount == -1) + if (amount > 0 || amount == WarFoundryCore.INFINITY) { equipment[equipID] = amount; } @@ -369,41 +369,5 @@ { get { return UnitType.UnitStats; } } - - /*public override string ToXmlString() - { - StringBuilder sb = new StringBuilder(); - float amount; - - foreach(string key in equipment.Keys) - { - amount = (float)equipment[key]; - - if (amount > 0 || amount == -1) - { - sb.Append("<equipItem id=\""+key+"\" amount=\""+amount+"\" />"); - } - } - - string equipmentString; - - if (sb.Length > 0) - { - equipmentString = "<equipment>"+sb.ToString()+"</equipment>"; - } - else - { - equipmentString = ""; - } - - if (equipmentString == "") - { - return "<unit id=\""+ID+"\" unitType=\""+UnitType.ID+"\" unitName=\""+name+"\" size=\""+Size+"\" />"; - } - else - { - return "<unit id=\""+ID+"\" unitType=\""+UnitType.ID+"\" unitName=\""+name+"\" size=\""+Size+"\">"+equipmentString+"</unit>"; - } - }*/ } }