//******************************************************************************************** // int checkIfAtPlanetMenu() // This method is used when you get to a planet to generate the buy and sell option // as of right now the planet.getPlanetName() is giving errors so it is left blank //******************************************************************************************** int checkIfAtPlanetMenu(ship &s,planet &p) { int input = 0; system("cls"); cout << "Welcome to --Fix Planet Name--... " << "Planet Description goes here?? Maybe?." << endl << endl; cout << "\nIron: " << p.getIronQuantity() << endl; cout << "\nSugar: " << p.getSugarQuantity() << endl; cout << "\nRice: " << p.getRiceQuantity() << endl; cout << "\nFuel: " << p.getFuel() << endl; cout << "1. Buy Iron: " << endl; cout << "2. Buy Sugar: " << endl; cout << "3. Buy Rice: " << endl; cout << "4. Sell Iron: " << endl; cout << "5. Sell Sugar: " << endl; cout << "6. Sell Rice: " << endl; cout << "7. Buy Fuel: " << endl; cout << "8. Exit planet" << endl; cout << "You have " << "Rice - " << s.getRice() << " Iron - " << s.getIron() << " Sugar - " << s.getSugar() << endl; cout << "SpaceBucks - " << s.getFunds() << " Fuel - " << s.getFuel() << " Cargo Max - " << s.getCARGO_MAX() << endl; cout << "What do you want to do?"; cin >> input; return input; }
//******************************************************************************************** // void checkIfAtMoonMenu() // This method is used to start the game at your home base of the moon // This can be changed. //******************************************************************************************** int checkIfAtMoonMenu(ship &s,planet &j,planet &e,planet &m,planet &g,planet &M,planet &S,planet &n,planet &p,planet &c) { int input = 0; system("cls"); cout << "Welcome to the Moon, your home base " << "Planet Description goes here?? Maybe?." << endl << endl; cout << ":::Space News::: " << endl; cout << "Planet " << "Iron" << "\t" << "Price" << "\t" << "Sugar" << "\t" << "Price" << "\t" << "Rice" << "\t" << "Price" << endl; // cout << "Jupiter " << << "\t" << j.getIronQuantityDesired() << "\t" << j.getSugar() << "\t" << j.getSugarPrice() << "\t" << j.getRice() << "\t" << j.getRicePrice() << endl; // cout << "Earth " << << "\t" << e.getIronQuantityDesired() << "\t" << e.getSugar() << "\t" << e.getSugarPrice() << "\t" << e.getRice() << "\t" << e.getRicePrice() << endl; // cout << "Ganymede " << g.getIronQuantity() << "\t" << g.getIronQuantityDesired() << "\t" << g.getSugar() << "\t" << g.getSugarPrice() << "\t" << g.getRice() << "\t" << g.getRicePrice() << endl; // cout << "Mars " << m.getIronQuantity() << "\t" << m.getIronQuantityDesired() << "\t" << m.getSugar() << "\t" << m.getSugarPrice() << "\t" << m.getRice() << "\t" << m.getRicePrice() << endl; // cout << "Saturn " << S.getIronQuantity() << "\t" << S.getIronQuantityDesired() << "\t" << S.getSugar() << "\t" << S.getSugarPrice() << "\t" << S.getRice() << "\t" << S.getRicePrice() << endl; // cout << "Neptune " << n.getIronQuantity() << "\t" << n.getIronQuantityDesired() << "\t" << n.getSugar() << "\t" << n.getSugarPrice() << "\t" << n.getRice() << "\t" << n.getRicePrice() << endl; // cout << "Pluto " << p.getIronQuantity() << "\t" << p.getIronQuantityDesired() << "\t" << p.getSugar() << "\t" << p.getSugarPrice() << "\t" << p.getRice() << "\t" << p.getRicePrice() << endl; // cout << "Ceres " << c.getIronQuantity() << "\t" << c.getIronQuantityDesired() << "\t" << c.getSugar() << "\t" << c.getSugarPrice() << "\t" << c.getRice() << "\t" << c.getRicePrice() << endl; //cout << "Jupiter" << j.getIronQuantity() << "\t" << j.getIronQuantityDesiredQuantity() << "\t" << j.getSugar() << "\t" << j.getSugarPrice() << "\t" << j.getRice() << "\t" << j.getRicePrice() << endl; cout << endl; // cout << "\nRice: " << p.getRice() << endl; //cout << "\nFuel: " << p.getFuel() << endl; cout << "1. Check Mail Box: -- Not Functional... " << endl; cout << "2. Repair Ship: -- Not Functional... " << endl; cout << "3. Upgrade Ship: -- Not Functional... " << endl; cout << "4. Pick Up Passengers: -- Not Functional... " << endl; cout << "5. Talk to people listen to space news... -- not functional... " << endl; cout << "6. Leave Space Station... -- This works!" << endl; cout << endl; cout << "You have " << "Rice - " << s.getRice() << " Iron - " << s.getIron() << " Sugar - " << s.getSugar() << endl; cout << "SpaceBucks - " << s.getFunds() << " Fuel - " << s.getFuel() << " Cargo Max - " << s.getCARGO_MAX() << endl; cout << "What do you want to do?"; cin >> input; return input; }
//*********************************************************************************** // void drawHUD() // This is a simple function to draw out the text description of where you are // // //********************************************************************************** int drawHUD(int mx, int my, ship &s) { string asciiPos; string stringX; string stringY; int eight=8; int input=0; cout << "The Moon (m), your home base is located at: "; //SetConsoleTextAttribute(hOut, FOREGROUND_GREEN); cout << mx << ", " << my << " - You are located at: " << s.getX() << ", " << s.getY(); //SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); cout << "\nStatus - Fuel: " << s.getFuel() << " Spacebucks: " << s.getFunds() << endl; cout << "Cargo Hold: Rice: " << s.getRice() << " IRON: " << s.getIron() << " SUGAR: " << s.getSugar() << endl; //cout << "What do you want to do? (1 +x 2 -x 3 +y 4 -y -- 8 is quit) "; cout << "Where do you want to move? (XX,YY -- 8 is quit) "; cin >> asciiPos; // error cehcking for input outfile.open("inputLog.txt", ios::app); outfile << "The time is: " << asctime(localtm) << " " << "asciiPos: " << asciiPos << endl; outfile.close(); // --------------- if (asciiPos == "8"){ exit(0); } stringX=asciiPos.substr(0,2); stringY=asciiPos.substr(3,5); parseMovement(stringX,stringY,s); //parseStringY(stringY,s.getY()); if (atoi(asciiPos.c_str()) == eight) { input=8; } else { // Input is coming in a format of XX,YY a five char string // it is beingsplit assuming that the input is two chars comma and two more // each value is being assigned to the x,y value - which is strange because I think // the x,y value is opposite anyway. =P // s.setX(atoi(stringX.c_str())); // must cast the string into an integer so that you can repostion your ship //s.setY(atoi(stringY.c_str())); // ditto } return input; }
// added by Soren Haurburg //void Planet::Shop(int &money, int &fuel, Commodity &shipIron, Commodity &shipSugar, Commodity &shipRice, int CARGO_MAX) void planet::Shop(ship &s) { // HANDLE hStdout; // hStdout = GetStdHandle(STD_OUTPUT_HANDLE); // SetConsoleActiveScreenBuffer(hStdout); char pressedKey = '0'; while(pressedKey != 'E' && pressedKey != 'e') { system("cls"); // SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN | FOREGROUND_RED); cout << "\n\t\t\tWelcome to " << *planetName << endl; int n=0; for (n=0;n < 24; n++) { printf("\n"); } // SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE); cout << "\tYou have the follwing..." << endl; cout << "\t\tIron: " << s.getIron() << "Sugar: " << s.getSugar() << "Rice: " << s.getRice() << endl; cout << "\t\tMoney: " << s.getFunds() << "Fuel: " << s.getFuel() << "Cargo Space left: " << s.getCARGO_MAX()-(s.getIron()+s.getRice()+s.getSugar()) << endl; cout << "\n\tHere are your available actions on planet " << /*planetName*/ "Jupiter" << ":" << endl; if (ironDesiredQuantity>ironQuantity) { cout << "\n\t\t\t1. "<< *planetName << "will Buy Iron for: " << ((ironDesiredQuantity/ironQuantity) * ironQuantity) << endl; } else { cout << "\t\t\t5. " << *planetName << "will sell Iron for: " << ((ironQuantity/ironDesiredQuantity) * ironQuantity) << endl; } /*cout << "\n\t\t\t1. Buy Iron for: " << Iron.getBuyValue() << endl; cout << "\t\t\t2. Buy Sugar for: " << Sugar.getBuyValue() << endl; cout << "\t\t\t3. Buy Rice for: " << Rice.getBuyValue() << endl; cout << "\t\t\t4. Buy Fuel for: " << fuelPrice << endl; cout << "\t\t\t5. Sell Iron for: " << Iron.getSellValue() << endl; cout << "\t\t\t6. Sell Sugar for: " << Sugar.getSellValue() << endl; cout << "\t\t\t7. Sell Rice for: " << Rice.getSellValue() << endl; cout << "\t\t\tU. Buy Upgrades" << endl; */ cout << "\t\t\tE. Exit " << "Planet Name Here"; cin >> pressedKey; switch(pressedKey) { case '1': buyCommodity(s, "Iron"); break; case '2': // buyCommodity(s, Sugar); break; case '3': // buyCommodity(s, Rice); break; case '4': // buyFuel(s); break; case '5': sellCommodity(s, "Iron"); break; case '6': // sellCommodity(s, Sugar); break; case '7': // sellCommodity(s, Rice); break; case 'U': // upgradeShip(s); break; case 'u': // upgradeShip(s); break; case 'E': //leaving planet break; case 'e': //leaving planet break; default: cout << "Please pick one of the available options. " << endl; break; }// end of switch } }