mirror of
https://github.com/komiko44240BB/BattleBay_tool_v1.0.git
synced 2026-01-18 16:27:29 +01:00
Update menu.c
This commit is contained in:
156
menu.c
156
menu.c
@@ -296,88 +296,90 @@ void creatingShip() {
|
||||
}
|
||||
|
||||
void addObjects(struct Ship* s) {
|
||||
clearInputBuffer();
|
||||
bool add_objects = true;
|
||||
bool read_file = false;
|
||||
char* object_name = "";
|
||||
char* rarity = "";
|
||||
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");
|
||||
printf("------------------------\n");
|
||||
printf("1. Red (weapons)\n");
|
||||
printf("2. Blue (passives)\n");
|
||||
printf("3. Yellow (utility)\n");
|
||||
printf("4. Green (healing)\n");
|
||||
printf("5. Teal (guardian's type)\n");
|
||||
printf("6. Save ship\n");
|
||||
printf("7. Cancel adding an object\n");
|
||||
printf("------------------------\n");
|
||||
printf("Your choice: ");
|
||||
object_type = 0;
|
||||
for(int i = 0; i < 8 ; i++){
|
||||
clearInputBuffer();
|
||||
scanf("%d", &object_type);
|
||||
switch (object_type){
|
||||
case 1:
|
||||
object_name = strdup(chooseWeapon(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 2:
|
||||
object_name = strdup(choosePasive(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 3:
|
||||
object_name = strdup(chooseUtility(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 4:
|
||||
object_name = strdup(chooseHealing(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 5:
|
||||
object_name = strdup(chooseTeal(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 6:
|
||||
saveShipAs(s);
|
||||
return;
|
||||
case 7:
|
||||
add_objects = false;
|
||||
read_file = false;
|
||||
default:
|
||||
printf("Invalid choice, please try again\n");
|
||||
bool add_objects = true;
|
||||
bool read_file = false;
|
||||
char* object_name = "";
|
||||
char* rarity = "";
|
||||
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");
|
||||
printf("------------------------\n");
|
||||
printf("1. Red (weapons)\n");
|
||||
printf("2. Blue (passives)\n");
|
||||
printf("3. Yellow (utility)\n");
|
||||
printf("4. Green (healing)\n");
|
||||
printf("5. Teal (guardian's type)\n");
|
||||
printf("6. Save ship\n");
|
||||
printf("7. Cancel ship\n");
|
||||
printf("------------------------\n");
|
||||
printf("Your choice: ");
|
||||
object_type = 0;
|
||||
clearInputBuffer();
|
||||
scanf("%d", &object_type);
|
||||
switch (object_type){
|
||||
case 1:
|
||||
object_name = strdup(chooseWeapon(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 2:
|
||||
object_name = strdup(choosePasive(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 3:
|
||||
object_name = strdup(chooseUtility(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 4:
|
||||
object_name = strdup(chooseHealing(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 5:
|
||||
object_name = strdup(chooseTeal(s));
|
||||
rarity = strdup(chooseRarity());
|
||||
add_objects = false;
|
||||
read_file = true;
|
||||
break;
|
||||
case 6:
|
||||
saveShipAs(s);
|
||||
return;
|
||||
case 7:
|
||||
deleteShip(s);
|
||||
return;
|
||||
default:
|
||||
printf("Invalid choice, please try again\n");
|
||||
clearInputBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(read_file){
|
||||
char* object_file_name = malloc(strlen(object_name) + strlen(rarity) + 5 + 1);
|
||||
sprintf(object_file_name, "%s_%s.csv", object_name, rarity);
|
||||
struct Object* o = readObjectFile(object_file_name, object_type);
|
||||
if(read_file){
|
||||
char* object_file_name = malloc(strlen(object_name) + strlen(rarity) + 5 + 1);
|
||||
sprintf(object_file_name, "%s_%s.csv", object_name, rarity);
|
||||
struct Object* o = readObjectFile(object_file_name, object_type);
|
||||
|
||||
printf("------------------------\n");
|
||||
printf("What is the level of training of your object ?\n");
|
||||
printf("------------------------\n");
|
||||
printf("Your choice: ");
|
||||
clearInputBuffer();
|
||||
int training_lvl = 0;
|
||||
scanf("%d", &training_lvl);
|
||||
if(training_lvl > 0){
|
||||
char* training_file_name = malloc(strlen(object_name) + 8 + 5 + 1);
|
||||
sprintf(training_file_name, "%s_training.csv", object_name);
|
||||
readAndApplyTraining(o,training_file_name, training_lvl);
|
||||
printf("------------------------\n");
|
||||
printf("What is the level of training of your object ?\n");
|
||||
printf("------------------------\n");
|
||||
printf("Your choice: ");
|
||||
clearInputBuffer();
|
||||
int training_lvl = 0;
|
||||
scanf("%d", &training_lvl);
|
||||
if(training_lvl > 0){
|
||||
char* training_file_name = malloc(strlen(object_name) + 8 + 5 + 1);
|
||||
sprintf(training_file_name, "%s_training.csv", object_name);
|
||||
readAndApplyTraining(o,training_file_name, training_lvl);
|
||||
}
|
||||
addOject(s,o);
|
||||
}
|
||||
addOject(s,o);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user