Skip to content

Commit

Permalink
????
Browse files Browse the repository at this point in the history
  • Loading branch information
averrin committed Oct 13, 2017
1 parent 4e36fca commit db28a6d
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 214 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

IF(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable")
Expand Down
3 changes: 2 additions & 1 deletion include/mapgen/Biom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const float DEFAULT_HUMIDITY = 0.f;
const Biom DEEP = {-1.0000, sf::Color(39, 39, 70), "Deep", 0};
const Biom SHALLOW = {-0.2500, sf::Color(51, 51, 91), "Shallow", 0};
const Biom SHORE = {0.0000, sf::Color(68, 99, 130), "Shore", 0};
const Biom SAND = {0.0625, sf::Color(255,255,255), "Sand", 0};
// const Biom SAND = {0.0625, sf::Color(255,255,255), "Sand", 0};
const Biom SAND = {0.0625, sf::Color(210, 185, 139), "Sand", 0};
const Biom GRASS = {0.1250, sf::Color(136, 170, 85), "Grass", 0.8};
const Biom FORREST = {0.3750, sf::Color(51, 119, 85), "Forrest", 0.6};
const Biom ROCK = {0.7500, sf::Color(148, 148, 148), "Rock", 0};
Expand Down
2 changes: 1 addition & 1 deletion include/mapgen/City.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class City : public Location {
City(Region* r, std::string n, LocationType t);
Package* makeGoods(int y);
int buyGoods(std::vector<Package*>* goods);
EconomyVars* economyVars;
EconomyVars* economyVars = nullptr;

bool isCapital = false;

Expand Down
2 changes: 1 addition & 1 deletion include/mapgen/MapGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MapGenerator {
int getRelax();
float getFrequency();
int getSeed();
Region *getRegion(sf::Vector2f pos);
Region *getRegion(Region* r, sf::Vector2f pos);
std::vector<sf::ConvexShape> *getPolygons();
void seed();
std::vector<Region *> getRegions();
Expand Down
8 changes: 8 additions & 0 deletions include/mapgen/Painter.hpp
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
#include "mapgen/Region.hpp"
#include <SFML/Graphics.hpp>

struct DrawableRegion {
public:
sf::ConvexShape shape ;
Region* region;
int zIndex;
};
1 change: 1 addition & 0 deletions include/mapgen/Region.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Region {
State* state = nullptr;
bool stateBorder = false;
bool seaBorder = false;
bool isCoast();
private:
PointList _verticies;
HeightMap _heights;
Expand Down
4 changes: 1 addition & 3 deletions src/City.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ Package *City::makeGoods(int y) {
case MINE:
p = region->minerals * economyVars->PACKAGES_PER_MINERALS * population *
economyVars->PACKAGES_MINERALS_POPULATION_MODIFIER;
for (int n = 0; n < p; n++) {
goods = new Package(this, MINERALS, p);
}
goods = new Package(this, MINERALS, p);
break;
}
return goods;
Expand Down
11 changes: 5 additions & 6 deletions src/MapGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,12 +1104,11 @@ void MapGenerator::makeClusters() {
}
}

Region *MapGenerator::getRegion(sf::Vector2f pos) {
for (auto &pair : _cells) {
Cell *c = pair.first;
if (c->pointIntersection(pos.x, pos.y) != -1) {
return pair.second;
}
Region *MapGenerator::getRegion(Region* startRegion, sf::Vector2f pos) {
for (auto region : map->regions) {
if (region->cell->pointIntersection(pos.x, pos.y) != -1) {
return region;
}
}
return nullptr;
}
Expand Down
Loading

0 comments on commit db28a6d

Please sign in to comment.