More or less standardised separator comments in the code

This commit is contained in:
Maruno17
2024-06-27 21:21:26 +01:00
parent 225549bfce
commit 509a414f37
198 changed files with 1907 additions and 1263 deletions

View File

@@ -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