From a0b82951820fab3a3c64d42a074256053a529987 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sat, 20 Sep 2008 17:21:27 +0000 Subject: [PATCH] VC fixes git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2714 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/command.cpp | 4 ++-- source/src/server.cpp | 4 ++-- source/src/sound.cpp | 2 +- source/src/tools.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/src/command.cpp b/source/src/command.cpp index a1e74683..b8d50cb0 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -458,7 +458,7 @@ bool nickcomplete(char *s) if(!players.length()) return false; char *cp = s; - for(int i = strlen(s) - 2; i > 0; i--) + for(int i = (int)strlen(s) - 2; i > 0; i--) if(s[i] == ' ') { cp = s + i + 1; break; } if(!completesize) { completesize = (int)strlen(cp); completeidx = 0; } @@ -494,7 +494,7 @@ void commandcomplete(char *s) } if(!s[1]) return; char *cp = s; - for(int i = strlen(s) - 2; i > 0; i--) + for(int i = (int)strlen(s) - 2; i > 0; i--) if(s[i] == ';' || s[i] == ' ') { cp = s + i; break; } if(!completesize) { diff --git a/source/src/server.cpp b/source/src/server.cpp index 4b8031ed..cf937154 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1203,7 +1203,7 @@ bool spamdetect(client *cl, char *text) // checks doubled lines and average typi int pause = servmillis - cl->lastsay; if(pause < 0 || pause > 90*1000) pause = 90*1000; cl->saychars -= (SPAMCHARPERMINUTE * pause) / (60*1000); - cl->saychars += strlen(text); + cl->saychars += (int)strlen(text); if(cl->saychars < 0) cl->saychars = 0; if(text[0] && !strcmp(text, cl->lastsaytext) && servmillis - cl->lastsay < SPAMREPEATINTERVAL*1000) { @@ -2399,7 +2399,7 @@ void process(ENetPacket *packet, int sender, int chan) // sender may be -1 } #define QUEUE_INT(n) QUEUE_BUF(5, putint(buf, n)) #define QUEUE_UINT(n) QUEUE_BUF(4, putuint(buf, n)) - #define QUEUE_STR(text) QUEUE_BUF(2*strlen(text)+1, sendstring(text, buf)) + #define QUEUE_STR(text) QUEUE_BUF(2*(int)strlen(text)+1, sendstring(text, buf)) #define MSG_PACKET(packet) \ ENetPacket *packet = enet_packet_create(NULL, 16 + p.length() - curmsg, ENET_PACKET_FLAG_RELIABLE); \ ucharbuf buf(packet->data, packet->dataLength); \ diff --git a/source/src/sound.cpp b/source/src/sound.cpp index b04bd63c..299b4d99 100644 --- a/source/src/sound.cpp +++ b/source/src/sound.cpp @@ -1221,7 +1221,7 @@ bufferhashtable bufferpool; VARFP(soundvol, 0, 128, 255, { - alListenerf(AL_GAIN, soundvol/255.0f); + if(!nosound) alListenerf(AL_GAIN, soundvol/255.0f); }); void setmusicvol() diff --git a/source/src/tools.cpp b/source/src/tools.cpp index 0374729e..3b2365d9 100644 --- a/source/src/tools.cpp +++ b/source/src/tools.cpp @@ -187,9 +187,9 @@ char *loadfile(const char *fn, int *size, const char *mode) char *buf = new char[len+1]; if(!buf) { fclose(f); return NULL; } buf[len] = 0; - size_t rlen = fread(buf, 1, len, f); + int rlen = (int)fread(buf, 1, len, f); fclose(f); - if(size_t(len)!=rlen && (!mode || strchr(mode, 'b'))) + if(len!=rlen && (!mode || strchr(mode, 'b'))) { delete[] buf; return NULL;