Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Map.h"
- #include<iostream>
- #include<string>
- #include<vector>
- using namespace std;
- int main()
- {
- vector<Map> mapVector;
- Map capitol(0, "Capitol", "Where the hunger games are held every year. It is the capitol \
- city of Panem. The capitol is a wealthy urban city supported by its sourrounding impovershed \
- twelve districts.", "", "District 1", "", "District 11");
- Map district1(1, "District 1", "District 1 produces luxury items for the capital. They are known for\
- producing 'Careers', children who are chosen to train specifically for the hunger games.", "Capitol", "",
- "", "District 12");
- Map district11(2, "District 11", "District 11 produces agriculture products, the girl Rue, a 12 year old tribute is from \
- District 11. Rue is frail, but wily as she can manuevar easily in the trees.\
- Rue teams up with Katniss during the hunger games until she is killed by District 1's Marvel.", "", "District 12",
- "Capitol", "");
- Map district12(3, "District 12", "District 12 produces coal, Katniss Everdeen and Peeta Mallark \
- are the two hunger games tributes from District 12.", "District 11", "", "District 1", "");
- mapVector.push_back(capitol);
- mapVector.push_back(district1);
- mapVector.push_back(district11);
- mapVector.push_back(district12);
- string userInput = "";
- int currentMap = capitol.getmapIndex(); //start at the capitol
- while(userInput.compare("Exit") != 0)
- {
- cout << "You are in the " << mapVector[currentMap].getName() << ".\n";
- cout << mapVector[currentMap].getDescription() << endl;
- cout << "Enter a Direction: ";
- getline(cin, userInput);
- while(userInput.compare("West") != 0
- && userInput.compare("East") != 0
- && userInput.compare("North") != 0
- && userInput.compare("South") != 0
- && userInput.compare("Exit") != 0)
- {
- cout << "Enter a Direction: ";
- getline(cin, userInput);
- }
- if(userInput.compare("Exit") !=0)
- {
- //map has a neighbor in direction
- if(mapVector[currentMap].getNeighbor(userInput) != -1)
- {
- currentMap = mapVector[currentMap].getNeighbor(userInput);
- }
- //map does not have a neighbor in that direction
- else if(mapVector[currentMap].getNeighbor(userInput) == -1)
- {
- cout << "Sorry there is nothing to the " << userInput << ".\n";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement