Browse Source

make World::addPlane slightly clearer

opengl-renderer-broken
Martin Dørum 4 years ago
parent
commit
201dffd6fc
4 changed files with 6 additions and 5 deletions
  1. 1
    1
      core.mod/src/WGDefault.h
  2. 1
    1
      libswan/include/swan/WorldGen.h
  3. 1
    1
      libswan/src/SRF.cc
  4. 3
    2
      libswan/src/World.cc

+ 1
- 1
core.mod/src/WGDefault.h View File

@@ -8,7 +8,7 @@ class WGDefault: public Swan::WorldGen {
public:
class Factory: public Swan::WorldGen::Factory {
public:
WorldGen *create(Swan::World &world) { return new WGDefault(world); }
WorldGen *create(Swan::World &world) override { return new WGDefault(world); }
};

WGDefault(Swan::World &world):

+ 1
- 1
libswan/include/swan/WorldGen.h View File

@@ -15,7 +15,7 @@ public:
class Factory {
public:
virtual ~Factory() = default;
virtual WorldGen *create(World &tmap) = 0;
virtual WorldGen *create(World &world) = 0;
std::string name_;
};


+ 1
- 1
libswan/src/SRF.cc View File

@@ -116,7 +116,7 @@ static char hexchr(uint8_t nibble) {

SRF *SRF::read(std::istream &is) {
Type type = (Type)readByte(is);
SRF *srf;
SRF *srf = nullptr;

switch (type) {
case Type::OBJECT:

+ 3
- 2
libswan/src/World.cc View File

@@ -89,12 +89,13 @@ void World::setCurrentPlane(WorldPlane &plane) {
WorldPlane &World::addPlane(const std::string &gen) {
WorldPlane::ID id = planes_.size();
auto it = worldgens_.find(gen);
if (it == end(worldgens_)) {
if (it == end(worldgens_)) {
panic << "Tried to add plane with non-existant world gen " << gen << "!";
abort();
}

WorldGen *g = it->second->create(*this);
WorldGen::Factory *factory = it->second;
WorldGen *g = factory->create(*this);
planes_.push_back(WorldPlane(id, this, std::shared_ptr<WorldGen>(g)));
return planes_[id];
}

Loading…
Cancel
Save