mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- fixed missing DLL_LINKAGE
- use precalculated checksum for zip files - UNUSED macro to silence some warnings
This commit is contained in:
parent
dd73573c5c
commit
55577d0ac4
@ -2774,6 +2774,7 @@ void SectorMap::makeParentBFS(crint3 source)
|
|||||||
toVisit.pop();
|
toVisit.pop();
|
||||||
ui8 &sec = retreiveTile(curPos);
|
ui8 &sec = retreiveTile(curPos);
|
||||||
assert(sec == mySector); //consider only tiles from the same sector
|
assert(sec == mySector); //consider only tiles from the same sector
|
||||||
|
UNUSED(sec);
|
||||||
|
|
||||||
//const TerrainTile *t = cb->getTile(curPos);
|
//const TerrainTile *t = cb->getTile(curPos);
|
||||||
foreach_neighbour(curPos, [&](crint3 neighPos)
|
foreach_neighbour(curPos, [&](crint3 neighPos)
|
||||||
|
@ -96,7 +96,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support suc
|
|||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
set(CLANG_SPECIFIC_FLAGS "-Wno-mismatched-tags")
|
set(CLANG_SPECIFIC_FLAGS "-Wno-mismatched-tags")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wpointer-arith -Wno-switch -Wno-sign-compare -Wno-unused-parameter -Wno-overloaded-virtual ${CLANG_SPECIFIC_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wpointer-arith -Wno-switch -Wno-sign-compare -Wno-unused-parameter -Wuninitialized -Wno-overloaded-virtual ${CLANG_SPECIFIC_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32) # on Win everything goes into H3 root directory
|
if(WIN32) # on Win everything goes into H3 root directory
|
||||||
|
3
Global.h
3
Global.h
@ -219,6 +219,9 @@ typedef boost::lock_guard<boost::recursive_mutex> TLockGuardRec;
|
|||||||
template<typename T, size_t N> char (&_ArrayCountObj(const T (&)[N]))[N];
|
template<typename T, size_t N> char (&_ArrayCountObj(const T (&)[N]))[N];
|
||||||
#define ARRAY_COUNT(arr) (sizeof(_ArrayCountObj(arr)))
|
#define ARRAY_COUNT(arr) (sizeof(_ArrayCountObj(arr)))
|
||||||
|
|
||||||
|
// should be used for variables that becomes unused in release builds (e.g. only used for assert checks)
|
||||||
|
#define UNUSED(VAR) ((void)VAR)
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
/* VCMI standard library */
|
/* VCMI standard library */
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
|
@ -141,6 +141,7 @@ CAttackAnimation::CAttackAnimation(CBattleInterface *_owner, const CStack *attac
|
|||||||
&& owner->getCurrentPlayerInterface()->cb->battleHexToWallPart(_dest) >= 0;
|
&& owner->getCurrentPlayerInterface()->cb->battleHexToWallPart(_dest) >= 0;
|
||||||
|
|
||||||
assert(attackedStack || isCatapultAttack);
|
assert(attackedStack || isCatapultAttack);
|
||||||
|
UNUSED(isCatapultAttack);
|
||||||
attackingStackPosBeforeReturn = attackingStack->position;
|
attackingStackPosBeforeReturn = attackingStack->position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,6 +327,7 @@ void CCreatureAnimation::nextFrameT(SDL_Surface * dest, bool rotate)
|
|||||||
const size_t baseOffset = reader.getStream()->tell();
|
const size_t baseOffset = reader.getStream()->tell();
|
||||||
|
|
||||||
assert(defType2 == 1);
|
assert(defType2 == 1);
|
||||||
|
UNUSED(defType2);
|
||||||
|
|
||||||
auto specialPalette = genSpecialPalette();
|
auto specialPalette = genSpecialPalette();
|
||||||
|
|
||||||
|
@ -338,6 +338,7 @@ void CCreatureSet::joinStack(SlotID slot, CStackInstance * stack)
|
|||||||
const CCreature *c = getCreature(slot);
|
const CCreature *c = getCreature(slot);
|
||||||
assert(c == stack->type);
|
assert(c == stack->type);
|
||||||
assert(c);
|
assert(c);
|
||||||
|
UNUSED(c);
|
||||||
|
|
||||||
//TODO move stuff
|
//TODO move stuff
|
||||||
changeStackCount(slot, stack->count);
|
changeStackCount(slot, stack->count);
|
||||||
|
@ -1368,7 +1368,10 @@ void CGameState::init(StartInfo * si)
|
|||||||
|
|
||||||
//Early check for #1444-like problems
|
//Early check for #1444-like problems
|
||||||
for(auto building : vti->builtBuildings)
|
for(auto building : vti->builtBuildings)
|
||||||
|
{
|
||||||
assert(vti->town->buildings[building]);
|
assert(vti->town->buildings[building]);
|
||||||
|
UNUSED(building);
|
||||||
|
}
|
||||||
|
|
||||||
//town events
|
//town events
|
||||||
for(CCastleEvent &ev : vti->events)
|
for(CCastleEvent &ev : vti->events)
|
||||||
|
@ -16,34 +16,34 @@
|
|||||||
namespace Unicode
|
namespace Unicode
|
||||||
{
|
{
|
||||||
/// evaluates size of UTF-8 character
|
/// evaluates size of UTF-8 character
|
||||||
size_t getCharacterSize(ui8 firstByte);
|
size_t DLL_LINKAGE getCharacterSize(ui8 firstByte);
|
||||||
|
|
||||||
/// test if character is a valid UTF-8 symbol
|
/// test if character is a valid UTF-8 symbol
|
||||||
/// maxSize - maximum number of bytes this symbol may consist from ( = remainer of string)
|
/// maxSize - maximum number of bytes this symbol may consist from ( = remainer of string)
|
||||||
bool isValidCharacter(const ui8 *character, size_t maxSize);
|
bool DLL_LINKAGE isValidCharacter(const ui8 *character, size_t maxSize);
|
||||||
|
|
||||||
/// test if text contains ASCII-string (no need for unicode conversion)
|
/// test if text contains ASCII-string (no need for unicode conversion)
|
||||||
bool isValidASCII(const std::string & text);
|
bool DLL_LINKAGE isValidASCII(const std::string & text);
|
||||||
bool isValidASCII(const char * data, size_t size);
|
bool DLL_LINKAGE isValidASCII(const char * data, size_t size);
|
||||||
|
|
||||||
/// test if text contains valid UTF-8 sequence
|
/// test if text contains valid UTF-8 sequence
|
||||||
bool isValidString(const std::string & text);
|
bool DLL_LINKAGE isValidString(const std::string & text);
|
||||||
bool isValidString(const char * data, size_t size);
|
bool DLL_LINKAGE isValidString(const char * data, size_t size);
|
||||||
|
|
||||||
/// converts text to unicode from specified encoding or from one specified in settings
|
/// converts text to unicode from specified encoding or from one specified in settings
|
||||||
std::string toUnicode(const std::string & text);
|
std::string DLL_LINKAGE toUnicode(const std::string & text);
|
||||||
std::string toUnicode(const std::string & text, const std::string & encoding);
|
std::string DLL_LINKAGE toUnicode(const std::string & text, const std::string & encoding);
|
||||||
|
|
||||||
/// converts text from unicode to specified encoding or to one specified in settings
|
/// converts text from unicode to specified encoding or to one specified in settings
|
||||||
/// NOTE: usage of these functions should be avoided if possible
|
/// NOTE: usage of these functions should be avoided if possible
|
||||||
std::string fromUnicode(const std::string & text);
|
std::string DLL_LINKAGE fromUnicode(const std::string & text);
|
||||||
std::string fromUnicode(const std::string & text, const std::string & encoding);
|
std::string DLL_LINKAGE fromUnicode(const std::string & text, const std::string & encoding);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CInputStream;
|
class CInputStream;
|
||||||
|
|
||||||
/// Parser for any text files from H3
|
/// Parser for any text files from H3
|
||||||
class CLegacyConfigParser
|
class DLL_LINKAGE CLegacyConfigParser
|
||||||
{
|
{
|
||||||
std::unique_ptr<char[]> data;
|
std::unique_ptr<char[]> data;
|
||||||
char * curr;
|
char * curr;
|
||||||
|
@ -37,7 +37,7 @@ const CObstacleInfo & CObstacleInstance::getInfo() const
|
|||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
throw std::runtime_error("Unknown obstacle type in CObstacleInstance::getInfo()");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<BattleHex> CObstacleInstance::getBlockedTiles() const
|
std::vector<BattleHex> CObstacleInstance::getBlockedTiles() const
|
||||||
|
@ -759,6 +759,7 @@ DLL_LINKAGE void RebalanceStacks::applyGs( CGameState *gs )
|
|||||||
if(const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> merge
|
if(const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> merge
|
||||||
{
|
{
|
||||||
assert(c == srcType);
|
assert(c == srcType);
|
||||||
|
UNUSED(c);
|
||||||
auto alHere = ArtifactLocation (src.getStack(), ArtifactPosition::CREATURE_SLOT);
|
auto alHere = ArtifactLocation (src.getStack(), ArtifactPosition::CREATURE_SLOT);
|
||||||
auto alDest = ArtifactLocation (dst.getStack(), ArtifactPosition::CREATURE_SLOT);
|
auto alDest = ArtifactLocation (dst.getStack(), ArtifactPosition::CREATURE_SLOT);
|
||||||
auto artHere = alHere.getArt();
|
auto artHere = alHere.getArt();
|
||||||
@ -809,6 +810,7 @@ DLL_LINKAGE void RebalanceStacks::applyGs( CGameState *gs )
|
|||||||
if(const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> rebalance
|
if(const CCreature *c = dst.army->getCreature(dst.slot)) //stack at dest -> rebalance
|
||||||
{
|
{
|
||||||
assert(c == srcType);
|
assert(c == srcType);
|
||||||
|
UNUSED(c);
|
||||||
if (stackExp)
|
if (stackExp)
|
||||||
{
|
{
|
||||||
ui64 totalExp = srcCount * src.army->getStackExperience(src.slot) + dst.army->getStackCount(dst.slot) * dst.army->getStackExperience(dst.slot);
|
ui64 totalExp = srcCount * src.army->getStackExperience(src.slot) + dst.army->getStackCount(dst.slot) * dst.army->getStackExperience(dst.slot);
|
||||||
@ -875,6 +877,7 @@ DLL_LINKAGE void AssembledArtifact::applyGs( CGameState *gs )
|
|||||||
const CArtifactInstance *transformedArt = al.getArt();
|
const CArtifactInstance *transformedArt = al.getArt();
|
||||||
assert(transformedArt);
|
assert(transformedArt);
|
||||||
assert(vstd::contains(transformedArt->assemblyPossibilities(artSet), builtArt));
|
assert(vstd::contains(transformedArt->assemblyPossibilities(artSet), builtArt));
|
||||||
|
UNUSED(transformedArt);
|
||||||
|
|
||||||
auto combinedArt = new CCombinedArtifactInstance(builtArt);
|
auto combinedArt = new CCombinedArtifactInstance(builtArt);
|
||||||
gs->map->addNewArtifactInstance(combinedArt);
|
gs->map->addNewArtifactInstance(combinedArt);
|
||||||
|
@ -72,6 +72,7 @@ public:
|
|||||||
seek(0);
|
seek(0);
|
||||||
size_t readSize = read(data.get(), getSize());
|
size_t readSize = read(data.get(), getSize());
|
||||||
assert(readSize == getSize());
|
assert(readSize == getSize());
|
||||||
|
UNUSED(readSize);
|
||||||
|
|
||||||
return std::make_pair(std::move(data), getSize());
|
return std::make_pair(std::move(data), getSize());
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,13 @@ si64 CZipStream::getSize()
|
|||||||
return info.uncompressed_size;
|
return info.uncompressed_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui32 CZipStream::calculateCRC32()
|
||||||
|
{
|
||||||
|
unz_file_info info;
|
||||||
|
unzGetCurrentFileInfo (file, &info, nullptr, 0, nullptr, 0, nullptr, 0);
|
||||||
|
return info.crc;
|
||||||
|
}
|
||||||
|
|
||||||
CZipLoader::CZipLoader(const std::string & mountPoint, const std::string & archive):
|
CZipLoader::CZipLoader(const std::string & mountPoint, const std::string & archive):
|
||||||
archiveName(archive),
|
archiveName(archive),
|
||||||
mountPoint(mountPoint),
|
mountPoint(mountPoint),
|
||||||
|
@ -31,7 +31,8 @@ public:
|
|||||||
CZipStream(const std::string & archive, unz_file_pos filepos);
|
CZipStream(const std::string & archive, unz_file_pos filepos);
|
||||||
~CZipStream();
|
~CZipStream();
|
||||||
|
|
||||||
si64 getSize();
|
si64 getSize() override;
|
||||||
|
ui32 calculateCRC32() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
si64 readMore(ui8 * data, si64 size) override;
|
si64 readMore(ui8 * data, si64 size) override;
|
||||||
|
@ -374,7 +374,7 @@ EConsoleTextColor::EConsoleTextColor CColorMapping::getColorFor(const CLoggerDom
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(0);
|
throw std::runtime_error("failed to find color for requested domain/level pair");
|
||||||
}
|
}
|
||||||
|
|
||||||
CLogConsoleTarget::CLogConsoleTarget(CConsoleHandler * console) : console(console), threshold(ELogLevel::INFO), coloredOutputEnabled(true)
|
CLogConsoleTarget::CLogConsoleTarget(CConsoleHandler * console) : console(console), threshold(ELogLevel::INFO), coloredOutputEnabled(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user