citybuilder icon indicating copy to clipboard operation
citybuilder copied to clipboard

[Suggestion] Part 5 - Improvement

Open Duke02 opened this issue 8 years ago • 0 comments

Instead of the switch case in the function Map::load(...) in Part 5 of this series, why not the following -

std::string name = tileTypeToString(tileType); //Convert to lowercase for (auto &c : name) { c = tolower(c); } //case TileType::VOID: //case TileType::GRASS: //Replacement if (tileType != TileType::VOID) { this->tiles.push_back(tileAlias.at(name)); } else { this->tiles.push_back(tileAlias.at("grass")); } `

Of course, I have yet to test this, so I am not sure whether it works exactly the same.

Duke02 avatar May 29 '16 23:05 Duke02