Skip to content

Commit 88df65a

Browse files
committed
make buildable with clang
1 parent 26e5c22 commit 88df65a

33 files changed

+651
-140
lines changed

CvGameCoreDLLUtil/include/CvLuaMethodWrapper.h

+80-78
Large diffs are not rendered by default.

CvGameCoreDLL_Expansion2/CustomMods.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ enum BattleTypeTypes
926926

927927
// LUA API wrappers
928928
#define LUAAPIEXTN(method, type, ...) static int l##method(lua_State* L)
929-
#define LUAAPIIMPL(object, method) int CvLua##object::l##method(lua_State* L) { return BasicLuaMethod(L, &Cv##object::##method); }
929+
#define LUAAPIIMPL(object, method) int CvLua##object::l##method(lua_State* L) { return BasicLuaMethod(L, &Cv##object::method); }
930930
#define LUAAPIINLINE(method, hasMethod, type) inline bool method() const { return hasMethod(type); }
931931

932932

CvGameCoreDLL_Expansion2/CvCity.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -21339,17 +21339,17 @@ bool CvCity::DoRazingTurn()
2133921339
CvNotifications* pNotifications = GET_PLAYER(getOwner()).GetNotifications();
2134021340
if (pNotifications)
2134121341
{
21342-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_PARTISANS_NEAR_RAZING_CITY", getName());
21342+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_PARTISANS_NEAR_RAZING_CITY", getName()));
2134321343

21344-
Localization::String strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_PARTISANS_NEAR_RAZING_CITY_S", getName());
21344+
Localization::String strSummary(GetLocalizedText("TXT_KEY_NOTIFICATION_PARTISANS_NEAR_RAZING_CITY_S", getName()));
2134521345
pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), getX(), getY(), -1);
2134621346
}
2134721347
CvNotifications* pNotifications2 = GET_PLAYER(eFormerOwner).GetNotifications();
2134821348
if (pNotifications2)
2134921349
{
21350-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_FRIENDLY_PARTISANS_NEAR_RAZING_CITY", getName());
21350+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_FRIENDLY_PARTISANS_NEAR_RAZING_CITY", getName()));
2135121351

21352-
Localization::String strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_FRIENDLY_PARTISANS_NEAR_RAZING_CITY_S", getName());
21352+
Localization::String strSummary(GetLocalizedText("TXT_KEY_NOTIFICATION_FRIENDLY_PARTISANS_NEAR_RAZING_CITY_S", getName()));
2135321353
pNotifications2->Add(NOTIFICATION_GENERIC, strMessage.toUTF8(), strSummary.toUTF8(), getX(), getY(), -1);
2135421354
}
2135521355
if (GC.getLogging() && GC.getAILogging())
@@ -21368,17 +21368,17 @@ bool CvCity::DoRazingTurn()
2136821368
CvNotifications* pNotifications = GET_PLAYER(getOwner()).GetNotifications();
2136921369
if (pNotifications)
2137021370
{
21371-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_PARTISANS_NEAR_RAZING_CITY", getName());
21371+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_PARTISANS_NEAR_RAZING_CITY", getName()));
2137221372

21373-
Localization::String strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_PARTISANS_NEAR_RAZING_CITY_S", getName());
21373+
Localization::String strSummary(GetLocalizedText("TXT_KEY_NOTIFICATION_PARTISANS_NEAR_RAZING_CITY_S", getName()));
2137421374
pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), getX(), getY(), -1);
2137521375
}
2137621376
CvNotifications* pNotifications2 = GET_PLAYER(eFormerOwner).GetNotifications();
2137721377
if (pNotifications2)
2137821378
{
21379-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_FRIENDLY_PARTISANS_NEAR_RAZING_CITY", getName());
21379+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_FRIENDLY_PARTISANS_NEAR_RAZING_CITY", getName()));
2138021380

21381-
Localization::String strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_FRIENDLY_PARTISANS_NEAR_RAZING_CITY_S", getName());
21381+
Localization::String strSummary(GetLocalizedText("TXT_KEY_NOTIFICATION_FRIENDLY_PARTISANS_NEAR_RAZING_CITY_S", getName()));
2138221382
pNotifications2->Add(NOTIFICATION_GENERIC, strMessage.toUTF8(), strSummary.toUTF8(), getX(), getY(), -1);
2138321383
}
2138421384
if (GC.getLogging() && GC.getAILogging())

CvGameCoreDLL_Expansion2/CvDatabaseUtility.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CvDatabaseUtility
3939

4040
//!Allocates an array to Count(szTableName) and zero's memory.
4141
template<typename T>
42-
void InitializeArray(T*& pArray, const char* szTableName, T default = (T)0);
42+
void InitializeArray(T*& pArray, const char* szTableName, T default_ = (T)0);
4343

