Skip to content

Commit 1575e3a

Browse files
committed
Rename {T,CT}State() functions to Team{...}()
This way the functions are nicely ordered when sorted alphabetically
1 parent 79f37b1 commit 1575e3a

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

demoinfocs_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ func TestDemoInfoCs(t *testing.T) {
7373
var winnerSide string
7474
switch e.Winner {
7575
case common.TeamTerrorists:
76-
winner = gs.TState()
77-
loser = gs.CTState()
76+
winner = gs.TeamTerrorists()
77+
loser = gs.TeamCounterTerrorists()
7878
winnerSide = "T"
7979
case common.TeamCounterTerrorists:
80-
winner = gs.CTState()
81-
loser = gs.TState()
80+
winner = gs.TeamCounterTerrorists()
81+
loser = gs.TeamTerrorists()
8282
winnerSide = "CT"
8383
default:
8484
// Probably match medic or something similar
@@ -204,19 +204,19 @@ func TestValveMatchmakingFuzzyEmitters(t *testing.T) {
204204
p.RegisterEventHandler(func(ev events.RoundEndedEvent) {
205205
switch ev.Winner {
206206
case common.TeamTerrorists:
207-
tScoreBeforeSwap = p.GameState().TState().Score() + 1
207+
tScoreBeforeSwap = p.GameState().TeamTerrorists().Score() + 1
208208

209209
case common.TeamCounterTerrorists:
210-
ctScoreBeforeSwap = p.GameState().CTState().Score() + 1
210+
ctScoreBeforeSwap = p.GameState().TeamCounterTerrorists().Score() + 1
211211
}
212212
})
213213

214214
p.RegisterEventHandler(func(fuzzy.TeamSwitchEvent) {
215215
teamSwitchDone = true
216-
if tScoreBeforeSwap != p.GameState().CTState().Score() {
216+
if tScoreBeforeSwap != p.GameState().TeamCounterTerrorists().Score() {
217217
t.Error("T-Score before swap != CT-Score after swap")
218218
}
219-
if ctScoreBeforeSwap != p.GameState().TState().Score() {
219+
if ctScoreBeforeSwap != p.GameState().TeamTerrorists().Score() {
220220
t.Error("CT-Score before swap != T-Score after swap")
221221
}
222222
})

examples/print-events/print_events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ func main() {
4343
switch e.Winner {
4444
case common.TeamTerrorists:
4545
// Winner's score + 1 because it hasn't actually been updated yet
46-
fmt.Printf("Round finished: winnerSide=T ; score=%d:%d\n", gs.TState().Score()+1, gs.CTState().Score())
46+
fmt.Printf("Round finished: winnerSide=T ; score=%d:%d\n", gs.TeamTerrorists().Score()+1, gs.TeamCounterTerrorists().Score())
4747
case common.TeamCounterTerrorists:
48-
fmt.Printf("Round finished: winnerSide=CT ; score=%d:%d\n", gs.CTState().Score()+1, gs.TState().Score())
48+
fmt.Printf("Round finished: winnerSide=CT ; score=%d:%d\n", gs.TeamCounterTerrorists().Score()+1, gs.TeamTerrorists().Score())
4949
default:
5050
// Probably match medic or something similar
5151
fmt.Println("Round finished: No winner (tie)")

fuzzy/team_switch.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ func (em *ValveMatchmakingTeamSwitchEmitter) handleLastRoundHalf(events.LastRoun
4242

4343
// Get scores before switch
4444
func (em *ValveMatchmakingTeamSwitchEmitter) handleRoundEnded(ev events.RoundEndedEvent) {
45-
em.tScoreBeforeSwitch = em.parser.GameState().TState().Score()
46-
em.ctScoreBeforeSwitch = em.parser.GameState().CTState().Score()
45+
em.tScoreBeforeSwitch = em.parser.GameState().TeamTerrorists().Score()
46+
em.ctScoreBeforeSwitch = em.parser.GameState().TeamCounterTerrorists().Score()
4747

4848
// Score hasn't been updated yet because CS:GO demos are weird
4949
switch ev.Winner {
@@ -65,8 +65,8 @@ func (em *ValveMatchmakingTeamSwitchEmitter) handleRoundStarted(events.RoundStar
6565

6666
// Wait for score to update - this isn't (necessarily?) the case after RoundStartedEvent
6767
func (em *ValveMatchmakingTeamSwitchEmitter) handleTickDone(events.TickDoneEvent) {
68-
tScoreOk := em.parser.GameState().TState().Score() == em.ctScoreBeforeSwitch
69-
ctScoreOk := em.parser.GameState().CTState().Score() == em.tScoreBeforeSwitch
68+
tScoreOk := em.parser.GameState().TeamTerrorists().Score() == em.ctScoreBeforeSwitch
69+
ctScoreOk := em.parser.GameState().TeamCounterTerrorists().Score() == em.tScoreBeforeSwitch
7070
if tScoreOk && ctScoreOk {
7171
em.dispatch(TeamSwitchEvent{})
7272

game_state.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ func (gs GameState) IngameTick() int {
2929
return gs.ingameTick
3030
}
3131

32-
// CTState returns the TeamState of the CT team.
32+
// TeamCounterTerrorists returns the TeamState of the CT team.
3333
//
3434
// Make sure to handle swapping sides properly if you keep the reference.
35-
func (gs *GameState) CTState() *TeamState {
35+
func (gs *GameState) TeamCounterTerrorists() *TeamState {
3636
return &gs.ctState
3737
}
3838

39-
// TState returns the TeamState of the T team.
39+
// TeamTerrorists returns the TeamState of the T team.
4040
//
4141
// Make sure to handle swapping sides properly if you keep the reference.
42-
func (gs *GameState) TState() *TeamState {
42+
func (gs *GameState) TeamTerrorists() *TeamState {
4343
return &gs.tState
4444
}
4545

0 commit comments

Comments
 (0)