fixed msvc6 warnings

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1895 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Lance 2006-01-27 08:06:48 +00:00
parent 80d7e00dbb
commit 20ef474862
12 changed files with 163 additions and 60 deletions

View File

@ -686,8 +686,6 @@ int sizeofcoord=2;
int sizeofangle=1;
float MSG_FromCoord(coorddata c, int bytes)
{
#pragma warning(disable:4701)
switch(bytes)
{
case 2: //encode 1/8th precision, giving -4096 to 4096 map sizes
@ -1145,9 +1143,7 @@ char *MSG_ReadStringLine (void)
float MSG_ReadCoord (void)
{
#pragma warning(disable:4701)
coorddata c;
coorddata c = {0};
MSG_ReadData(&c, sizeofcoord);
return MSG_FromCoord(c, sizeofcoord);
}
@ -2696,6 +2692,87 @@ void Info_SetValueForStarKey (char *s, const char *key, const char *value, int m
*s = 0;
}
void Info_SetValueForStarKeyMoodles (char *s, const char *key, int value, int maxsize)
{
char newv[1024], *v;
int c;
#ifdef SERVERONLY
extern cvar_t sv_highchars;
#endif
if (strstr (key, "\\"))
{
Con_TPrintf (TL_KEYHASSLASH);
return;
}
if (strstr (key, "\"") )
{
Con_TPrintf (TL_KEYHASQUOTE);
return;
}
if (strlen(key) >= MAX_INFO_KEY)
{
Con_TPrintf (TL_KEYTOOLONG);
return;
}
// this next line is kinda trippy
if (*(v = Info_ValueForKey(s, key)))
{
if (*Info_ValueForKey(s, "*ver")) //quick hack to kill off unneeded info on overflow. We can't simply increase the quantity of this stuff.
{
Info_RemoveKey(s, "*ver");
Info_SetValueForStarKeyMoodles (s, key, value, maxsize);
return;
}
Con_TPrintf (TL_INFOSTRINGTOOLONG);
return;
}
Info_RemoveKey (s, key);
if (!value)
return;
_snprintf (newv, sizeof(newv), "\\%s\\%s", key, value);
if ((int)(strlen(newv) + strlen(s) + 1) > maxsize)
{
Con_TPrintf (TL_INFOSTRINGTOOLONG);
return;
}
// only copy ascii values
s += strlen(s);
v = newv;
while (*v)
{
c = (unsigned char)*v++;
#ifndef SERVERONLY
// client only allows highbits on name
if (stricmp(key, "name") != 0) {
c &= 127;
if (c < 32 || c > 127)
continue;
// auto lowercase team
if (stricmp(key, "team") == 0)
c = tolower(c);
}
#else
if (!sv_highchars.value) {
c &= 127;
if (c < 32 || c > 127)
continue;
}
#endif
// c &= 127; // strip high bits
if (c > 13) // && c < 127)
*s++ = c;
}
*s = 0;
}
void Info_SetValueForKey (char *s, const char *key, const char *value, int maxsize)
{
if (key[0] == '*')
@ -2707,6 +2784,17 @@ void Info_SetValueForKey (char *s, const char *key, const char *value, int maxsi
Info_SetValueForStarKey (s, key, value, maxsize);
}
void Info_SetValueForKeyMoodles (char *s, const char *key, int value, int maxsize) //modified to accept an integer in svq3_game.c
{
if (key[0] == '*')
{
Con_TPrintf (TL_STARKEYPROTECTED);
return;
}
Info_SetValueForStarKeyMoodles (s, key, value, maxsize);
}
void Info_Print (char *s)
{
char key[1024];

View File

@ -803,7 +803,7 @@ static void *FSZIP_LoadZipFile (vfsfile_t *packhandle, char *desc)
zipfile_t *zip;
packfile_t *newfiles;
unz_global_info globalinf;
unz_global_info globalinf = {0};
unz_file_info file_info;

View File

@ -1365,7 +1365,7 @@ void NET_GetLocalAddress (int socket, netadr_t *out)
char buff[512];
struct sockaddr_qstorage address;
int namelen;
netadr_t adr;
netadr_t adr = {0};
qboolean notvalid = false;
strcpy(buff, "localhost");

View File

@ -213,15 +213,15 @@ local unsigned long unzlocal_SearchCentralDir(vfsfile_t *fin) {
of this unzip package.
*/
extern unzFile ZEXPORT unzOpen (vfsfile_t *fin) {
unz_s us;
unz_s us = {0};
unz_s *s;
unsigned long central_pos,uL;
unsigned long number_disk; /* number of the current dist, used for
unsigned long number_disk = 0; /* number of the current dist, used for
spaning ZIP, unsupported, always 0*/
unsigned long number_disk_with_CD; /* number the the disk with central dir, used
unsigned long number_disk_with_CD = 0; /* number the the disk with central dir, used
for spaning ZIP, unsupported, always 0*/
unsigned long number_entry_CD; /* total number of entries in
unsigned long number_entry_CD = 0; /* total number of entries in
the central dir
(same than number_entry on nospan) */
@ -335,9 +335,9 @@ local int unzlocal_GetCurrentFileInfoInternal (unzFile file,
char *szComment, unsigned long commentBufferSize) {
unz_s* s;
unz_file_info file_info;
unz_file_info_internal file_info_internal;
unz_file_info_internal file_info_internal = {0};
int err=UNZ_OK;
unsigned long uMagic;
unsigned long uMagic = 0;
long lSeek=0;
if (!file) return UNZ_PARAMERROR;
@ -515,9 +515,9 @@ extern int ZEXPORT unzLocateFileMy (unzFile file, unsigned long num, unsigned lo
local int unzlocal_CheckCurrentFileCoherencyHeader (unz_s *s, unsigned int *piSizeVar,
unsigned long *poffset_local_extrafield,
unsigned int *psize_local_extrafield) {
unsigned long uMagic,uData,uFlags;
unsigned long size_filename;
unsigned long size_extra_field;
unsigned long uMagic = 0,uData = 0,uFlags = 0;
unsigned long size_filename = 0;
unsigned long size_extra_field = 0;
int err=UNZ_OK;
*piSizeVar = 0;

View File

@ -1845,6 +1845,10 @@ void R_DrawGAliasModel (entity_t *e)
}
#ifdef Q3SHADERS
//if they're in different files it's probably just the compiler not knowing the return type when it reaches that line so it guesses int
//timeserv thinks we need a prototype (whatever that is) ~ Moodles
#pragma warning(disable:4047)
fog = CM_FogForOrigin(currententity->origin);
#endif
@ -4697,7 +4701,8 @@ void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer)
galiasbone_t *outbone;
dpmbone_t *inbone;
float *inst, *outst;
float *inst; //unreferenced local variable in the dedicated server
float *outst = 0;
float *outposedata;

View File

@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#define GL_USE8BITTEX
int gl_anisotropy_factor = 1;
int glx, gly, glwidth, glheight;
mesh_t draw_mesh;
@ -109,7 +110,6 @@ int gl_alpha_format = 4;
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
int gl_filter_max = GL_LINEAR;
int gl_anisotropy_factor = 1;
int gl_anisotropy_factor_max = 0;
@ -3092,6 +3092,8 @@ done:
if (gl_config.sgis_generate_mipmap&&mipmap)
qglTexParameterf(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
qglTexParameterf(GL_TEXTURE_2D, GL_MULTISAMPLE_ARB, GL_FALSE);
if (gl_config.ext_texture_filter_anisotropic)
{
qglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,gl_anisotropy_factor); // without this, you could loose anisotropy on mapchange

View File

@ -2017,7 +2017,7 @@ void Shader_Default2D(char *shortname, shader_t *s)
int R_LoadShader ( char *name, void(*defaultgen)(char *name, shader_t*))
{
int i, f = -1;
unsigned int offset, length = 0;
unsigned int offset = 0, length = 0;
char shortname[MAX_QPATH], path[MAX_QPATH];
char *buf = NULL, *ts = NULL;
shader_t *s;

View File

@ -526,6 +526,10 @@ typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
#endif
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
#define GL_MULTISAMPLE_ARB 0x809D

View File

@ -40,6 +40,7 @@ crosses a waterline.
int needcleanup;
int fatbytes;
int glowsize, glowcolor; // made it a global variable, to suppress msvc warning.
qbyte fatpvs[(MAX_MAP_LEAFS+1)/4];
@ -1810,8 +1811,6 @@ int i, eff;
float miss;
unsigned int bits=0;
int glowsize, glowcolor;
for (i=0 ; i<3 ; i++)
{
miss = ent->v->origin[i] - ent->baseline.origin[i];

View File

@ -32,7 +32,7 @@ char rank_cvargroup[] = "server rankings";
#define RANKFILE_IDENT *(int*)"RANK"
void inline READ_PLAYERSTATS(int x, rankstats_t *os)
{
{
int i;
fseek(rankfile, sizeof(rankfileheader_t)+sizeof(rankheader_t)+((x-1)*sizeof(rankinfo_t)), SEEK_SET);
@ -44,8 +44,8 @@ void inline READ_PLAYERSTATS(int x, rankstats_t *os)
os->parm[i] = swapfloat(os->parm[i]);
os->timeonserver = swapfloat(os->timeonserver);
// os->flags1 = (os->flags1);
// os->trustlevel = (os->trustlevel);
// os->pad2 = (os->pad2);
// os->trustlevel = (os->trustlevel);
// os->pad2 = (os->pad2);
// os->pad3 = (os->pad3);
}
@ -62,15 +62,15 @@ void inline WRITE_PLAYERSTATS(int x, rankstats_t *os)
ns.parm[i] = swapfloat(os->parm[i]);
ns.timeonserver = swapfloat(os->timeonserver);
ns.flags1 = (os->flags1);
ns.trustlevel = (os->trustlevel);
ns.pad2 = (os->pad2);
ns.trustlevel = (os->trustlevel);
ns.pad2 = (os->pad2);
ns.pad3 = (os->pad3);
fwrite(&ns, sizeof(rankstats_t), 1, rankfile);
}
void inline READ_PLAYERHEADER(int x, rankheader_t *oh)
{
{
fseek(rankfile, sizeof(rankfileheader_t)+((x-1)*sizeof(rankinfo_t)), SEEK_SET);
fread(oh, sizeof(rankheader_t), 1, rankfile);
@ -79,7 +79,7 @@ void inline READ_PLAYERHEADER(int x, rankheader_t *oh)
oh->next = swaplong(oh->next);
// strcpy(oh->name, oh->name);
oh->pwd = swaplong(oh->pwd);
oh->score = swapfloat(oh->score);
oh->score = swapfloat(oh->score);
}
void inline WRITE_PLAYERHEADER(int x, rankheader_t *oh)
@ -126,7 +126,7 @@ qboolean Rank_OpenRankings(void)
if (!rankfile)
{
if (!*rank_filename.string)
{
{
return false;
}
@ -171,7 +171,7 @@ qboolean Rank_OpenRankings(void)
void LINKUN(int id)
{
int idnext, idprev;
rankheader_t hnext, hprev, info;
rankheader_t hnext = {0}, hprev = {0}, info;
READ_PLAYERHEADER(id, &info);
@ -189,7 +189,7 @@ void LINKUN(int id)
}
if (idprev)
{
hprev.next = idnext;
hprev.next = idnext;
WRITE_PLAYERHEADER(idprev, &hprev);
}
else if (rankfileheader.leader == id) //ensure header is accurate
@ -198,7 +198,7 @@ void LINKUN(int id)
WRITEHEADER();
}
else if (rankfileheader.freeslot == id)
{
{
rankfileheader.freeslot = info.next;
WRITEHEADER();
}
@ -211,7 +211,7 @@ void LINKUN(int id)
void LINKBEFORE(int bef, int id, rankheader_t *info)
{
int idnext, idprev;
rankheader_t hnext, hprev;
rankheader_t hnext, hprev = {0};
if (!bef)
Sys_Error("Cannot link before no entry\n");
@ -224,7 +224,7 @@ void LINKBEFORE(int bef, int id, rankheader_t *info)
//now we know the before and after entries.
hnext.prev = id;
hnext.prev = id;
WRITE_PLAYERHEADER(idnext, &hnext);
if (idprev)
@ -250,13 +250,13 @@ void LINKBEFORE(int bef, int id, rankheader_t *info)
void LINKAFTER(int aft, int id, rankheader_t *info)
{
int idnext, idprev;
rankheader_t hnext, hprev;
rankheader_t hnext = {0}, hprev = {0};
idprev = aft;
if (idprev)
{
READ_PLAYERHEADER(idprev, &hprev);
idnext = hprev.next;
idnext = hprev.next;
}
else
idnext = rankfileheader.leader;
@ -330,7 +330,7 @@ void Rank_SetPlayerStats(int id, rankstats_t *stats)
if (!id)
{
Con_Printf("WARNING: Rank_SetPlayerStats with id 0\n");
Con_Printf("WARNING: Rank_SetPlayerStats with id 0\n");
return;
}
@ -341,9 +341,9 @@ void Rank_SetPlayerStats(int id, rankstats_t *stats)
READ_PLAYERHEADER(id, &nh);
nh.score = (stats->kills+1)/((float)stats->deaths+1);
//WRITE_PLAYERHEADER(id, &nh); //saved on link.
LINKUN(id);
nid = rankfileheader.leader;
if (!nid) //Hmm. First player!
{
@ -368,7 +368,7 @@ void Rank_SetPlayerStats(int id, rankstats_t *stats)
return;
}
nid = rh.next;
}
}
}
int Rank_GetPlayerID(char *name, int pwd, qboolean allowadd, qboolean requirepasswordtobeset)
@ -406,7 +406,7 @@ int Rank_GetPlayerID(char *name, int pwd, qboolean allowadd, qboolean requirepas
id = rankfileheader.freeslot;
if (id)
{
{
READ_PLAYERHEADER(id, &rh);
rankfileheader.freeslot = rh.next;
WRITEHEADER();
@ -415,7 +415,7 @@ int Rank_GetPlayerID(char *name, int pwd, qboolean allowadd, qboolean requirepas
Q_strncpyz(rh.name, name, sizeof(rh.name));
rh.pwd = pwd;
rh.prev = 0;
rh.next = rankfileheader.usedslots;
rh.next = rankfileheader.usedslots;
rankfileheader.usedslots = id;
WRITEHEADER();
@ -502,16 +502,16 @@ void Rank_AddUser_f (void)
id = rankfileheader.freeslot;
if (id)
{
{
READ_PLAYERHEADER(id, &rh);
rankfileheader.freeslot = rh.next;
WRITEHEADER();
memset(&rh, 0, sizeof(rh));
Q_strncpyz(rh.name, name, sizeof(rh.name));
rh.pwd = pwd;
rh.pwd = pwd;
rh.prev = 0;
rh.next = rankfileheader.usedslots;
rh.next = rankfileheader.usedslots;
rankfileheader.usedslots = id;
WRITEHEADER();
@ -638,7 +638,7 @@ int Rank_Enumerate (unsigned int first, unsigned int last, void (*callback) (con
}
void Rank_RankingList_f (void)
{
{
rankinfo_t ri;
int id;
int num;
@ -697,7 +697,7 @@ void Rank_Remove_f (void)
READ_PLAYERINFO(id, &ri);
if (num == remnum)
{
{
LINKUN(id);
ri.h.next = rankfileheader.freeslot;
ri.h.prev = 0;
@ -717,7 +717,7 @@ void Rank_Remove_f (void)
}
void Rank_ListTop10_f (void)
{
{
rankinfo_t ri;
int id;
int num;
@ -750,7 +750,7 @@ void Rank_ListTop10_f (void)
}
void Rank_Find_f (void)
{
{
rankinfo_t ri;
int id;
@ -793,7 +793,7 @@ void Rank_Refresh_f(void)
if (host_client->rankid)
{
rankstats_t rs;
rankstats_t rs = {0};
Rank_GetPlayerStats(host_client->rankid, &rs);
rs.timeonserver += realtime - host_client->stats_started;
host_client->stats_started = realtime;
@ -815,7 +815,7 @@ void Rank_RCon_f(void)
{
int gofor, num, id;
int newlevel;
rankstats_t rs;
rankstats_t rs = {0};
rankinfo_t ri;
if (!Rank_OpenRankings())
@ -842,7 +842,7 @@ void Rank_RCon_f(void)
READ_PLAYERINFO(id, &ri);
if (num == gofor)
{
{
//save new level
Rank_GetPlayerStats(id, &rs);
@ -880,7 +880,7 @@ void Rank_RegisterCommands(void)
Cmd_AddCommand("rankadd", Rank_AddUser_f);
Cmd_AddCommand("adduser", Rank_AddUser_f);
Cmd_AddCommand("setpass", Rank_SetPass_f);
Cmd_AddCommand("setpass", Rank_SetPass_f);
Cvar_Register(&rank_autoadd, rank_cvargroup);
Cvar_Register(&rank_needlogin, rank_cvargroup);

View File

@ -1873,7 +1873,8 @@ SV_Say
void SV_Say (qboolean team)
{
client_t *client;
int j, tmp;
int j;
//int tmp; //unreferenced
char *p;
char text[1024];
char t1[32], *t2;

View File

@ -1824,7 +1824,7 @@ void SV_InitBotLib()
qboolean SVQ3_InitGame(void)
{
char buffer[8192];
char *str;
int str;
char sysinfo[8192];
extern cvar_t progs;
@ -1859,14 +1859,18 @@ qboolean SVQ3_InitGame(void)
sysinfo[0] = '\0';
Info_SetValueForKey(sysinfo, "sv_serverid", va("%i", svs.spawncount), MAX_SERVERINFO_STRING);
str = FS_GetPackHashes(buffer, sizeof(buffer), false);
Info_SetValueForKey(sysinfo, "sv_paks", str, MAX_SERVERINFO_STRING);
Info_SetValueForKeyMoodles(sysinfo, "sv_paks", str, MAX_SERVERINFO_STRING); // modified to accept an integer
str = FS_GetPackNames(buffer, sizeof(buffer), false);
Info_SetValueForKey(sysinfo, "sv_pakNames", str, MAX_SERVERINFO_STRING);
Info_SetValueForKeyMoodles(sysinfo, "sv_pakNames", str, MAX_SERVERINFO_STRING); // modified to accept an integer
str = FS_GetPackHashes(buffer, sizeof(buffer), true);
Info_SetValueForKey(sysinfo, "sv_referencedPaks", str, MAX_SERVERINFO_STRING);
Info_SetValueForKeyMoodles(sysinfo, "sv_referencedPaks", str, MAX_SERVERINFO_STRING); // modified to accept an integer
str = FS_GetPackNames(buffer, sizeof(buffer), true);
Info_SetValueForKey(sysinfo, "sv_referencedPakNames", str, MAX_SERVERINFO_STRING);
Info_SetValueForKeyMoodles(sysinfo, "sv_referencedPakNames", str, MAX_SERVERINFO_STRING); // modified to accept an integer
Info_SetValueForKey(sysinfo, "sv_pure", "1", MAX_SERVERINFO_STRING);
@ -1968,7 +1972,7 @@ void SVQ3_CreateBaseline(void)
//Writes the entities to the clients
void SVQ3_EmitPacketEntities(client_t *client, q3client_frame_t *from, q3client_frame_t *to, sizebuf_t *msg)
{
q3entityState_t *oldent, *newent;
q3entityState_t *oldent = {0}, *newent = {0};
int oldindex, newindex;
int oldnum, newnum;
int from_num_entities;