Skip to content

Commit

Permalink
Wurst: Fix compile time warnings.
Browse files Browse the repository at this point in the history
Apply 'override' annotation for overridden inherited functions.
Replace usage of deprecated 'contains' with 'has'.
  • Loading branch information
crojewsk committed Jan 3, 2019
1 parent a43b85e commit cd679cd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions wurst/ItemRecipe/ItemRecipe.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class ItemRecipe
if not instances.has(index)
instances.put(index, new LinkedList<ItemRecipe>())
var recipes = instances.get(index)
if not recipes.contains(recipe)
if not recipes.has(recipe)
recipes.push(recipe)

private static function flushRecipe(int index, ItemRecipe recipe)
Expand Down Expand Up @@ -463,7 +463,7 @@ function onSmoothPickup()
destroy items

class SmoothRecipeAssembly implements SmoothPickupPredicate
function canPickup(unit whichUnit, item whichItem) returns boolean
override function canPickup(unit whichUnit, item whichItem) returns boolean
return getCheatRecipe(whichUnit, whichItem) != null

init
Expand Down
2 changes: 1 addition & 1 deletion wurst/ItemRecipe/ItemRecipeDemo.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class NoTrollsAlive implements UnitRequirementPredicate
static function filter() returns boolean
return GetFilterUnit().getTypeId() == 'ndtb' and GetFilterUnit().isAlive() // Spitting Spider

function isMet(unit _whichUnit) returns string
override function isMet(unit _whichUnit) returns string
var g = CreateGroup()
string result = null

Expand Down
16 changes: 8 additions & 8 deletions wurst/ItemRestriction/ItemRestriction.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class UnitRequirement

/** Whether specified unit type is a part of requirement. */
function has(int unitTypeId) returns boolean
return units.contains(unitTypeId)
return units.has(unitTypeId)

/** Sets hero statistic requirements to specified values. */
function requireStat(int str, int agi, int intel)
Expand All @@ -78,7 +78,7 @@ public class UnitRequirement

/** Adds specified unit type to requirement criterias. */
function addUnit(int unitTypeId)
if unitTypeId > 0 and not units.contains(unitTypeId)
if unitTypeId > 0 and not units.has(unitTypeId)
units.push(unitTypeId)

/** Removes specified unit type from requirement criterias. */
Expand All @@ -88,7 +88,7 @@ public class UnitRequirement

/** Adds new criteria to requirement criterias. */
function addCondition(UnitRequirementPredicate predicate)
if predicate != null and not conditions.contains(predicate)
if predicate != null and not conditions.has(predicate)
conditions.add(predicate)

/** Removes specified condition from requirement criterias. */
Expand Down Expand Up @@ -150,7 +150,7 @@ public class ItemRestriction
if not instances.has(index)
instances.put(index, new LinkedList<ItemRestriction>())
var restrictions = instances.get(index)
if not restrictions.contains(restriction)
if not restrictions.has(restriction)
restrictions.push(restriction)

private static function flushRestriction(int index, ItemRestriction restriction)
Expand Down Expand Up @@ -189,7 +189,7 @@ public class ItemRestriction

/** Whether specified item type is a part of restriction. */
function has(int itemTypeId) returns boolean
return items.contains(itemTypeId)
return items.has(itemTypeId)

/** Remove specified item type from this restriction. */
function removeItem(int itemTypeId)
Expand Down Expand Up @@ -233,13 +233,13 @@ public class ItemRestriction

/** Makes specified restriction non-exclusive with this restriction. */
function removeExclusive(ItemRestriction restriction)
if exclusives.contains(restriction)
if exclusives.has(restriction)
exclusives.remove(restriction)
restriction.exclusives.remove(this)

/** Makes specified restriction exclusive with this restriction. */
function addExclusive(ItemRestriction restriction)
if restriction != null and not exclusives.contains(restriction)
if restriction != null and not exclusives.has(restriction)
exclusives.push(restriction)
restriction.exclusives.push(this)

Expand Down Expand Up @@ -283,7 +283,7 @@ public class ItemRestriction
var threshold = limit
if not exceptions.isEmpty()
var exception = getException(index)
if exception == null or not exceptions.contains(exception)
if exception == null or not exceptions.has(exception)
table.removeInt(-index) // clear assigned exception if any

var iter = exceptions.iterator()
Expand Down
2 changes: 1 addition & 1 deletion wurst/ItemRestriction/ItemRestrictionDemo.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class AtLeastOneSpiderAlive implements UnitRequirementPredicate
static function filter() returns boolean
return GetFilterUnit().getTypeId() == 'nssp' and GetFilterUnit().isAlive() // Spitting Spider

function isMet(unit _whichUnit) returns string
override function isMet(unit _whichUnit) returns string
group g = CreateGroup()
string result = null

Expand Down
2 changes: 1 addition & 1 deletion wurst/StackNSplit/StackNSplit.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ function onSmoothPickup()
pickupItem(getSmoothItemPickupUnit(), getSmoothItemPickupItem())

class SmoothChargesStack implements SmoothPickupPredicate
function canPickup(unit whichUnit, item whichItem) returns boolean
override function canPickup(unit whichUnit, item whichItem) returns boolean
var itemTypeId = whichItem.getTypeId()
var result = false

Expand Down

0 comments on commit cd679cd

Please sign in to comment.