|  | @@ -223,6 +223,18 @@ int handler_game_create(int cliId, JsonParser* json) {
 | 
	
		
			
				|  |  |          clean_json_encoder(&reponse);
 | 
	
		
			
				|  |  |          return FAIL;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    //Cherche pos de depart random
 | 
	
		
			
				|  |  | +    int x = 0, y = 0;
 | 
	
		
			
				|  |  | +    srand(time(NULL));
 | 
	
		
			
				|  |  | +    do{
 | 
	
		
			
				|  |  | +        x = rand() % game[index].width;
 | 
	
		
			
				|  |  | +        y = rand() % game[index].height;
 | 
	
		
			
				|  |  | +    }while(game[index].map[x][y] != '_');
 | 
	
		
			
				|  |  | +    game[index].player[joueur]->x = x;
 | 
	
		
			
				|  |  | +    game[index].player[joueur]->y = y;
 | 
	
		
			
				|  |  | +    char pos[25];
 | 
	
		
			
				|  |  | +    memset(pos, 0, 25);
 | 
	
		
			
				|  |  | +    snprintf(pos, 25, "%d,%d", x, y);
 | 
	
		
			
				|  |  |      //Recup info
 | 
	
		
			
				|  |  |      describe_game(&game[index], joueur, &reponse);
 | 
	
		
			
				|  |  |      //Ajout infos
 | 
	
	
		
			
				|  | @@ -230,7 +242,7 @@ int handler_game_create(int cliId, JsonParser* json) {
 | 
	
		
			
				|  |  |      sprintf(msg, "Game created with %s", map);
 | 
	
		
			
				|  |  |      add_integer(&reponse, "status", 201);
 | 
	
		
			
				|  |  |      add_string(&reponse, "message", msg);
 | 
	
		
			
				|  |  | -    add_string(&reponse, "startPos", "1,1");
 | 
	
		
			
				|  |  | +    add_string(&reponse, "startPos", pos);
 | 
	
		
			
				|  |  |      free(msg);
 | 
	
		
			
				|  |  |      //Envoi
 | 
	
		
			
				|  |  |      if (!send_client(cliId, &reponse)) {
 | 
	
	
		
			
				|  | @@ -284,11 +296,23 @@ int handler_game_join(int cliId, JsonParser* json) {
 | 
	
		
			
				|  |  |          free(name);
 | 
	
		
			
				|  |  |          return FAIL;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    //Cherche pos de depart random
 | 
	
		
			
				|  |  | +    int x = 0, y = 0;
 | 
	
		
			
				|  |  | +    srand(time(NULL));
 | 
	
		
			
				|  |  | +    do{
 | 
	
		
			
				|  |  | +        x = rand() % game[index].width;
 | 
	
		
			
				|  |  | +        y = rand() % game[index].height;
 | 
	
		
			
				|  |  | +    }while(game[index].map[x][y] != '_');
 | 
	
		
			
				|  |  | +    game[index].player[joueur]->x = x;
 | 
	
		
			
				|  |  | +    game[index].player[joueur]->y = y;
 | 
	
		
			
				|  |  | +    char pos[25];
 | 
	
		
			
				|  |  | +    memset(pos, 0, 25);
 | 
	
		
			
				|  |  | +    snprintf(pos, 25, "%d,%d", x, y);
 | 
	
		
			
				|  |  |      //Recup info
 | 
	
		
			
				|  |  |      describe_game(&game[index], joueur, &reponse);
 | 
	
		
			
				|  |  |      //Ajout infos
 | 
	
		
			
				|  |  |      add_integer(&reponse, "status", 201);
 | 
	
		
			
				|  |  | -    add_string(&reponse, "startPos", "1,1");
 | 
	
		
			
				|  |  | +    add_string(&reponse, "startPos", pos);
 | 
	
		
			
				|  |  |      //Envoi
 | 
	
		
			
				|  |  |      if (!send_client(cliId, &reponse)) {
 | 
	
		
			
				|  |  |          adderror("Impossible de répondre au client");
 |