Skip to content
Snippets Groups Projects
Commit 41c743bb authored by Belkaroui MohamedMoetez's avatar Belkaroui MohamedMoetez
Browse files

plusieurs drones

parent c1ee2f78
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -183,10 +183,9 @@ int main() {
}
fprintf(f, "%d %d\n", atoi(myArray[0]), atoi(myArray[1]));
fprintf(f, "%d %d %s %s\n", atoi(myArray[2]),
atoi(myArray[3]),
myArray[4],
myArray[5]);
for (int i = 2; i < elementCount; i += 4) {
fprintf(f, "%d %d %s %s\n", atoi(myArray[i]), atoi(myArray[i + 1]), myArray[i + 2], myArray[i + 3]);
}
fclose(f);
srand(time(NULL));
......@@ -223,7 +222,19 @@ int main() {
pthread_cancel(display);
pthread_join(display, NULL);
// Affichage final des informations des drones
affichage(hl, liste_drones);
//affichage(hl, liste_drones);
char droneInfo[1024] = ""; // Vous pouvez ajuster la taille selon vos besoins
for (int i = 0; i < liste_drones.nombre_drones; ++i) {
sprintf(droneInfo + strlen(droneInfo), "Drone %d :\n", i + 1);
sprintf(droneInfo + strlen(droneInfo), "Position drone finale : (%d, %d, %c)\n",
liste_drones.positions[i].x,
liste_drones.positions[i].y,
liste_drones.positions[i].orientation);
sprintf(droneInfo + strlen(droneInfo), "Commande : %s\n", liste_drones.commandes[i]);
}
// Send a response to the client with drone information
sendto(serverSocket, droneInfo, strlen(droneInfo), 0, (struct sockaddr*)&clientAddr, clientAddrLen);
// Libération de la mémoire
for (int i = 0; i < hl.hauteur; i++) {
free(tableau[i]);
......
No preview for this file type
10 10
0 5 N LMLL
20 20
0 5 N LMLMLMLMM
5 0 S MMRMMRMRRM
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment