|
@@ -4,6 +4,7 @@
|
|
*
|
|
*
|
|
* Created on 28 novembre 2018
|
|
* Created on 28 novembre 2018
|
|
*/
|
|
*/
|
|
|
|
+#define _XOPEN_SOURCE 500
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
@@ -143,12 +144,11 @@ int create_game(char* name, char* map){
|
|
//Recup la map
|
|
//Recup la map
|
|
length = strlen(MAPDIR) + strlen(map);
|
|
length = strlen(MAPDIR) + strlen(map);
|
|
path = new_string(length);
|
|
path = new_string(length);
|
|
- sprintf(path, "%s%s", MAPDIR, map);
|
|
|
|
|
|
+ snprintf(path, length + 1, "%s%s", MAPDIR, map);
|
|
game[index].mapContent = file_get_content(path);
|
|
game[index].mapContent = file_get_content(path);
|
|
//Calcul taille de la map
|
|
//Calcul taille de la map
|
|
size = map_size(game[index].mapContent);
|
|
size = map_size(game[index].mapContent);
|
|
//Set Up
|
|
//Set Up
|
|
- length = strlen(name) + 1;
|
|
|
|
game[index].active = true;
|
|
game[index].active = true;
|
|
game[index].name = string_copy(name);
|
|
game[index].name = string_copy(name);
|
|
game[index].nbPlayer = 0;
|
|
game[index].nbPlayer = 0;
|
|
@@ -252,6 +252,11 @@ boolean notify_player(Game* g, char* method, char* ressource, JsonEncoder* param
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void remove_player(Game* g, int playerIndex){
|
|
|
|
+ g->nbPlayer--;
|
|
|
|
+ delete_player(g->player[playerIndex]);
|
|
|
|
+}
|
|
|
|
+
|
|
void stop_game(Game* g){
|
|
void stop_game(Game* g){
|
|
//Indique comme inactive
|
|
//Indique comme inactive
|
|
g->active = false;
|
|
g->active = false;
|