Kaynağa Gözat

Debug attack/bomb

Arthur Brandao 6 yıl önce
ebeveyn
işleme
62b9897766
1 değiştirilmiş dosya ile 5 ekleme ve 3 silme
  1. 5 3
      Serveur/handler.c

+ 5 - 3
Serveur/handler.c

@@ -577,7 +577,7 @@ int handler_attack_bomb(int cliId, JsonParser* json) {
     int x, y, length, index, playerIndex = 0;
     Player* p = NULL;
     boolean ok = false;
-    JsonEncoder reponse;
+    JsonEncoder reponse, player;
     //Verification arguments
     if (get_pos(json, "class") == JSON_ERROR) {
         send_err_client(cliId, EREQUEST);
@@ -678,7 +678,9 @@ int handler_attack_bomb(int cliId, JsonParser* json) {
     //Reponse
     if (ok) {
         add_integer(&reponse, "status", 201);
-        describe_player(p, &reponse);
+        describe_player(p, &player);
+        add_object(&reponse, "player", &player);
+        clean_json_encoder(&player);
         //Envoi
         if (!send_client(cliId, &reponse)) {
             adderror("Impossible de répondre au client");
@@ -695,7 +697,7 @@ int handler_attack_bomb(int cliId, JsonParser* json) {
         clean_json_encoder(&reponse);
         add_string(&reponse, "pos", pos);
         add_string(&reponse, "class", class);
-        notify_player(&game[index], "POST", "attack/newbomb", &reponse, cliId);
+        notify_player(&game[index], "POST", "attack/newbomb", &reponse, -1);
     } else {
         add_integer(&reponse, "status", 403);
         add_string(&reponse, "message", "Forbidden action");