Fix choice between c++11 unordered_map and c++0x regular (ordered) map

This commit is contained in:
Rogier 2014-05-06 16:44:29 +02:00
parent 0aee764203
commit 49cb97598d
3 changed files with 14 additions and 4 deletions

View File

@ -965,7 +965,7 @@ inline void TileGenerator::renderMapBlock(const ustring &mapBlock, const BlockPo
if (content == m_blockIgnoreId || content == m_blockAirId) {
continue;
}
std::map<int, std::string>::iterator blockName = m_nameMap.find(content);
NodeID2NameMap::iterator blockName = m_nameMap.find(content);
if (blockName == m_nameMap.end())
continue;
const string &name = blockName->second;

View File

@ -14,7 +14,11 @@
#include <climits>
#include <iosfwd>
#include <list>
#if __cplusplus >= 201103L
#include <unordered_map>
#else
#include <map>
#endif
#include <set>
#include <stdint.h>
#include <string>
@ -31,7 +35,13 @@
class TileGenerator
{
private:
#if __cplusplus >= 201103L
typedef std::unordered_map<std::string, ColorEntry> ColorMap;
typedef std::unordered_map<int, std::string> NodeID2NameMap;
#else
typedef std::map<std::string, ColorEntry> ColorMap;
typedef std::map<int, std::string> NodeID2NameMap;
#endif
public:
TileGenerator();
@ -158,7 +168,7 @@ private:
int m_pictWidth;
int m_pictHeight;
std::list<BlockPos> m_positions;
std::map<int, std::string> m_nameMap;
NodeID2NameMap m_nameMap;
ColorMap m_colors;
uint16_t m_readedPixels[16];
std::set<std::string> m_unknownNodes;

View File

@ -3,7 +3,7 @@
#include "db.h"
#include <sqlite3.h>
#if _cplusplus >= 201103L
#if __cplusplus >= 201103L
#include <unordered_map>
#else
#include <map>
@ -14,7 +14,7 @@
#include "types.h"
class DBSQLite3 : public DB {
#if _cplusplus >= 201103L
#if __cplusplus >= 201103L
typedef std::unordered_map<int64_t, ustring> BlockCache;
#else
typedef std::map<int64_t, ustring> BlockCache;