mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-29 17:55:59 +00:00
More or less standardised separator comments in the code
This commit is contained in:
@@ -165,7 +165,7 @@ class PokemonBag
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# The PC item storage object, which actually contains all the items
|
||||
# The PC item storage object, which actually contains all the items.
|
||||
#===============================================================================
|
||||
class PCItemStorage
|
||||
attr_reader :items
|
||||
@@ -230,19 +230,21 @@ class PCItemStorage
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Implements methods that act on arrays of items. Each element in an item
|
||||
# array is itself an array of [itemID, itemCount].
|
||||
# Implements methods that act on arrays of items. Each element in an item array
|
||||
# is itself an array of [itemID, itemCount].
|
||||
# Used by the Bag, PC item storage, and Triple Triad.
|
||||
#===============================================================================
|
||||
module ItemStorageHelper
|
||||
# Returns the quantity of item in items
|
||||
def self.quantity(items, item)
|
||||
module_function
|
||||
|
||||
# Returns the quantity of item in items.
|
||||
def quantity(items, item)
|
||||
ret = 0
|
||||
items.each { |i| ret += i[1] if i && i[0] == item }
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.can_add?(items, max_slots, max_per_slot, item, qty)
|
||||
def can_add?(items, max_slots, max_per_slot, item, qty)
|
||||
raise "Invalid value for qty: #{qty}" if qty < 0
|
||||
return true if qty == 0
|
||||
max_slots.times do |i|
|
||||
@@ -260,7 +262,7 @@ module ItemStorageHelper
|
||||
return false
|
||||
end
|
||||
|
||||
def self.add(items, max_slots, max_per_slot, item, qty)
|
||||
def add(items, max_slots, max_per_slot, item, qty)
|
||||
raise "Invalid value for qty: #{qty}" if qty < 0
|
||||
return true if qty == 0
|
||||
max_slots.times do |i|
|
||||
@@ -280,8 +282,8 @@ module ItemStorageHelper
|
||||
return false
|
||||
end
|
||||
|
||||
# Deletes an item (items array, max. size per slot, item, no. of items to delete)
|
||||
def self.remove(items, item, qty)
|
||||
# Deletes an item (items array, max. size per slot, item, no. of items to delete).
|
||||
def remove(items, item, qty)
|
||||
raise "Invalid value for qty: #{qty}" if qty < 0
|
||||
return true if qty == 0
|
||||
ret = false
|
||||
|
||||
Reference in New Issue
Block a user