1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Fix some compilation warnings

This commit is contained in:
Vadim Markovtsev 2016-10-27 19:22:29 +02:00
parent 0cf5a10bd1
commit c696746017
4 changed files with 6 additions and 54 deletions

View File

@ -962,14 +962,18 @@ DLL_LINKAGE void EraseArtifact::applyGs(CGameState *gs)
DisassembledArtifact dis; DisassembledArtifact dis;
dis.al.artHolder = al.artHolder; dis.al.artHolder = al.artHolder;
auto aset = al.getHolderArtSet(); auto aset = al.getHolderArtSet();
#ifndef NDEBUG
bool found = false; bool found = false;
#endif
for(auto& p : aset->artifactsWorn) for(auto& p : aset->artifactsWorn)
{ {
auto art = p.second.artifact; auto art = p.second.artifact;
if(art->canBeDisassembled() && art->isPart(slot->artifact)) if(art->canBeDisassembled() && art->isPart(slot->artifact))
{ {
dis.al.slot = aset->getArtPos(art); dis.al.slot = aset->getArtPos(art);
#ifndef NDEBUG
found = true; found = true;
#endif
break; break;
} }
} }

View File

@ -62,7 +62,6 @@ ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc, voidpf filestream
} }
} }
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
@ -70,24 +69,6 @@ static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPO
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb";
else
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
mode_fopen = "r+b";
else
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
mode_fopen = "wb";
if ((filename != NULL) && (mode_fopen != NULL))
file = fopen(filename, mode_fopen);
return file;
}
static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode)
{ {
FILE* file = NULL; FILE* file = NULL;
@ -121,14 +102,6 @@ static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void
return ret; return ret;
} }
static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream)
{
long ret;
ret = ftell((FILE *)stream);
return ret;
}
static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream)
{ {
ZPOS64_T ret; ZPOS64_T ret;
@ -136,29 +109,6 @@ static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream)
return ret; return ret;
} }
static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin)
{
int fseek_origin = 0;
long ret;
switch (origin)
{
case ZLIB_FILEFUNC_SEEK_CUR:
fseek_origin = SEEK_CUR;
break;
case ZLIB_FILEFUNC_SEEK_END:
fseek_origin = SEEK_END;
break;
case ZLIB_FILEFUNC_SEEK_SET:
fseek_origin = SEEK_SET;
break;
default: return -1;
}
ret = 0;
if (fseek((FILE *)stream, offset, fseek_origin) != 0)
ret = -1;
return ret;
}
static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
{ {
int fseek_origin = 0; int fseek_origin = 0;

View File

@ -479,7 +479,7 @@ void CMapGenerator::createDirectConnections()
int3 posA = zoneA->getPos(); int3 posA = zoneA->getPos();
int3 posB = zoneB->getPos(); int3 posB = zoneB->getPos();
auto zoneAid = zoneA->getId(); // auto zoneAid = zoneA->getId();
auto zoneBid = zoneB->getId(); auto zoneBid = zoneB->getId();
if (posA.z == posB.z) if (posA.z == posB.z)
@ -630,7 +630,7 @@ void CMapGenerator::createConnections2()
else if ((result1 == EObjectPlacingResult::SEALED_OFF) || (result2 == EObjectPlacingResult::SEALED_OFF)) else if ((result1 == EObjectPlacingResult::SEALED_OFF) || (result2 == EObjectPlacingResult::SEALED_OFF))
{ {
//sealed-off tiles were blocked, exit inner loop and get another tile set //sealed-off tiles were blocked, exit inner loop and get another tile set
bool continueOuterLoop = true; continueOuterLoop = true;
break; break;
} }
else else

View File

@ -154,8 +154,6 @@ void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenera
void CZonePlacer::prepareZones(TZoneMap &zones, TZoneVector &zonesVector, const bool underground, CRandomGenerator * rand) void CZonePlacer::prepareZones(TZoneMap &zones, TZoneVector &zonesVector, const bool underground, CRandomGenerator * rand)
{ {
TRmgTemplateZoneId firstZone = zones.begin()->first; //we want lowest ID here
std::vector<float> totalSize = { 0, 0 }; //make sure that sum of zone sizes on surface and uderground match size of the map std::vector<float> totalSize = { 0, 0 }; //make sure that sum of zone sizes on surface and uderground match size of the map
const float radius = 0.4f; const float radius = 0.4f;