Reduced compiler warnings
This commit is contained in:
parent
0f9bbcc815
commit
89748d6bc6
@ -2830,8 +2830,7 @@
|
||||
INFOPLIST_FILE = "XSpades/XSpades-Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Users/tcpp/Programs/MacPrograms2/Ysr/DerivedData/Ysr/Build/Products/Release,
|
||||
"$(inherited)"
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -2864,8 +2863,7 @@
|
||||
INFOPLIST_FILE = "XSpades/XSpades-Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
/Users/tcpp/Programs/MacPrograms2/Ysr/DerivedData/Ysr/Build/Products/Release,
|
||||
"$(inherited)"
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -2905,7 +2903,6 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
/Library/Frameworks/SDL2.framework/Headers,
|
||||
/Library/Frameworks/SDL2_image.framework/Headers,
|
||||
/usr/local/include/FL/images,
|
||||
/usr/local/include,
|
||||
Sources/ENet/include,
|
||||
"$(SRCROOT)",
|
||||
@ -2950,7 +2947,6 @@
|
||||
HEADER_SEARCH_PATHS = (
|
||||
/Library/Frameworks/SDL2.framework/Headers,
|
||||
/Library/Frameworks/SDL2_image.framework/Headers,
|
||||
/usr/local/include/FL/images,
|
||||
/usr/local/include,
|
||||
Sources/ENet/include,
|
||||
"$(SRCROOT)",
|
||||
|
@ -859,6 +859,7 @@ bool CScriptArray::operator==(const CScriptArray &other) const
|
||||
}
|
||||
|
||||
if( cmpContext )
|
||||
{
|
||||
if( isNested )
|
||||
{
|
||||
asEContextState state = cmpContext->GetState();
|
||||
@ -866,9 +867,11 @@ bool CScriptArray::operator==(const CScriptArray &other) const
|
||||
if( state == asEXECUTION_ABORTED )
|
||||
cmpContext->Abort();
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
cmpContext->Release();
|
||||
}
|
||||
}
|
||||
|
||||
return isEqual;
|
||||
}
|
||||
@ -1042,6 +1045,7 @@ int CScriptArray::Find(asUINT index, void *value) const
|
||||
}
|
||||
|
||||
if( cmpContext )
|
||||
{
|
||||
if( isNested )
|
||||
{
|
||||
asEContextState state = cmpContext->GetState();
|
||||
@ -1049,9 +1053,11 @@ int CScriptArray::Find(asUINT index, void *value) const
|
||||
if( state == asEXECUTION_ABORTED )
|
||||
cmpContext->Abort();
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
cmpContext->Release();
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1216,6 +1222,7 @@ void CScriptArray::Sort(asUINT index, asUINT count, bool asc)
|
||||
}
|
||||
|
||||
if( cmpContext )
|
||||
{
|
||||
if( isNested )
|
||||
{
|
||||
asEContextState state = cmpContext->GetState();
|
||||
@ -1226,6 +1233,7 @@ void CScriptArray::Sort(asUINT index, asUINT count, bool asc)
|
||||
else{
|
||||
cmpContext->Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// internal
|
||||
|
@ -166,7 +166,7 @@ int CScriptBuilder::LoadScriptSection(const char *filename)
|
||||
|
||||
// Determine size of the file
|
||||
fseek(f, 0, SEEK_END);
|
||||
int len = ftell(f);
|
||||
int len = static_cast<int> (ftell(f));
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
// On Win32 it is possible to do the following instead
|
||||
|
@ -307,7 +307,7 @@ CScriptArray* CScriptDictionary::GetKeys() const
|
||||
for( it = dict.begin(); it != dict.end(); it++ )
|
||||
{
|
||||
current++;
|
||||
*(string*)array->At(current) = it->first;
|
||||
*(string*)array->At(static_cast<asUINT> (current)) = it->first;
|
||||
}
|
||||
|
||||
return array;
|
||||
|
@ -151,7 +151,7 @@ int asCGarbageCollector::GetObjectInGC(asUINT idx, asUINT *seqNbr, void **obj, a
|
||||
|
||||
ENTERCRITICALSECTION(gcCritical);
|
||||
asSObjTypePair *o = 0;
|
||||
asUINT newObjs = gcNewObjects.GetLength();
|
||||
asUINT newObjs = static_cast<asUINT>(gcNewObjects.GetLength());
|
||||
if( idx < newObjs )
|
||||
o = &gcNewObjects[idx];
|
||||
else if( idx < gcOldObjects.GetLength() + newObjs )
|
||||
|
@ -300,7 +300,7 @@ int asCReader::ReadInner()
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_GLOBAL_VARS_NOT_ALLOWED);
|
||||
error = true;
|
||||
}
|
||||
module->scriptGlobals.Allocate(count, 0);
|
||||
module->scriptGlobals.Allocate((unsigned int) count, 0);
|
||||
for( i = 0; i < count && !error; ++i )
|
||||
{
|
||||
ReadGlobalProperty();
|
||||
|
@ -124,7 +124,7 @@ namespace spades {
|
||||
al::qalGenBuffers(1, &handle);
|
||||
ALCheckError();
|
||||
al::qalBufferData(handle, alFormat,
|
||||
bytes.data(), bytes.size(),
|
||||
bytes.data(), (ALuint) bytes.size(),
|
||||
audioStream->GetSamplingFrequency());
|
||||
ALCheckError();
|
||||
|
||||
|
@ -179,7 +179,7 @@ namespace spades {
|
||||
// initialize player view objects
|
||||
clientPlayers.resize(world->GetNumPlayerSlots());
|
||||
for(size_t i = 0; i < world->GetNumPlayerSlots(); i++) {
|
||||
Player *p = world->GetPlayer(i);
|
||||
Player *p = world->GetPlayer(static_cast<unsigned int> (i));
|
||||
if(p){
|
||||
clientPlayers[i] = new ClientPlayer(p, this);
|
||||
}else{
|
||||
@ -721,7 +721,7 @@ namespace spades {
|
||||
if(nextId >= static_cast<int>(world->GetNumPlayerSlots()))
|
||||
nextId = 0;
|
||||
if(nextId < 0)
|
||||
nextId = world->GetNumPlayerSlots() - 1;
|
||||
nextId = static_cast<int> (world->GetNumPlayerSlots() - 1);
|
||||
|
||||
Player *p = world->GetPlayer(nextId);
|
||||
if(p == nullptr)
|
||||
|
@ -538,7 +538,7 @@ namespace spades {
|
||||
Player *p = world->GetLocalPlayer();
|
||||
|
||||
for(size_t i = 0; i < world->GetNumPlayerSlots(); i++)
|
||||
if(world->GetPlayer(i)){
|
||||
if(world->GetPlayer(static_cast<unsigned int>(i))){
|
||||
SPAssert(clientPlayers[i]);
|
||||
clientPlayers[i]->AddToScene();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace spades {
|
||||
// fit FoV to include all possibly hit players
|
||||
float range = 0.2f;
|
||||
for(std::size_t i = 0; i < world->GetNumPlayerSlots(); i++) {
|
||||
auto *p = world->GetPlayer(i);
|
||||
auto *p = world->GetPlayer(static_cast<unsigned int> (i));
|
||||
if(!p) continue;
|
||||
if(p == localPlayer) continue;
|
||||
if(p->GetTeamId() == localPlayer->GetTeamId()) continue;
|
||||
@ -203,7 +203,7 @@ namespace spades {
|
||||
};
|
||||
|
||||
for(std::size_t i = 0; i < numPlayers; i++) {
|
||||
auto *p = world->GetPlayer(i);
|
||||
auto *p = world->GetPlayer(static_cast<unsigned int> (i));
|
||||
if(!p) continue;
|
||||
if(p == localPlayer) continue;
|
||||
if(!p->IsAlive()) continue;
|
||||
@ -214,7 +214,7 @@ namespace spades {
|
||||
auto hitboxes = p->GetHitBoxes();
|
||||
PlayerHit hit;
|
||||
{
|
||||
auto it = hits.find(i);
|
||||
auto it = hits.find(static_cast<int> (i));
|
||||
if(it != hits.end()) {
|
||||
hit = it->second;
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ namespace spades {
|
||||
if((int)cg_protocolVersion == 4)
|
||||
bytesPerEntry++;
|
||||
|
||||
int entries = reader.GetData().size() / bytesPerEntry;
|
||||
int entries = static_cast<int> (reader.GetData().size() / bytesPerEntry);
|
||||
for(int i = 0; i < entries; i++){
|
||||
int idx = i;
|
||||
if((int)cg_protocolVersion == 4)
|
||||
@ -1143,7 +1143,7 @@ namespace spades {
|
||||
|
||||
|
||||
if(p){
|
||||
p->UsedBlocks(cells.size());
|
||||
p->UsedBlocks(static_cast<int> (cells.size()));
|
||||
client->PlayerCreatedBlock(p);
|
||||
}
|
||||
}
|
||||
|
@ -166,8 +166,8 @@ namespace spades {
|
||||
if((sel == i) != (phase == 1))
|
||||
continue;
|
||||
|
||||
int row = i / 8;
|
||||
int col = i % 8;
|
||||
int row = static_cast<int> (i / 8);
|
||||
int col = static_cast<int> (i % 8);
|
||||
|
||||
bool selected = sel == i;
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace spades {
|
||||
SPRaise("State is invalid");
|
||||
}
|
||||
|
||||
zstream.avail_in = buffer.size();
|
||||
zstream.avail_in = (uint) buffer.size();
|
||||
zstream.next_in = (Bytef*)buffer.data();
|
||||
|
||||
do{
|
||||
@ -203,7 +203,7 @@ namespace spades {
|
||||
inputBuffer[i] = nextbuffer[i];
|
||||
readSize = baseStream->Read(inputBuffer + nextbuffer.size(), readSize);
|
||||
readSize += nextbuffer.size();
|
||||
zstream.avail_in = readSize;
|
||||
zstream.avail_in = (uint) readSize;
|
||||
zstream.next_in = (Bytef*)inputBuffer;
|
||||
|
||||
do{
|
||||
|
@ -373,9 +373,9 @@ namespace spades {
|
||||
}
|
||||
|
||||
IntVector3 Floor() const{
|
||||
return IntVector3::Make((long)floorf(x),
|
||||
(long)floorf(y),
|
||||
(long)floorf(z));
|
||||
return IntVector3::Make((int) floorf(x),
|
||||
(int) floorf(y),
|
||||
(int) floorf(z));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace {
|
||||
unsigned WriteCallback(void* input, std::size_t size, std::size_t numel, void* user_ptr) {
|
||||
auto stream = static_cast<spades::IStream*>(user_ptr);
|
||||
stream->Write(input, size * numel);
|
||||
return size * numel;
|
||||
return static_cast<unsigned> (size * numel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace spades {
|
||||
std::string str;
|
||||
public:
|
||||
StringSdlRWops(std::string s):str(s) {
|
||||
op = SDL_RWFromConstMem(str.data(), str.size());
|
||||
op = SDL_RWFromConstMem(str.data(), (int) str.size());
|
||||
}
|
||||
~StringSdlRWops() {
|
||||
SDL_RWclose(op);
|
||||
|
@ -829,7 +829,7 @@ namespace spades {
|
||||
tk = ReadToken();
|
||||
if(tk.first == TokenType::Indexer) {
|
||||
try {
|
||||
directiveIdx = std::stol(tk.second);
|
||||
directiveIdx = static_cast<int> (std::stol(tk.second));
|
||||
currentMsgText[directiveIdx] = std::string();
|
||||
}catch(...){
|
||||
SPRaise("Integer parse error of '%s' at line %d", tk.second.c_str(), line);
|
||||
|
@ -241,11 +241,13 @@ namespace spades {
|
||||
template<> std::string ToString<Vector4>(const Vector4& v);
|
||||
template<> std::string ToString<IntVector3>(const IntVector3& v);
|
||||
|
||||
// `CheckPlural` converts the given value to an integer for plural form identification.
|
||||
// Let's ignore huge numbers for now...
|
||||
template<class ...T> int CheckPlural(T... args) { return 1; }
|
||||
template<class ...T> int CheckPlural(int v, T... args) { return v; }
|
||||
template<class ...T> int CheckPlural(long v, T... args) { return v; }
|
||||
template<class ...T> int CheckPlural(long v, T... args) { return static_cast<int> (v); }
|
||||
template<class ...T> int CheckPlural(unsigned int v, T... args) { return v; }
|
||||
template<class ...T> int CheckPlural(unsigned long v, T... args) { return v; }
|
||||
template<class ...T> int CheckPlural(unsigned long v, T... args) { return static_cast<int> (v); }
|
||||
template<class ...T> int CheckPlural(short v, T... args) { return v; }
|
||||
template<class ...T> int CheckPlural(unsigned short v, T... args) { return v; }
|
||||
template<class ...T> int CheckPlural(char v, T... args) { return v; }
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "Mutex.h"
|
||||
#include "IRunnable.h"
|
||||
#include "../Imports/SDL.h"
|
||||
|
||||
namespace spades {
|
||||
|
||||
@ -30,7 +31,7 @@ namespace spades {
|
||||
Mutex lock;
|
||||
IRunnable *runnable;
|
||||
bool volatile autoDelete;
|
||||
unsigned int volatile threadId;
|
||||
SDL_threadID volatile threadId;
|
||||
|
||||
static int InternalRunner(void *);
|
||||
void Quited();
|
||||
|
@ -109,7 +109,7 @@ namespace spades {
|
||||
SPADES_MARK_FUNCTION();
|
||||
size_t outBytes;
|
||||
if(streaming){
|
||||
int out = unzReadCurrentFile(zip, buf, bytes);
|
||||
int out = unzReadCurrentFile(zip, buf, (uint) bytes);
|
||||
if(out < 0){
|
||||
SPRaise("Unzip error: 0x%08x", bytes);
|
||||
}
|
||||
|
@ -942,7 +942,7 @@ public:
|
||||
|
||||
uint get_size() const
|
||||
{
|
||||
return m_pFile ? ftell(m_pFile) : 0;
|
||||
return m_pFile ? (uint) ftell(m_pFile) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -167,8 +167,8 @@ static int png_read_ihdr(png_t* png)
|
||||
#if DO_CRC_CHECKS
|
||||
file_read_ul(png, &orig_crc);
|
||||
|
||||
calc_crc = crc32(0L, 0, 0);
|
||||
calc_crc = crc32(calc_crc, ihdr, 13+4);
|
||||
calc_crc = (unsigned) crc32(0L, 0, 0);
|
||||
calc_crc = (unsigned) crc32(calc_crc, ihdr, 13+4);
|
||||
|
||||
if(orig_crc != calc_crc)
|
||||
return PNG_CRC_ERROR;
|
||||
@ -220,8 +220,8 @@ static int png_write_ihdr(png_t* png)
|
||||
|
||||
file_write(png, ihdr, 1, 13+4);
|
||||
|
||||
crc = crc32(0L, 0, 0);
|
||||
crc = crc32(crc, ihdr, 13+4);
|
||||
crc = (unsigned) crc32(0L, 0, 0);
|
||||
crc = (unsigned) crc32(crc, ihdr, 13+4);
|
||||
|
||||
file_write_ul(png, crc);
|
||||
|
||||
@ -481,7 +481,7 @@ static int png_write_idats(png_t* png, unsigned char* data)
|
||||
unsigned long written;
|
||||
unsigned long crc;
|
||||
unsigned size = png->width * png->height * png->bpp + png->height;
|
||||
unsigned chunk_size = compressBound(size);
|
||||
unsigned chunk_size = (unsigned) compressBound(size);
|
||||
|
||||
(void)png_init_deflate;
|
||||
(void)png_end_deflate;
|
||||
@ -494,16 +494,16 @@ static int png_write_idats(png_t* png, unsigned char* data)
|
||||
compress(chunk+4, &written, data, size);
|
||||
|
||||
crc = crc32(0L, Z_NULL, 0);
|
||||
crc = crc32(crc, chunk, written+4);
|
||||
set_ul(chunk+written+4, crc);
|
||||
file_write_ul(png, written);
|
||||
crc = crc32(crc, chunk, (unsigned) written + 4);
|
||||
set_ul(chunk + written + 4, (unsigned) crc);
|
||||
file_write_ul(png, (unsigned) written);
|
||||
file_write(png, chunk, 1, written+8);
|
||||
png_free(chunk);
|
||||
|
||||
file_write_ul(png, 0);
|
||||
file_write(png, "IEND", 1, 4);
|
||||
crc = crc32(0L, (const unsigned char *)"IEND", 4);
|
||||
file_write_ul(png, crc);
|
||||
file_write_ul(png, (unsigned) crc);
|
||||
|
||||
return PNG_NO_ERROR;
|
||||
}
|
||||
@ -536,9 +536,9 @@ static int png_read_idat(png_t* png, unsigned length)
|
||||
}
|
||||
|
||||
#if DO_CRC_CHECKS
|
||||
calc_crc = crc32(0L, Z_NULL, 0);
|
||||
calc_crc = crc32(calc_crc, (unsigned char*)"IDAT", 4);
|
||||
calc_crc = crc32(calc_crc, (unsigned char*)png->readbuf, length);
|
||||
calc_crc = (unsigned) crc32(0L, Z_NULL, 0);
|
||||
calc_crc = (unsigned) crc32(calc_crc, (unsigned char*)"IDAT", 4);
|
||||
calc_crc = (unsigned) crc32(calc_crc, (unsigned char*)png->readbuf, length);
|
||||
|
||||
file_read_ul(png, &orig_crc);
|
||||
|
||||
|
@ -358,7 +358,7 @@ namespace spades {
|
||||
if(dz >= 6 || dz <= -6)
|
||||
continue;
|
||||
if(c.dirty){
|
||||
dirtyChunkIds[numDirtyChunks++] = i;
|
||||
dirtyChunkIds[numDirtyChunks++] = static_cast<int> (i);
|
||||
nearDirtyChunks++;
|
||||
if(numDirtyChunks >= 256)
|
||||
break;
|
||||
@ -370,7 +370,7 @@ namespace spades {
|
||||
for(size_t i = 0; i < chunks.size(); i++){
|
||||
Chunk& c = chunks[i];
|
||||
if(c.dirty){
|
||||
dirtyChunkIds[numDirtyChunks++] = i;
|
||||
dirtyChunkIds[numDirtyChunks++] = static_cast<int> (i);
|
||||
if(numDirtyChunks >= 256)
|
||||
break;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ namespace spades{
|
||||
texture->SetValue(0);
|
||||
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
indices.size(),
|
||||
static_cast<IGLDevice::Sizei> (indices.size()),
|
||||
IGLDevice::UnsignedInt,
|
||||
indices.data());
|
||||
|
||||
|
@ -351,7 +351,7 @@ namespace spades {
|
||||
lastImage->Bind(IGLDevice::Texture2D);
|
||||
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
indices.size(),
|
||||
static_cast<IGLDevice::Sizei> (indices.size()),
|
||||
IGLDevice::UnsignedInt,
|
||||
indices.data());
|
||||
|
||||
|
@ -296,14 +296,16 @@ namespace spades {
|
||||
buffer = device->GenBuffer();
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, buffer);
|
||||
|
||||
device->BufferData(IGLDevice::ArrayBuffer, vertices.size() * sizeof(Vertex),
|
||||
device->BufferData(IGLDevice::ArrayBuffer,
|
||||
static_cast<IGLDevice::Sizei> (vertices.size() * sizeof(Vertex)),
|
||||
vertices.data(), IGLDevice::DynamicDraw);
|
||||
|
||||
if(!indices.empty()){
|
||||
iBuffer = device->GenBuffer();
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, iBuffer);
|
||||
|
||||
device->BufferData(IGLDevice::ArrayBuffer, indices.size() * sizeof(uint16_t),
|
||||
device->BufferData(IGLDevice::ArrayBuffer,
|
||||
static_cast<IGLDevice::Sizei> (indices.size() * sizeof(uint16_t)),
|
||||
indices.data(), IGLDevice::DynamicDraw);
|
||||
|
||||
}
|
||||
@ -387,7 +389,7 @@ namespace spades {
|
||||
device->BindBuffer(IGLDevice::ElementArrayBuffer,
|
||||
iBuffer);
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
indices.size(),
|
||||
static_cast<IGLDevice::Sizei> (indices.size()),
|
||||
IGLDevice::UnsignedShort, NULL);
|
||||
device->BindBuffer(IGLDevice::ElementArrayBuffer,
|
||||
0);
|
||||
@ -465,7 +467,7 @@ namespace spades {
|
||||
continue;
|
||||
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
indices.size(),
|
||||
static_cast<IGLDevice::Sizei> (indices.size()),
|
||||
IGLDevice::UnsignedShort, NULL);
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,8 @@ namespace spades {
|
||||
device->EnableVertexAttribArray(positionAttribute(), true);
|
||||
|
||||
device->BindBuffer(IGLDevice::ElementArrayBuffer, 0);
|
||||
device->DrawElements(IGLDevice::Triangles, indices.size(),
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
static_cast<IGLDevice::Sizei> (indices.size()),
|
||||
IGLDevice::UnsignedShort, indices.data());
|
||||
|
||||
device->EnableVertexAttribArray(positionAttribute(), false);
|
||||
|
@ -112,8 +112,8 @@ namespace spades{
|
||||
|
||||
device->BindTexture(IGLDevice::Texture2D, texture);
|
||||
for(size_t i = 0; i < updateBitmap.size(); i++){
|
||||
int y = i / updateBitmapPitch;
|
||||
int x = (i - y * updateBitmapPitch) * 32;
|
||||
int y = static_cast<int> (i / updateBitmapPitch);
|
||||
int x = static_cast<int> ((i - y * updateBitmapPitch) * 32);
|
||||
if(updateBitmap[i] == 0)
|
||||
continue;
|
||||
|
||||
|
@ -62,13 +62,13 @@ namespace spades {
|
||||
buffer = device->GenBuffer();
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, buffer);
|
||||
device->BufferData(IGLDevice::ArrayBuffer,
|
||||
vertices.size() * sizeof(Vertex),
|
||||
static_cast<IGLDevice::Sizei> (vertices.size() * sizeof(Vertex)),
|
||||
vertices.data(), IGLDevice::StaticDraw);
|
||||
|
||||
idxBuffer = device->GenBuffer();
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, idxBuffer);
|
||||
device->BufferData(IGLDevice::ArrayBuffer,
|
||||
indices.size() * sizeof(uint32_t),
|
||||
static_cast<IGLDevice::Sizei> (indices.size() * sizeof(uint32_t)),
|
||||
indices.data(), IGLDevice::StaticDraw);
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, 0);
|
||||
|
||||
@ -108,7 +108,7 @@ namespace spades {
|
||||
std::map<Bitmap *, int> idx;
|
||||
std::vector<IntVector3> poss;
|
||||
for(size_t i = 0; i < bmps.size(); i++){
|
||||
idx[bmps[i]] = i;
|
||||
idx[bmps[i]] = static_cast<int> (i);
|
||||
atlasGen.AddBitmap(bmps[i]);
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ namespace spades {
|
||||
|
||||
int tu = minU - 1, tv = minV - 1;
|
||||
int bw = (maxU - minU) + 3, bh = (maxV - minV) + 3;
|
||||
int bId = bmps.size();
|
||||
int bId = static_cast<int> (bmps.size());
|
||||
Bitmap *bmp = new Bitmap(bw, bh);
|
||||
bmps.push_back(bmp);
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ namespace spades {
|
||||
}
|
||||
std::string GLProfiler::GetProfileMessage() {
|
||||
char buf[4096];
|
||||
int indent = levels.size() * 2;
|
||||
int indent = static_cast<int> (levels.size() * 2);
|
||||
for(int i = 0; i < indent; i++)
|
||||
buf[i] = ' ';
|
||||
sprintf(buf + indent, "%s - %.3fms (%.3fms w/o glFinish)\n", name.c_str(),
|
||||
|
@ -55,7 +55,10 @@ namespace spades {
|
||||
errMsg.resize(device->GetProgramInteger(handle, IGLDevice::InfoLogLength) + 1);
|
||||
|
||||
IGLDevice::Sizei outLen;
|
||||
device->GetProgramInfoLog(handle, errMsg.size(), &outLen, errMsg.data());
|
||||
device->GetProgramInfoLog(handle,
|
||||
static_cast<IGLDevice::Sizei> (errMsg.size()),
|
||||
&outLen,
|
||||
errMsg.data());
|
||||
errMsg[outLen] = 0;
|
||||
|
||||
std::string err = errMsg.data();
|
||||
@ -84,7 +87,10 @@ namespace spades {
|
||||
errMsg.resize(device->GetProgramInteger(handle, IGLDevice::InfoLogLength) + 1);
|
||||
|
||||
IGLDevice::Sizei outLen;
|
||||
device->GetShaderInfoLog(handle, errMsg.size(), &outLen, errMsg.data());
|
||||
device->GetShaderInfoLog(handle,
|
||||
static_cast<IGLDevice::Sizei> (errMsg.size()),
|
||||
&outLen,
|
||||
errMsg.data());
|
||||
errMsg[outLen] = 0;
|
||||
|
||||
|
||||
|
@ -487,7 +487,7 @@ namespace spades {
|
||||
if(dz >= 6 || dz <= -6)
|
||||
continue;
|
||||
if(c.dirty){
|
||||
dirtyChunkIds[numDirtyChunks++] = i;
|
||||
dirtyChunkIds[numDirtyChunks++] = static_cast<int> (i);
|
||||
nearDirtyChunks++;
|
||||
if(numDirtyChunks >= 256)
|
||||
break;
|
||||
@ -499,7 +499,7 @@ namespace spades {
|
||||
for(size_t i = 0; i < chunks.size(); i++){
|
||||
Chunk& c = chunks[i];
|
||||
if(c.dirty){
|
||||
dirtyChunkIds[numDirtyChunks++] = i;
|
||||
dirtyChunkIds[numDirtyChunks++] = static_cast<int> (i);
|
||||
if(numDirtyChunks >= 256)
|
||||
break;
|
||||
}
|
||||
|
@ -627,7 +627,8 @@ namespace spades {
|
||||
projectionViewMatrix(program);
|
||||
projectionViewMatrix.SetValue(GetProjectionViewMatrix());
|
||||
|
||||
device->DrawArrays(IGLDevice::Lines, 0, vertices.size());
|
||||
device->DrawArrays(IGLDevice::Lines, 0,
|
||||
static_cast<IGLDevice::Sizei> (vertices.size()));
|
||||
|
||||
device->EnableVertexAttribArray(positionAttribute(), false);
|
||||
device->EnableVertexAttribArray(colorAttribute(), false);
|
||||
|
@ -60,10 +60,11 @@ namespace spades {
|
||||
|
||||
for(size_t i = 0; i < sources.size(); i++){
|
||||
srcs.push_back(sources[i].c_str());
|
||||
lens.push_back(sources[i].size());
|
||||
lens.push_back(static_cast<int> (sources[i].size()));
|
||||
}
|
||||
|
||||
device->ShaderSource(handle, srcs.size(),
|
||||
device->ShaderSource(handle,
|
||||
static_cast<IGLDevice::Sizei> (srcs.size()),
|
||||
srcs.data(), lens.data());
|
||||
|
||||
device->CompileShader(handle);
|
||||
@ -74,7 +75,10 @@ namespace spades {
|
||||
errMsg.resize(device->GetShaderInteger(handle, IGLDevice::InfoLogLength) + 1);
|
||||
|
||||
IGLDevice::Sizei outLen;
|
||||
device->GetShaderInfoLog(handle, errMsg.size(), &outLen, errMsg.data());
|
||||
device->GetShaderInfoLog(handle,
|
||||
static_cast<IGLDevice::Sizei> (errMsg.size()),
|
||||
&outLen,
|
||||
errMsg.data());
|
||||
errMsg[outLen] = 0;
|
||||
|
||||
std::string src;
|
||||
|
@ -522,7 +522,7 @@ namespace spades {
|
||||
lastImage->Bind(IGLDevice::Texture2D);
|
||||
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
indices.size(),
|
||||
static_cast<IGLDevice::Sizei> (indices.size()),
|
||||
IGLDevice::UnsignedInt,
|
||||
indices.data());
|
||||
|
||||
|
@ -391,7 +391,7 @@ namespace spades {
|
||||
lastImage->Bind(IGLDevice::Texture2D);
|
||||
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
indices.size(),
|
||||
static_cast<IGLDevice::Sizei> (indices.size()),
|
||||
IGLDevice::UnsignedInt,
|
||||
indices.data());
|
||||
|
||||
|
@ -196,7 +196,7 @@ namespace spades {
|
||||
lastImage->Bind(IGLDevice::Texture2D);
|
||||
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
indices.size(),
|
||||
static_cast<IGLDevice::Sizei> (indices.size()),
|
||||
IGLDevice::UnsignedInt,
|
||||
indices.data());
|
||||
|
||||
|
@ -55,13 +55,13 @@ namespace spades {
|
||||
buffer = device->GenBuffer();
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, buffer);
|
||||
device->BufferData(IGLDevice::ArrayBuffer,
|
||||
vertices.size() * sizeof(Vertex),
|
||||
static_cast<IGLDevice::Sizei> (vertices.size() * sizeof(Vertex)),
|
||||
vertices.data(), IGLDevice::StaticDraw);
|
||||
|
||||
idxBuffer = device->GenBuffer();
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, idxBuffer);
|
||||
device->BufferData(IGLDevice::ArrayBuffer,
|
||||
indices.size() * sizeof(uint32_t),
|
||||
static_cast<IGLDevice::Sizei> (indices.size() * sizeof(uint32_t)),
|
||||
indices.data(), IGLDevice::StaticDraw);
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, 0);
|
||||
|
||||
|
@ -661,11 +661,13 @@ namespace spades {
|
||||
|
||||
buffer = device->GenBuffer();
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, buffer);
|
||||
device->BufferData(IGLDevice::ArrayBuffer, sizeof(Vertex)*vertices.size(),
|
||||
device->BufferData(IGLDevice::ArrayBuffer,
|
||||
static_cast<IGLDevice::Sizei> (sizeof(Vertex) * vertices.size()),
|
||||
vertices.data(), IGLDevice::StaticDraw);
|
||||
idxBuffer = device->GenBuffer();
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, idxBuffer);
|
||||
device->BufferData(IGLDevice::ArrayBuffer, sizeof(uint32_t)*indices.size(),
|
||||
device->BufferData(IGLDevice::ArrayBuffer,
|
||||
static_cast<IGLDevice::Sizei> (sizeof(uint32_t) * indices.size()),
|
||||
indices.data(), IGLDevice::StaticDraw);
|
||||
device->BindBuffer(IGLDevice::ArrayBuffer, 0);
|
||||
|
||||
@ -879,7 +881,8 @@ namespace spades {
|
||||
device->BeginQuery(IGLDevice::SamplesPassed,
|
||||
occlusionQuery);
|
||||
|
||||
device->DrawElements(IGLDevice::Triangles, numIndices,
|
||||
device->DrawElements(IGLDevice::Triangles,
|
||||
static_cast<IGLDevice::Sizei> (numIndices),
|
||||
IGLDevice::UnsignedInt, NULL);
|
||||
|
||||
if(occlusionQuery)
|
||||
@ -1005,8 +1008,8 @@ namespace spades {
|
||||
}else{
|
||||
// partial update
|
||||
for(size_t i = 0; i < updateBitmap.size(); i++){
|
||||
int y = i / updateBitmapPitch;
|
||||
int x = (i - y * updateBitmapPitch) * 32;
|
||||
int y = static_cast<int> (i / updateBitmapPitch);
|
||||
int x = static_cast<int> ((i - y * updateBitmapPitch) * 32);
|
||||
if(updateBitmap[i] == 0)
|
||||
continue;
|
||||
|
||||
|
@ -589,7 +589,7 @@ enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENet
|
||||
startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32));
|
||||
|
||||
if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength)
|
||||
fragmentLength = startCommand -> packet -> dataLength - fragmentOffset;
|
||||
fragmentLength = (enet_uint32) startCommand -> packet -> dataLength - fragmentOffset;
|
||||
|
||||
memcpy (startCommand -> packet -> data + fragmentOffset,
|
||||
(enet_uint8 *) command + sizeof (ENetProtocolSendFragment),
|
||||
@ -707,7 +707,7 @@ enet_protocol_handle_send_unreliable_fragment (ENetHost * host, ENetPeer * peer,
|
||||
startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber % 32));
|
||||
|
||||
if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength)
|
||||
fragmentLength = startCommand -> packet -> dataLength - fragmentOffset;
|
||||
fragmentLength = (enet_uint32) startCommand -> packet -> dataLength - fragmentOffset;
|
||||
|
||||
memcpy (startCommand -> packet -> data + fragmentOffset,
|
||||
(enet_uint8 *) command + sizeof (ENetProtocolSendFragment),
|
||||
|
@ -58,7 +58,7 @@ enet_time_get (void)
|
||||
|
||||
gettimeofday (& timeVal, NULL);
|
||||
|
||||
return timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - timeBase;
|
||||
return (enet_uint32) (timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - timeBase);
|
||||
}
|
||||
|
||||
void
|
||||
@ -68,7 +68,7 @@ enet_time_set (enet_uint32 newTimeBase)
|
||||
|
||||
gettimeofday (& timeVal, NULL);
|
||||
|
||||
timeBase = timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase;
|
||||
timeBase = (enet_uint32) (timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase);
|
||||
}
|
||||
|
||||
int
|
||||
@ -293,9 +293,9 @@ enet_socket_send (ENetSocket socket,
|
||||
}
|
||||
|
||||
msgHdr.msg_iov = (struct iovec *) buffers;
|
||||
msgHdr.msg_iovlen = bufferCount;
|
||||
msgHdr.msg_iovlen = (int) bufferCount;
|
||||
|
||||
sentLength = sendmsg (socket, & msgHdr, MSG_NOSIGNAL);
|
||||
sentLength = (int) sendmsg (socket, & msgHdr, MSG_NOSIGNAL);
|
||||
|
||||
if (sentLength == -1)
|
||||
{
|
||||
@ -327,9 +327,9 @@ enet_socket_receive (ENetSocket socket,
|
||||
}
|
||||
|
||||
msgHdr.msg_iov = (struct iovec *) buffers;
|
||||
msgHdr.msg_iovlen = bufferCount;
|
||||
msgHdr.msg_iovlen = (int) bufferCount;
|
||||
|
||||
recvLength = recvmsg (socket, & msgHdr, MSG_NOSIGNAL);
|
||||
recvLength = (int) recvmsg (socket, & msgHdr, MSG_NOSIGNAL);
|
||||
|
||||
if (recvLength == -1)
|
||||
{
|
||||
|
@ -57,17 +57,20 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER>=1900 // Visual Studio 2015 or higher
|
||||
#if _MSC_VER >= 1900 // Visual Studio 2015 or higher
|
||||
extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
|
||||
#endif
|
||||
|
||||
static const unsigned char splashImage[] = {
|
||||
#include "SplashImage.inc"
|
||||
};
|
||||
|
||||
#ifdef __APPLE__
|
||||
#elif __unix
|
||||
static const unsigned char Icon[] = {
|
||||
#include "Icon.inc"
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
SPADES_SETTING(cl_showStartupWindow, "1");
|
||||
|
||||
|
@ -315,7 +315,7 @@ namespace spades {
|
||||
asIScriptEngine *eng = ScriptManager::GetInstance()->GetEngine();
|
||||
asIObjectType* t = eng->GetObjectTypeById(eng->GetTypeIdByDecl("array<spades::MainScreenServerItem@>"));
|
||||
SPAssert(t != NULL);
|
||||
CScriptArray *arr = new CScriptArray(lst.size(), t);
|
||||
CScriptArray *arr = new CScriptArray(static_cast<asUINT>(lst.size()), t);
|
||||
for(size_t i = 0; i < lst.size(); i++){
|
||||
arr->SetValue((asUINT)i, &(lst[i]));
|
||||
}
|
||||
|
@ -40,10 +40,12 @@
|
||||
#include <Draw/SWRenderer.h>
|
||||
#include <Draw/SWPort.h>
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
#elif __unix
|
||||
static const unsigned char Icon[] = {
|
||||
#include "Icon.inc"
|
||||
};
|
||||
#endif
|
||||
|
||||
SPADES_SETTING(r_videoWidth, "1024");
|
||||
SPADES_SETTING(r_videoHeight, "640");
|
||||
|
@ -30,10 +30,12 @@
|
||||
#include "../Imports/OpenGL.h" //for gpu info
|
||||
#include "../Imports/SDL.h"
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
#elif __unix
|
||||
static const unsigned char Icon[] = {
|
||||
#include "Icon.inc"
|
||||
};
|
||||
#endif
|
||||
|
||||
SPADES_SETTING(r_bloom, "");
|
||||
SPADES_SETTING(r_lens, "");
|
||||
|
@ -180,14 +180,14 @@ namespace spades {
|
||||
int Find(const T& val) const {
|
||||
typename std::vector<T>::const_iterator it = std::find(inner.begin(), inner.end(), val);
|
||||
if(it == inner.end()) return -1;
|
||||
return it - inner.begin();
|
||||
return static_cast<int> (it - inner.begin());
|
||||
}
|
||||
|
||||
int Find(asUINT ind, const T& val) const {
|
||||
if(ind >= GetSize()) return -1;
|
||||
typename std::vector<T>::const_iterator it = std::find(inner.begin() + ind, inner.end(), val);
|
||||
if(it == inner.end()) return -1;
|
||||
return it - inner.begin();
|
||||
return static_cast<int> (it - inner.begin());
|
||||
}
|
||||
|
||||
bool operator ==(const ArrayType& array) const {
|
||||
|
@ -116,7 +116,7 @@ std::string valueToQuotedString( const char *value )
|
||||
// We have to walk value and escape any special characters.
|
||||
// Appending to std::string is not efficient, but this should be rare.
|
||||
// (Note: forward slashes are *not* rare, but I am not escaping them.)
|
||||
unsigned maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL
|
||||
unsigned maxsize = static_cast<unsigned> (strlen(value) * 2 + 3); // allescaped+quotes+NULL
|
||||
std::string result;
|
||||
result.reserve(maxsize); // to avoid lots of mallocs
|
||||
result += "\"";
|
||||
|
Loading…
x
Reference in New Issue
Block a user