4444
bool Initialize2DArray(int**& pArray, const char* szTable1Name, const char* szTable2Name, int iDefault = 0);
4545
static void SafeDelete2DArray(int**& pArray);
@@ -153,7 +153,7 @@ inline void CvDatabaseUtility::InitializeArray(float*& pArray, const size_t coun
153153
}
154154
//------------------------------------------------------------------------------
155155
template<typename T>
156-
inline void CvDatabaseUtility::InitializeArray(T*& pArray, const char* szTableName, T default)
156+
inline void CvDatabaseUtility::InitializeArray(T*& pArray, const char* szTableName, T default_)
157157
{
158158
size_t count = MaxRows(szTableName);
159159

@@ -166,7 +166,7 @@ inline void CvDatabaseUtility::InitializeArray(T*& pArray, const char* szTableNa
166166
if(count == 0)
167167
count = 1;
168168

169-
InitializeArray(pArray, count, default);
169+
InitializeArray(pArray, count, default_);
170170
}
171171

172172
#endif //CVDATABASEUTILITY_H

CvGameCoreDLL_Expansion2/CvDiplomacyRequests.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ void CvDiplomacyRequests::SendDealRequest(PlayerTypes eFromPlayer, PlayerTypes e
597597
if(GC.getGame().isReallyNetworkMultiPlayer() && MOD_ACTIVE_DIPLOMACY)
598598
{
599599
CvAssert(eFromPlayer != NO_PLAYER);
600-
CvAssertMsg(!GET_PLAYER(eFromPlayer).isHuman(), __FUNCTION__ " must not be used by a human player!");
600+
CvAssertMsg(!GET_PLAYER(eFromPlayer).isHuman(), "CvDiplomacyRequests::SendDealRequest must not be used by a human player!");
601601

602602
if (GC.getGame().isNetworkMultiPlayer() && eToPlayer != GC.getGame().getActivePlayer())
603603
{

CvGameCoreDLL_Expansion2/CvDllDatabaseUtility.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ bool CvDllDatabaseUtility::ValidateGameDatabase()
609609

610610

611611
#define ValidateCount(func) if(func() <= 0){bError = true, LogMsg("ERROR: %s <= 0", #func);}
612-
#define ValidateVectorSize(vec) ValidateCount(gc.##vec);
612+
#define ValidateVectorSize(vec) ValidateCount(gc.vec);
613613
bool CvDllDatabaseUtility::ValidatePrefetchProcess()
614614
{
615615
bool bError = false;

CvGameCoreDLL_Expansion2/CvEspionageClasses.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ void CvPlayerEspionage::ProcessSpy(uint uiSpyIndex)
744744
CvNotifications* pNotifications = m_pPlayer->GetNotifications();
745745
if(pNotifications)
746746
{
747-
Localization::String strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SPY_STEAL_TECH_S");
747+
Localization::String strSummary(GetLocalizedText("TXT_KEY_NOTIFICATION_SPY_STEAL_TECH_S"));
748748
Localization::String strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_SPY_STEAL_TECH");
749749
strNotification << GetSpyRankName(pSpy->m_eRank);
750750
strNotification << pSpy->GetSpyName(m_pPlayer);
@@ -4695,7 +4695,7 @@ void CvPlayerEspionage::ProcessSpyMessages()
46954695
case SPY_RESULT_DETECTED:
46964696
// notify defending player that a spy of unknown origin stole something
46974697
{
4698-
Localization::String strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_TECH_STOLEN_SPY_DETECTED_WO_TECH_S");
4698+
Localization::String strSummary(GetLocalizedText("TXT_KEY_NOTIFICATION_TECH_STOLEN_SPY_DETECTED_WO_TECH_S"));
46994699
Localization::String strNotification;
47004700

47014701
if(pCityEspionage->m_aiSpyAssignment[m_pPlayer->GetID()] == -1)

CvGameCoreDLL_Expansion2/CvGame.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -8094,8 +8094,8 @@ void CvGame::setGameState(GameStateTypes eNewValue)
80948094
#endif
80958095

80968096
//Write out time spent playing.
8097-
long iHours = getMinutesPlayed() / 60;
8098-
long iMinutes = getMinutesPlayed() % 60;
8097+
int iHours = getMinutesPlayed() / 60;
8098+
int iMinutes = getMinutesPlayed() % 60;
80998099

81008100
for(int iI = 0; iI < MAX_CIV_PLAYERS; iI++)
81018101
{
@@ -11948,7 +11948,7 @@ void CvGame::writeSaveGameDB(FDataStream& kStream) const
1194811948
CvAssertMsg(false, "Saved game database exists, but could not open it!");
1194911949
}
1195011950

11951-
long nilSize = 0;
11951+
DWORD nilSize = 0;
1195211952
kStream << nilSize;
1195311953
}
1195411954
}

CvGameCoreDLL_Expansion2/CvInfosSerializationHelper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ int Read(FDataStream& kStream, bool* bValid /*= NULL*/)
151151
{
152152
if(bValid) *bValid = false;
153153
CvString szError;
154-
szError.Format("LOAD ERROR: Type not found: %s", sTemp);
154+
szError.Format("LOAD ERROR: Type not found: %s", sTemp.c_str());
155155
GC.LogMessage(szError.GetCString());
156156
CvAssertMsg(false, szError);
157157
}

CvGameCoreDLL_Expansion2/CvPlayer.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -3730,7 +3730,7 @@ CvCity* CvPlayer::acquireCity(CvCity* pCity, bool bConquest, bool bGift)
37303730
continue;
37313731

37323732
CvEspionageSpy* pSpy = pEspionage->GetSpyByID(iAssignedSpy);
3733-
Localization::String strSummary = bConquest ? GetLocalizedText("TXT_KEY_NOTIFICATION_SPY_EVICTED_CONQUEST_S") : GetLocalizedText("TXT_KEY_NOTIFICATION_SPY_EVICTED_TRADE_S");
3733+
Localization::String strSummary(bConquest ? GetLocalizedText("TXT_KEY_NOTIFICATION_SPY_EVICTED_CONQUEST_S") : GetLocalizedText("TXT_KEY_NOTIFICATION_SPY_EVICTED_TRADE_S"));
37343734

37353735
// City acquirer gets a different notification
37363736
if (eLoopPlayer == GetID())
@@ -21015,7 +21015,7 @@ void CvPlayer::DoUpdateCityRevolts()
2101521015
CvNotifications* pNotifications = GetNotifications();
2101621016
if (pNotifications && isHuman())
2101721017
{
21018-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLT", GetCityRevoltCounter(), pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription());
21018+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLT", GetCityRevoltCounter(), pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription()));
2101921019
Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLT_SUMMARY");
2102021020
pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), pMostUnhappyCity->getX(), pMostUnhappyCity->getY(), -1);
2102121021
}
@@ -21025,7 +21025,7 @@ void CvPlayer::DoUpdateCityRevolts()
2102521025
CvNotifications* pNotifications = GetNotifications();
2102621026
if (pNotifications && isHuman())
2102721027
{
21028-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP", GetCityRevoltCounter(), pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription());
21028+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP", GetCityRevoltCounter(), pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription()));
2102921029
Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP_SUMMARY");
2103021030
pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), pMostUnhappyCity->getX(), pMostUnhappyCity->getY(), -1);
2103121031
}
@@ -21035,7 +21035,7 @@ void CvPlayer::DoUpdateCityRevolts()
2103521035
CvNotifications* pNotifications = GetNotifications();
2103621036
if (pNotifications && isHuman())
2103721037
{
21038-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP_FREE_CITY", GetCityRevoltCounter(), pMostUnhappyCity->getName());
21038+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP_FREE_CITY", GetCityRevoltCounter(), pMostUnhappyCity->getName()));
2103921039
Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP_SUMMARY");
2104021040
pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), pMostUnhappyCity->getX(), pMostUnhappyCity->getY(), -1);
2104121041
}
@@ -21140,7 +21140,7 @@ void CvPlayer::DoResetCityRevoltCounter()
2114021140
CvNotifications* pNotifications = GetNotifications();
2114121141
if (pNotifications && isHuman())
2114221142
{
21143-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLT", iTurns, pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription());
21143+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLT", iTurns, pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription()));
2114421144
Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLT_SUMMARY");
2114521145
pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), pMostUnhappyCity->getX(), pMostUnhappyCity->getY(), -1);
2114621146
}
@@ -21176,7 +21176,7 @@ void CvPlayer::DoResetCityRevoltCounter()
2117621176
CvNotifications* pNotifications = GetNotifications();
2117721177
if (pNotifications && isHuman())
2117821178
{
21179-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP", iTurns, pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription());
21179+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP", iTurns, pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription()));
2118021180
Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP_SUMMARY");
2118121181
pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), pMostUnhappyCity->getX(), pMostUnhappyCity->getY(), -1);
2118221182
}
@@ -21212,7 +21212,7 @@ void CvPlayer::DoResetCityRevoltCounter()
2121221212
CvNotifications* pNotifications = GetNotifications();
2121321213
if (pNotifications && isHuman())
2121421214
{
21215-
Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP_FREE_CITY", iTurns, pMostUnhappyCity->getName());
21215+
Localization::String strMessage(GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP_FREE_CITY", iTurns, pMostUnhappyCity->getName()));
2121621216
Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLUTION_CP_SUMMARY");
2121721217
pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), pMostUnhappyCity->getX(), pMostUnhappyCity->getY(), -1);
2121821218
}

