Pārlūkot izejas kodu

Modification ini et ajout object

Arthur Brandao 6 gadi atpakaļ
vecāks
revīzija
793577fe72
3 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 2 0
      Serveur/game.c
  2. 2 0
      Serveur/game.h
  3. 2 2
      Serveur/player.c

+ 2 - 0
Serveur/game.c

@@ -175,6 +175,8 @@ int create_game(char* name, char* map) {
         game[index].player[i] = malloc(sizeof (Player));
         game[index].player[i]->ini = false;
     }
+    game[index].object = malloc(sizeof(Object));
+    object_ini(game[index].object);
     pthread_mutex_unlock(&gameMutex[index]);
     //Retourne la position de la partie dans le tableau
     nbGame++;

+ 2 - 0
Serveur/game.h

@@ -13,6 +13,7 @@
 #include "constante.h"
 #include "player.h"
 #include "json.h"
+#include "object.h"
 
 /* --- Constante --- */
 #define WIDTH 0
@@ -30,6 +31,7 @@ typedef struct{
     int height; //Hauteur de la map
     char** map; //Map
     Player* player[MAXPLAYER]; //Les joueurs actuels
+    Object* object; //Les objets sur la map
 }Game;
 
 /* --- Extern --- */

+ 2 - 2
Serveur/player.c

@@ -14,8 +14,8 @@ void create_player(Player* p, Client* c){
     p->ini = true;
     p->id = c->id;
     p->cli = c;
-    p->x = 0;
-    p->y = 0;
+    p->x = 1;
+    p->y = 1;
     p->life = 100;
     p->maxLife = 100;
     p->speed = 1;