Skip to content

Commit 18f022f

Browse files
committed
[ZH] Fix hash_map errors for Zero Hour Tools build (TheSuperHackers#509)
1 parent aa94c04 commit 18f022f

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// TheSuperHackers
2+
// This file includes a hash map that is compatible with vs6, STLPort and modern c++ for the most part.
3+
// There are differences, for example std::hash_map::resize is the equivalent to std::unordered_map::reserve.
4+
5+
#pragma once
6+
7+
#if defined(USING_STLPORT) || (defined(_MSC_VER) && _MSC_VER < 1300)
8+
9+
#include <hash_map>
10+
11+
#else
12+
13+
#include <unordered_map>
14+
namespace std
15+
{
16+
template <
17+
class _Kty,
18+
class _Ty,
19+
class _Hasher = hash<_Kty>,
20+
class _Keyeq = equal_to<_Kty>,
21+
class _Alloc = allocator<pair<const _Kty, _Ty>>>
22+
using hash_map = unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>;
23+
}
24+
25+
#endif

GeneralsMD/Code/GameEngine/Include/Common/STLTypedefs.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,7 @@ enum DrawableID;
7070

7171
#include <algorithm>
7272
#include <bitset>
73-
#ifdef USING_STLPORT
74-
#include <hash_map>
75-
#else
76-
#include <unordered_map>
77-
namespace std
78-
{
79-
template <
80-
class _Kty,
81-
class _Ty,
82-
class _Hasher = hash<_Kty>,
83-
class _Keyeq = equal_to<_Kty>,
84-
class _Alloc = allocator<pair<const _Kty, _Ty>>>
85-
using hash_map = unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>;
86-
}
87-
#endif
73+
#include <Utility/hash_map_adapter.h>
8874
#include <list>
8975
#include <map>
9076
#include <queue>

GeneralsMD/Code/Tools/CRCDiff/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set_target_properties(z_crcdiff PROPERTIES OUTPUT_NAME crcdiff)
1515
target_sources(z_crcdiff PRIVATE ${CRCDIFF_SRC})
1616

1717
target_link_libraries(z_crcdiff PRIVATE
18+
gz_utility
1819
stlport
1920
)
2021

GeneralsMD/Code/Tools/CRCDiff/expander.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define __EXPANDER_H__
2828

2929
#include <map>
30-
#include <hash_map>
30+
#include <Utility/hash_map_adapter.h>
3131
#include <string>
3232

3333
typedef std::map<std::string, std::string> ExpansionMap;

GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ target_link_libraries(z_particleeditor PRIVATE
4040
d3d8lib
4141
dbghelplib
4242
imm32
43+
gz_utility
4344
stlport
4445
vfw32
4546
winmm

GeneralsMD/Code/Tools/matchbot/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ target_include_directories(z_matchbot PRIVATE . wlib wnet)
6868

6969
target_link_libraries(z_matchbot PRIVATE
7070
gamespy::gamespy
71+
gz_utility
7172
stlport
7273
)
7374

GeneralsMD/Code/Tools/matchbot/generals.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
#include <bitset>
3333
#include <vector>
3434
#include <map>
35-
#include <hash_map>
35+
#include <Utility/hash_map_adapter.h>
36+
3637
typedef std::vector<bool> MapBitSet;
3738

3839
// =====================================================================

0 commit comments

Comments
 (0)