CvGameCoreDLL_Expansion2/CvPlayerAI.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848

4949
static CvEnumMap<PlayerTypes, CvPlayerAI> s_players;;
5050

51-
// inlined for performance reasons
52-
inline CvPlayerAI& CvPlayerAI::getPlayer(PlayerTypes ePlayer)
51+
CvPlayerAI& CvPlayerAI::getPlayer(PlayerTypes ePlayer)
5352
{
5453
CvAssertMsg(ePlayer != NO_PLAYER, "Player is not assigned a valid value");
5554
CvAssertMsg(ePlayer < MAX_PLAYERS, "Player is not assigned a valid value");

CvGameCoreDLL_Expansion2/CvPlot.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10936,7 +10936,7 @@ void CvPlot::SetResourceForceReveal(TeamTypes eTeam, bool bValue)
1093610936
}
1093710937
#if defined(MOD_BALANCE_CORE)
1093810938
// --------------------------------------------------------------------------------
10939-
inline bool CvPlot::IsTeamImpassable(TeamTypes eTeam) const
10939+
bool CvPlot::IsTeamImpassable(TeamTypes eTeam) const
1094010940
{
1094110941
CvAssertMsg(eTeam >= 0, "eTeam is expected to be non-negative (invalid Index)");
1094210942
CvAssertMsg(eTeam < REALLY_MAX_TEAMS, "eTeam is expected to be within maximum bounds (invalid Index)");

CvGameCoreDLL_Expansion2/CvPromotionClasses.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3407,7 +3407,7 @@ void PromotionArrayHelpers::ReadV3(FDataStream& kStream, CvBitfield& kPromotions
34073407
else
34083408
{
34093409
CvString szError;
3410-
szError.Format("LOAD ERROR: Promotion Type not found: %s", sTemp);
3410+
szError.Format("LOAD ERROR: Promotion Type not found: %s", sTemp.c_str());
34113411
GC.LogMessage(szError.GetCString());
34123412
CvAssertMsg(false, szError);
34133413
bool bDummy;

CvGameCoreDLL_Expansion2/CvReligionClasses.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5956,7 +5956,7 @@ void CvUnitReligion::SetFullStrength(PlayerTypes eOwner, const CvUnitEntry& kUni
59565956

59575957
//strength can be buffed
59585958
int iExtraStrength = kUnitInfo.GetReligiousStrength() * (GET_PLAYER(eOwner).GetMissionaryExtraStrength() + GET_PLAYER(eOwner).GetPlayerTraits()->GetExtraMissionaryStrength());
5959-
unsigned short iReligiousStrength = kUnitInfo.GetReligiousStrength() + unsigned short(iExtraStrength / 100);
5959+
unsigned short iReligiousStrength = kUnitInfo.GetReligiousStrength() + (unsigned short)(iExtraStrength / 100);
59605960

59615961
m_eReligion = eReligion;
59625962
m_iSpreadsUsed = 0;

CvGameCoreDLL_Expansion2/CvSerialize.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,4 +436,4 @@ FDataStream& operator>>(FDataStream& loadFrom, tr1::array<T, N>& writeTo) {
436436
}
437437

438438

439-
#endif CVSERIALIZE_H
439+
#endif // CVSERIALIZE_H

CvGameCoreDLL_Expansion2/CvSpan.h

+4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515

1616
enum DynamicExtentType
1717
{
18+
#ifdef __clang__
19+
DYNAMIC_EXTENT = INT_MAX,
20+
#else
1821
DYNAMIC_EXTENT = std::size_t(-1),
22+
#endif // __clang__
1923
};
2024

2125
template<typename T, std::size_t TExtent = DYNAMIC_EXTENT>

CvGameCoreDLL_Expansion2/CvTeam.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
// statics
4141
CvTeam* CvTeam::m_aTeams = NULL;
4242

43-
inline CvTeam& CvTeam::getTeam(TeamTypes eTeam)
43+
CvTeam& CvTeam::getTeam(TeamTypes eTeam)
4444
{
4545
CvAssertMsg(eTeam != NO_TEAM, "eTeam is not assigned a valid value");
4646
CvAssertMsg(eTeam < MAX_TEAMS, "eTeam is not assigned a valid value");

0 commit comments

Comments
 (0)