Skip to content

Commit

Permalink
#10 Various changes on structs
Browse files Browse the repository at this point in the history
- Add connfail and delay time
- Refactor MemberCourse.Allowed
  • Loading branch information
expiteRz committed Jul 1, 2024
1 parent bc5aec9 commit 497098f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 6 additions & 4 deletions utils/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ type RoomMember struct {
Status string `json:"role"`
FinishTimes []int `json:"finish_times"` // FinishTimes[0] = Primary players time, FinishTimes[1] = Guest players time
Course MemberCourse `json:"course"`
Combos []Combo `json:"combos"` // Combo[0] = Primary players combo, Combo[1] = Guest players combo
Combos []Combo `json:"combos"` // Combo[0] = Primary players combo, Combo[1] = Guest players combo
DelayTime int `json:"delay_time"` // milliseconds
ConnFail float32 `json:"conn_fail"`
}

type MemberCourse struct {
Id int `json:"id"`
Name string `json:"name"`
Allowed string `json:"allowed"`
Id int `json:"id"`
Name string `json:"name"`
Category string `json:"category"`
}

type Combo struct {
Expand Down
10 changes: 7 additions & 3 deletions web/wiimmfi.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ func StartParseRoom() {
Status: player.OlRole,
FinishTimes: []int{player.Time[0]},
Course: utils.MemberCourse{
Name: player.Track[1].(string),
Id: int(player.Track[0].(float64)),
Allowed: player.Track[4].(string),
Name: player.Track[1].(string),
Id: int(player.Track[0].(float64)),
Category: player.Track[4].(string),
},
DelayTime: player.Delay[1],
ConnFail: player.ConnFail,
}
chara := utils.CharacterId(player.Driver[0])
vehicle := utils.VehicleId(player.Vehicle[0])
Expand Down Expand Up @@ -182,7 +184,9 @@ type SourceMemberParse struct {
Track [5]interface{} `json:"track"`
Driver []int `json:"driver"`
Vehicle []int `json:"vehicle"`
Delay []int `json:"delay"`
Time []int `json:"time"`
ConnFail float32 `json:"conn_fail"`
}

func InitParseRoom() (*SourceParse, bool, error) {
Expand Down

0 comments on commit 497098f

Please sign in to comment.