diff --git a/menu.c b/menu.c index d2a847e..9c0e8a4 100644 --- a/menu.c +++ b/menu.c @@ -5,6 +5,8 @@ #include #include "ships.h" #include "menu.h" +#include "readobjects.h" +#include "readtraining.h" #define FILENAME_SIZE 40 @@ -48,8 +50,8 @@ void startMenu() { printf("What do you want to do\n"); printf("------------------------\n"); printf("1. Start a new ship\n"); - printf("2. Read a ship file"); - printf("3. Exit program\n"); + //printf("2. Read a ship file"); + printf("0. Exit program\n"); printf("------------------------\n"); printf("Your choice: "); int exitOrRead = 0; @@ -58,10 +60,10 @@ void startMenu() { case 1: creatingShip(); break; - case 2: - //editingShip(); - break; - case 3: + /*case 2: + editingShip(); + break;*/ + case 0: valid1 = false; // Quitter l'application break; default: @@ -97,7 +99,7 @@ void creatingShip() { printf("7. Reaper\n"); printf("8. Guardian\n"); printf("9. Striker\n"); - printf("10. Cancel\n"); + printf("0. Cancel\n"); printf("------------------------\n"); printf("Your choice: "); int choice = 0; @@ -283,7 +285,7 @@ void creatingShip() { } createShip = false; break; - case 10: + case 0: return; default: printf("Invalid choice, please try again\n"); @@ -303,7 +305,7 @@ void addObjects(struct Ship* s) { bool read_file = false; char* object_name = ""; char* rarity = ""; - int object_type = 0; + unsigned int object_type = 0; while(add_objects){ printf("It doesn't matter which type of object you add first\n"); printf("What type of object do you want to add ?\n"); @@ -314,7 +316,7 @@ void addObjects(struct Ship* s) { printf("4. Green (healing)\n"); printf("5. Teal (guardian's type)\n"); printf("6. Save ship\n"); - printf("7. Cancel ship\n"); + printf("0. Cancel ship\n"); printf("------------------------\n"); printf("Your choice: "); object_type = 0; @@ -361,13 +363,16 @@ void addObjects(struct Ship* s) { read_file = true; break; case 6: - //saveShipAs(s); + saveShipAs(s); + read_file = false; return; - case 7: + case 0: deleteShip(s); + read_file = false; return; default: printf("Invalid choice, please try again\n"); + read_file = false; clearInputBuffer(); } } @@ -588,6 +593,7 @@ char* chooseRarity() { } } +/* void editingShip() { clearInputBuffer(); printf("\nRead CSV file\n"); @@ -639,4 +645,4 @@ void editingShip() { clearInputBuffer(); } } -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/menu.h b/menu.h index 4da88ad..6146011 100644 --- a/menu.h +++ b/menu.h @@ -1,6 +1,9 @@ - #ifndef MENU_H #define MENU_H + + + + void start(); void clearInputBuffer(); void startMenu(); diff --git a/readobjects.c b/readobjects.c index 5c7e556..f98a9f2 100644 --- a/readobjects.c +++ b/readobjects.c @@ -1 +1,6 @@ #include "readobjects.h" + + +struct Object* readObjectFile(char* object_file_name, unsigned int object_type) { + +} \ No newline at end of file diff --git a/readobjects.h b/readobjects.h index b88ead0..3605e6c 100644 --- a/readobjects.h +++ b/readobjects.h @@ -1,4 +1,6 @@ #ifndef READOBJECTS_H #define READOBJECTS_H -#endif //READOBJECTS_H +struct Object* readObjectFile(char* object_file_name, unsigned int object_type); + +#endif diff --git a/readtraining.h b/readtraining.h index a7cfc0e..381de67 100644 --- a/readtraining.h +++ b/readtraining.h @@ -1,4 +1,7 @@ #ifndef READTRAINING_H #define READTRAINING_H -#endif //READTRAINING_H +void readAndApplyTraining(struct Object* o,char* training_file_name, unsigned int training_lvl); + + +#endif