Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CPP-CivLike-Game/main.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
110 lines (102 sloc)
2.92 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "include/termcolor.hpp" | |
#include "src/map.cpp" | |
#include "include/print.h" | |
#include "include/AI.h" | |
//#include "src/cities.cpp" | |
//#include "include/units.h" | |
#include "src/Units.cpp" | |
#include "include/aStarAlg.h" | |
//#include "src/civs.cpp" | |
#include "include/game.h" | |
#include <string> | |
#include <vector> | |
#include <tuple> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <map> | |
int main() { | |
int mapSizeX = 180 + 1; | |
int mapSizeY = 60 + 1; | |
srand(time(NULL)); | |
demoMap mapOne; | |
mapOne.emptyMapGenerate(mapSizeX, mapSizeY); //Using rectangles since it displays nicer in the window screen which is a rectangle | |
//GRASS, MOUTAIN, MARSH, HILL, DESERT, TUNDRA, PLAINS, FOREST | |
mapOne.boundsGeneration(); | |
for (int i = 0; i < 4; i++) { | |
mapOne.initalTerrainGeneration({ "grey", 'O', "MOUNTAIN" }); | |
} | |
for (int i = 0; i < 10; i++) | |
{ | |
mapOne.initalTerrainGeneration({ "green", 'G', "GRASS" }); | |
} | |
mapOne.initalTerrainGeneration({ "red", 'H', "HILL" }); | |
mapOne.secondLayerTerrainGen(); | |
print printer(mapOne); | |
printer.printAll(); | |
/* | |
Warrior potato2(4); | |
Warrior potato1(4); | |
Warrior testBoi(3); | |
City shitty, bit; | |
Settler toby; | |
//Settler *oven = new Settler(); | |
//Warrior *barong = new Warrior(); | |
//City *toaster = new City(); | |
testBoi.unitPos = { 34,34 }; | |
testBoi.strength = 10; | |
potato2.unitPos = { 35,35 }; | |
potato2.strength = 1; | |
potato2.unitPos = { 35,34 }; | |
potato1.strength = 1; | |
mapOne.mapSquares[35][34].warrior = &potato1; | |
mapOne.mapSquares[35][35].warrior = &potato2; | |
mapOne.mapSquares[34][34].warrior = &testBoi; | |
mapSizeX += 1; | |
mapSizeY += 1; | |
//mapOne.moveAttackWarriors(); | |
AI newAI(mapOne, mapSizeX, mapSizeY); | |
std::vector<coord> newVec = newAI.warriorDecision(testBoi); | |
if (newVec.empty()) | |
{ | |
std::cout << "No path found" << std::endl; | |
} | |
else | |
{ | |
for (int i = 0; i < newVec.size(); i++) | |
{ | |
std::cout << "X: " << newVec[i].x << " y: " << newVec[i].y << std::endl; | |
} | |
} | |
std::cout << "All working fine :)" << std::endl;*/ | |
/* | |
int NoPlayers = 0; | |
std::vector<Player> players; | |
std::cout << "Greetings! How many players art thou in total? "; | |
std::cin >> NoPlayers; | |
while (NoPlayers <= 0 || NoPlayers > 10) { | |
std::cout << "That doesn't sound right. How many players art thou in total? "; | |
std::cin >> NoPlayers; | |
} | |
for (int i = 0; i < NoPlayers; i++) { | |
auto newPlayer = Player(); | |
players.push_back(newPlayer); | |
} | |
*/ | |
/* | |
while (true) { | |
//std::string userInput = "N"; | |
for (int i = 1; i < Player::PlayerID; i++) { | |
while (userInput != "Y" || userInput != "y") { | |
std::cout << "Player " << i << " it's your turn." << std::endl; | |
mapOne.moveWarriors(i); | |
mapOne.moveSettlers(i); | |
mapOne.terrainPrint(); | |
std::cout << std::endl; | |
/*std::cout << "It looks like you've done all you can.\nWould you like to end your turn? (Y/N): "; | |
std::cin >> userInput; | |
} | |
} | |
//}*/ | |
return 0; | |
} |