mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 21:56:50 -04:00
Don't allow committing score if co-op points don't match.
This commit is contained in:
@@ -179,7 +179,16 @@ func ScoringDisplayWebsocketHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// Don't allow committing the score until the match is over.
|
||||
continue
|
||||
}
|
||||
// TODO(pat): Don't allow committing and show an error message if the red/blue co-op points aren't equal.
|
||||
|
||||
redScore := mainArena.redRealtimeScore.CurrentScore
|
||||
blueScore := mainArena.blueRealtimeScore.CurrentScore
|
||||
if redScore.CoopertitionSet != blueScore.CoopertitionSet ||
|
||||
redScore.CoopertitionStack != blueScore.CoopertitionStack {
|
||||
// Don't accept the score if the red and blue co-opertition points don't match up.
|
||||
websocket.ShowDialog("Cannot commit score: Red and blue co-opertition points do not match.")
|
||||
continue
|
||||
}
|
||||
|
||||
(*score).AutoCommitted = true
|
||||
(*score).TeleopCommitted = true
|
||||
mainArena.scoringStatusNotifier.Notify(nil)
|
||||
|
||||
@@ -20,6 +20,11 @@ var CheesyWebsocket = function(path, events) {
|
||||
}
|
||||
}
|
||||
|
||||
// Insert an event to show a dialog when the server wishes it.
|
||||
events.dialog = function(event) {
|
||||
alert(event.data);
|
||||
}
|
||||
|
||||
// Insert an event to allow the server to force-reload the client for any display.
|
||||
events.reload = function(event) {
|
||||
location.reload();
|
||||
|
||||
4
web.go
4
web.go
@@ -74,6 +74,10 @@ func (websocket *Websocket) WriteError(errorMessage string) error {
|
||||
return websocket.conn.WriteJSON(WebsocketMessage{"error", errorMessage})
|
||||
}
|
||||
|
||||
func (websocket *Websocket) ShowDialog(message string) error {
|
||||
return websocket.conn.WriteJSON(WebsocketMessage{"dialog", message})
|
||||
}
|
||||
|
||||
// Serves the root page of Cheesy Arena.
|
||||
func IndexHandler(w http.ResponseWriter, r *http.Request) {
|
||||
template, err := template.ParseFiles("templates/index.html", "templates/base.html")
|
||||
|
||||
Reference in New Issue
Block a user