Skip to content
Snippets Groups Projects

Improve basic front

Merged Pierre Gibertini requested to merge improve_basic_front into main
12 files
+ 335
60
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
agt "gitlab.utc.fr/pixelwar_ia04/pixelwar/agent"
"gitlab.utc.fr/pixelwar_ia04/pixelwar/painting"
"log"
"net/http"
)
@@ -41,6 +42,7 @@ func (srv *Server) doGetCanvas(w http.ResponseWriter, r *http.Request) {
return
}
// traitement de la requête
gridHeight := srv.places[req.PlaceID].canvas.GetHeight()
gridWidth := srv.places[req.PlaceID].canvas.GetWidth()
grid := &srv.places[req.PlaceID].canvas.Grid
@@ -49,6 +51,10 @@ func (srv *Server) doGetCanvas(w http.ResponseWriter, r *http.Request) {
log.Printf("get_canvas: place-id=%s\n", req.PlaceID)
}
if req.ResetDiff {
srv.places[req.PlaceID].diff = make(map[int]painting.HexPixel)
}
resp := agt.GetCanvasResponse{Height: gridHeight, Width: gridWidth, Grid: *grid}
w.WriteHeader(http.StatusOK)
Loading