class WolfRpg::RouteCommand

Constants

TERMINATOR

Attributes

args[RW]
id[RW]

Public Class Methods

create(coder) click to toggle source
# File lib/wolfrpg/route.rb, line 3
def self.create(coder)
  # Read all data for this movement command from file
  id = coder.read_byte
  args = Array.new(coder.read_byte)
  args.each_index do |i|
    args[i] = coder.read_int
  end
  coder.verify(TERMINATOR)

  #TODO Create proper route command
  return RouteCommand.new(id, args)
end
new(id, args) click to toggle source
# File lib/wolfrpg/route.rb, line 28
def initialize(id, args)
  @id = id
  @args = args
end

Public Instance Methods

dump(coder) click to toggle source
# File lib/wolfrpg/route.rb, line 16
def dump(coder)
  coder.write_byte(@id)
  coder.write_byte(@args.size)
  @args.each do |arg|
    coder.write_int(arg)
  end
  coder.write(TERMINATOR)
end