Class: TCLog::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/tclog.rb

Defined Under Namespace

Classes: PlayerArray

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(orders = [], gametype = :obj) ⇒ Game

:nodoc:



63
64
65
66
67
68
69
70
# File 'lib/tclog.rb', line 63

def initialize(orders = [], gametype = :obj) # :nodoc:
  @orders = orders
  @gametype = gametype
  @rounds = []
  @round_n = -1
  @round_r = -1
  @players = PlayerArray.new
end

Instance Attribute Details

#gametypeObject (readonly)

Gametype. obj, bc, ctf.



113
114
115
# File 'lib/tclog.rb', line 113

def gametype
  @gametype
end

#ordersObject (readonly)

Parser VM call stacks.



110
111
112
# File 'lib/tclog.rb', line 110

def orders
  @orders
end

#playersObject (readonly)

All players.



107
108
109
# File 'lib/tclog.rb', line 107

def players
  @players
end

#round_rObject (readonly)

:nodoc:



98
99
100
# File 'lib/tclog.rb', line 98

def round_r
  @round_r
end

#roundsObject (readonly)

Logged rounds.



104
105
106
# File 'lib/tclog.rb', line 104

def rounds
  @rounds
end

Instance Method Details

#[](i) ⇒ Object

Has same mean as game.rounds



101
# File 'lib/tclog.rb', line 101

def [](i); @rounds[i]; end

#add_map(map_name) ⇒ Object

:nodoc:



73
74
75
76
# File 'lib/tclog.rb', line 73

def add_map(map_name) # :nodoc:
  @round_r += 1
  @rounds << Round.new(self, nil, @round_r, :map, true, map_name); self
end

#add_player(name) ⇒ Object

:nodoc:



88
89
90
91
92
93
94
# File 'lib/tclog.rb', line 88

def add_player(name) # :nodoc:
  @players << Player.new(name)
  if 0 <= @round_r
    @players[name].push_result(@round_r)
  end
  self
end

#add_round(specops, terrorists, won) ⇒ Object

:nodoc:



78
79
80
81
82
83
84
85
86
# File 'lib/tclog.rb', line 78

def add_round(specops,terrorists,won) # :nodoc:
  @round_n += 1
  @round_r += 1
  r = Round.new(self, @round_n, @round_r, won)
  r.specops = specops.dup
  r.terrorists = terrorists.dup
  @rounds << r
  self
end

#roundObject

:nodoc:



97
# File 'lib/tclog.rb', line 97

def round; @round_n; end