Fixed 1000 warnings, changed switch-statements to handle all enumerations. Sorted it up abit too.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2585 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Molgrum 2007-08-07 19:16:32 +00:00
parent 865a5a003d
commit 2dfb03ee03
8 changed files with 164 additions and 114 deletions

View file

@ -1055,26 +1055,29 @@ void CL_Disconnect (void)
switch(cls.protocol) switch(cls.protocol)
{ {
#ifdef NQPROT
case CP_NETQUAKE: case CP_NETQUAKE:
#ifdef NQPROT
final[0] = clc_disconnect; final[0] = clc_disconnect;
final[1] = clc_stringcmd; final[1] = clc_stringcmd;
strcpy (final+2, "drop"); strcpy (final+2, "drop");
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 250000); Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 250000);
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 250000); Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 250000);
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 250000); Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 250000);
break;
#endif #endif
#ifdef Q2CLIENT break;
case CP_PLUGIN:
break;
case CP_QUAKE2: case CP_QUAKE2:
#ifdef Q2CLIENT
final[0] = clcq2_stringcmd; final[0] = clcq2_stringcmd;
strcpy (final+1, "disconnect"); strcpy (final+1, "disconnect");
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500); Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500);
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500); Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500);
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500); Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500);
break;
#endif #endif
break;
case CP_QUAKE3:
break;
case CP_QUAKEWORLD: case CP_QUAKEWORLD:
final[0] = clc_stringcmd; final[0] = clc_stringcmd;
strcpy (final+1, "drop"); strcpy (final+1, "drop");
@ -1082,6 +1085,8 @@ void CL_Disconnect (void)
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500); Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500);
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500); Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500);
break; break;
case CP_UNKNOWN:
break;
} }
cls.state = ca_disconnected; cls.state = ca_disconnected;
@ -2436,13 +2441,8 @@ void CL_ReadPackets (void)
switch(cls.protocol) switch(cls.protocol)
{ {
#ifdef Q3CLIENT
case CP_QUAKE3:
CLQ3_ParseServerMessage();
break;
#endif
#ifdef NQPROT
case CP_NETQUAKE: case CP_NETQUAKE:
#ifdef NQPROT
switch(NQNetChan_Process(&cls.netchan)) switch(NQNetChan_Process(&cls.netchan))
{ {
case 0: case 0:
@ -2454,15 +2454,22 @@ void CL_ReadPackets (void)
CLNQ_ParseServerMessage (); CLNQ_ParseServerMessage ();
break; break;
} }
break;
#endif #endif
#ifdef Q2CLIENT break;
case CP_PLUGIN:
break;
case CP_QUAKE2: case CP_QUAKE2:
#ifdef Q2CLIENT
if (!Netchan_Process(&cls.netchan)) if (!Netchan_Process(&cls.netchan))
continue; // wasn't accepted for some reason continue; // wasn't accepted for some reason
CLQ2_ParseServerMessage (); CLQ2_ParseServerMessage ();
break;
#endif #endif
case CP_QUAKE3:
#ifdef Q3CLIENT
CLQ3_ParseServerMessage();
#endif
break;
break;
case CP_QUAKEWORLD: case CP_QUAKEWORLD:
if (cls.demoplayback == DPB_MVD) if (cls.demoplayback == DPB_MVD)
{ {
@ -2479,6 +2486,8 @@ void CL_ReadPackets (void)
} }
CL_ParseServerMessage (); CL_ParseServerMessage ();
break; break;
case CP_UNKNOWN:
break;
} }
// if (cls.demoplayback && cls.state >= ca_active && !CL_DemoBehind()) // if (cls.demoplayback && cls.state >= ca_active && !CL_DemoBehind())

View file

@ -187,26 +187,32 @@ qboolean Master_ServerIsGreater(serverinfo_t *a, serverinfo_t *b)
{ {
switch(sortfield) switch(sortfield)
{ {
case SLKEY_PING: case SLKEY_ADDRESS:
return Master_CompareInteger(a->ping, b->ping, SLIST_TEST_LESS); break;
case SLKEY_NUMPLAYERS:
return Master_CompareInteger(a->players, b->players, SLIST_TEST_LESS);
case SLKEY_MAXPLAYERS:
return Master_CompareInteger(a->maxplayers, b->maxplayers, SLIST_TEST_LESS);
case SLKEY_FREEPLAYERS:
return Master_CompareInteger(a->maxplayers - a->players, b->maxplayers - b->players, SLIST_TEST_LESS);
case SLKEY_BASEGAME: case SLKEY_BASEGAME:
return Master_CompareInteger(a->special, b->special, SLIST_TEST_LESS); return Master_CompareInteger(a->special, b->special, SLIST_TEST_LESS);
case SLKEY_TIMELIMIT: case SLKEY_CUSTOM:
return Master_CompareInteger(a->tl, b->tl, SLIST_TEST_LESS); break;
case SLKEY_FRAGLIMIT: case SLKEY_FRAGLIMIT:
return Master_CompareInteger(a->fl, b->fl, SLIST_TEST_LESS); return Master_CompareInteger(a->fl, b->fl, SLIST_TEST_LESS);
case SLKEY_MAP: case SLKEY_FREEPLAYERS:
return Master_CompareString(a->map, b->map, SLIST_TEST_LESS); return Master_CompareInteger(a->maxplayers - a->players, b->maxplayers - b->players, SLIST_TEST_LESS);
case SLKEY_GAMEDIR: case SLKEY_GAMEDIR:
return Master_CompareString(a->gamedir, b->gamedir, SLIST_TEST_LESS); return Master_CompareString(a->gamedir, b->gamedir, SLIST_TEST_LESS);
case SLKEY_MAP:
return Master_CompareString(a->map, b->map, SLIST_TEST_LESS);
case SLKEY_MAXPLAYERS:
return Master_CompareInteger(a->maxplayers, b->maxplayers, SLIST_TEST_LESS);
case SLKEY_NAME: case SLKEY_NAME:
return Master_CompareString(a->name, b->name, SLIST_TEST_LESS); return Master_CompareString(a->name, b->name, SLIST_TEST_LESS);
case SLKEY_NUMPLAYERS:
return Master_CompareInteger(a->players, b->players, SLIST_TEST_LESS);
case SLKEY_PING:
return Master_CompareInteger(a->ping, b->ping, SLIST_TEST_LESS);
case SLKEY_TIMELIMIT:
return Master_CompareInteger(a->tl, b->tl, SLIST_TEST_LESS);
case SLKEY_TOOMANY:
break;
} }
return false; return false;
} }

View file

@ -4449,23 +4449,25 @@ void DrawParticleTypes (void (*texturedparticles)(particle_t *,part_type_t*), vo
// prediction takes care of the rest // prediction takes care of the rest
switch(type->type) switch(type->type)
{ {
case PT_NORMAL:
pdraw = texturedparticles;
break;
case PT_BEAM: case PT_BEAM:
if (*type->texname) if (*type->texname)
bdraw = beamparticlest; bdraw = beamparticlest;
else else
bdraw = beamparticlesut; bdraw = beamparticlesut;
break; break;
case PT_TEXTUREDSPARK: case PT_DECAL:
pdraw = sparktexturedparticles; break;
case PT_NORMAL:
pdraw = texturedparticles;
break;
case PT_SPARK:
pdraw = sparklineparticles;
break; break;
case PT_SPARKFAN: case PT_SPARKFAN:
pdraw = sparkfanparticles; pdraw = sparkfanparticles;
break; break;
case PT_SPARK: case PT_TEXTUREDSPARK:
pdraw = sparklineparticles; pdraw = sparktexturedparticles;
break; break;
} }

View file

@ -599,48 +599,8 @@ void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits)
switch (amask->type) switch (amask->type)
{ {
#ifdef USEIPX case NA_INVALID:
case NA_IPX:
case NA_BROADCAST_IPX:
n = amask->address.ipx;
if (i > 80)
i = 80;
for (; i >= 8; i -= 8)
{
*n = 0xFF;
n++;
}
// fill last bit
if (i)
{
i = 8 - i;
i = 255 - ((1 << i) - 1);
*n = i;
}
break; break;
#endif
#ifdef IPPROTO_IPV6
case NA_IPV6:
case NA_BROADCAST_IP6:
n = amask->address.ip6;
if (i > 128)
i = 128;
for (; i >= 8; i -= 8)
{
*n = 0xFF;
n++;
}
// fill last bit
if (i)
{
i = 8 - i;
i = 255 - ((1 << i) - 1);
*n = i;
}
break;
#endif
case NA_IP: case NA_IP:
case NA_BROADCAST_IP: case NA_BROADCAST_IP:
n = amask->address.ip; n = amask->address.ip;
@ -660,6 +620,50 @@ void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits)
*n = i; *n = i;
} }
break; break;
case NA_IPV6:
case NA_BROADCAST_IP6:
#ifdef IPPROTO_IPV6
n = amask->address.ip6;
if (i > 128)
i = 128;
for (; i >= 8; i -= 8)
{
*n = 0xFF;
n++;
}
// fill last bit
if (i)
{
i = 8 - i;
i = 255 - ((1 << i) - 1);
*n = i;
}
#endif
break;
case NA_IPX:
case NA_BROADCAST_IPX:
#ifdef USEIPX
n = amask->address.ipx;
if (i > 80)
i = 80;
for (; i >= 8; i -= 8)
{
*n = 0xFF;
n++;
}
// fill last bit
if (i)
{
i = 8 - i;
i = 255 - ((1 << i) - 1);
*n = i;
}
#endif
break;
case NA_LOOPBACK:
break;
} }
} }

View file

@ -1272,20 +1272,25 @@ void Plug_Net_Close_Internal(int handle)
{ {
switch(pluginstreamarray[handle].type) switch(pluginstreamarray[handle].type)
{ {
#ifdef GNUTLS case STREAM_FILE:
if (*pluginstreamarray[handle].file.filename)
COM_WriteFile(pluginstreamarray[handle].file.filename, pluginstreamarray[handle].file.buffer, pluginstreamarray[handle].file.curlen);
BZ_Free(pluginstreamarray[handle].file.buffer);
break;
case STREAM_NONE:
break;
case STREAM_OSFILE:
break;
case STREAM_SOCKET:
closesocket(pluginstreamarray[handle].socket);
break;
case STREAM_TLS: case STREAM_TLS:
#ifdef GNUTLS
gnutls_bye (pluginstreamarray[handle].session, GNUTLS_SHUT_RDWR); gnutls_bye (pluginstreamarray[handle].session, GNUTLS_SHUT_RDWR);
pluginstreamarray[handle].type = STREAM_SOCKET; pluginstreamarray[handle].type = STREAM_SOCKET;
Plug_Net_Close_Internal(handle); Plug_Net_Close_Internal(handle);
return; return;
#endif #endif
case STREAM_SOCKET:
closesocket(pluginstreamarray[handle].socket);
break;
case STREAM_FILE:
if (*pluginstreamarray[handle].file.filename)
COM_WriteFile(pluginstreamarray[handle].file.filename, pluginstreamarray[handle].file.buffer, pluginstreamarray[handle].file.curlen);
BZ_Free(pluginstreamarray[handle].file.buffer);
break; break;
} }

View file

@ -943,6 +943,8 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
switch (svs.gametype) switch (svs.gametype)
{ {
case GT_MAX:
break;
case GT_PROGS: case GT_PROGS:
ent = EDICT_NUM(svprogfuncs, 0); ent = EDICT_NUM(svprogfuncs, 0);
ent->isfree = false; ent->isfree = false;
@ -978,8 +980,8 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
#endif #endif
break; break;
#ifdef Q2SERVER
case GT_QUAKE2: case GT_QUAKE2:
#ifdef Q2SERVER
for (i=0 ; i<MAX_CLIENTS ; i++) for (i=0 ; i<MAX_CLIENTS ; i++)
{ {
q2ent = Q2EDICT_NUM(i+1); q2ent = Q2EDICT_NUM(i+1);
@ -987,13 +989,13 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
svs.clients[i].q2edict = q2ent; svs.clients[i].q2edict = q2ent;
} }
sv.allocated_client_slots = i; sv.allocated_client_slots = i;
break;
#endif #endif
#ifdef Q3SERVER break;
case GT_QUAKE3: case GT_QUAKE3:
#ifdef Q3SERVER
sv.allocated_client_slots = 32; sv.allocated_client_slots = 32;
break;
#endif #endif
break;
} }
for (i=0 ; i<MAX_CLIENTS ; i++) for (i=0 ; i<MAX_CLIENTS ; i++)
@ -1135,14 +1137,18 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
Info_SetValueForStarKey(svs.info, "*entfile", crc, MAX_SERVERINFO_STRING); Info_SetValueForStarKey(svs.info, "*entfile", crc, MAX_SERVERINFO_STRING);
switch(svs.gametype) switch(svs.gametype)
{ {
case GT_MAX:
break;
case GT_PROGS: case GT_PROGS:
pr_edict_size = PR_LoadEnts(svprogfuncs, file, spawnflagmask); pr_edict_size = PR_LoadEnts(svprogfuncs, file, spawnflagmask);
break; break;
#ifdef Q2SERVER
case GT_QUAKE2: case GT_QUAKE2:
#ifdef Q2SERVER
ge->SpawnEntities(sv.name, file, startspot?startspot:""); ge->SpawnEntities(sv.name, file, startspot?startspot:"");
break;
#endif #endif
break;
case GT_QUAKE3:
break;
} }
BZ_Free(file); BZ_Free(file);
} }
@ -1151,14 +1157,18 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
Info_SetValueForStarKey(svs.info, "*entfile", "", MAX_SERVERINFO_STRING); Info_SetValueForStarKey(svs.info, "*entfile", "", MAX_SERVERINFO_STRING);
switch(svs.gametype) switch(svs.gametype)
{ {
case GT_MAX:
break;
case GT_PROGS: case GT_PROGS:
pr_edict_size = PR_LoadEnts(svprogfuncs, sv.worldmodel->entities, spawnflagmask); pr_edict_size = PR_LoadEnts(svprogfuncs, sv.worldmodel->entities, spawnflagmask);
break; break;
#ifdef Q2SERVER
case GT_QUAKE2: case GT_QUAKE2:
#ifdef Q2SERVER
ge->SpawnEntities(sv.name, sv.worldmodel->entities, startspot?startspot:""); ge->SpawnEntities(sv.name, sv.worldmodel->entities, startspot?startspot:"");
break;
#endif #endif
break;
case GT_QUAKE3:
break;
} }
} }

View file

@ -367,6 +367,10 @@ void SV_DropClient (client_t *drop)
case SCP_DARKPLACES7: case SCP_DARKPLACES7:
MSG_WriteByte (&drop->netchan.message, svc_disconnect); MSG_WriteByte (&drop->netchan.message, svc_disconnect);
break; break;
case SCP_BAD:
break;
case SCP_QUAKE3:
break;
} }
} }
@ -409,19 +413,8 @@ void SV_DropClient (client_t *drop)
#endif #endif
switch(svs.gametype) switch(svs.gametype)
{ {
#ifdef Q3SERVER case GT_MAX:
case GT_QUAKE3:
SVQ3_DropClient(drop);
break; break;
#endif
#ifdef Q2SERVER
case GT_QUAKE2:
if (ge)
ge->ClientDisconnect(drop->q2edict);
break;
#endif
case GT_PROGS: case GT_PROGS:
if (svprogfuncs) if (svprogfuncs)
{ {
@ -448,6 +441,17 @@ void SV_DropClient (client_t *drop)
drop->spawninfo = NULL; drop->spawninfo = NULL;
} }
break; break;
case GT_QUAKE2:
#ifdef Q2SERVER
if (ge)
ge->ClientDisconnect(drop->q2edict);
#endif
break;
case GT_QUAKE3:
#ifdef Q3SERVER
SVQ3_DropClient(drop);
#endif
break;
} }
if (drop->spectator) if (drop->spectator)
@ -668,9 +672,15 @@ int SV_CalcPing (client_t *cl)
switch (cl->protocol) switch (cl->protocol)
{ {
case SCP_NETQUAKE: case SCP_BAD:
break;
case SCP_QUAKE2:
break;
case SCP_QUAKE3:
break;
case SCP_DARKPLACES6: case SCP_DARKPLACES6:
case SCP_DARKPLACES7: case SCP_DARKPLACES7:
case SCP_NETQUAKE:
case SCP_QUAKEWORLD: case SCP_QUAKEWORLD:
ping = 0; ping = 0;
count = 0; count = 0;
@ -3467,6 +3477,8 @@ void Master_Shutdown (void)
NET_SendPacket (NS_SERVER, strlen(string), string, sv_masterlist[i].adr); NET_SendPacket (NS_SERVER, strlen(string), string, sv_masterlist[i].adr);
break; break;
case true:
break;
} }
} }
} }

View file

@ -239,28 +239,30 @@ void SV_PrintToClient(client_t *cl, int level, char *string)
{ {
case SCP_BAD: //bot case SCP_BAD: //bot
break; break;
#ifdef Q2SERVER
case SCP_QUAKE2: case SCP_QUAKE2:
#ifdef Q2SERVER
ClientReliableWrite_Begin (cl, svcq2_print, strlen(string)+3); ClientReliableWrite_Begin (cl, svcq2_print, strlen(string)+3);
ClientReliableWrite_Byte (cl, level); ClientReliableWrite_Byte (cl, level);
ClientReliableWrite_String (cl, string); ClientReliableWrite_String (cl, string);
break;
#endif #endif
#ifdef NQPROT
case SCP_NETQUAKE:
case SCP_DARKPLACES6:
case SCP_DARKPLACES7:
ClientReliableWrite_Begin (cl, svc_print, strlen(string)+3);
if (level == PRINT_CHAT)
ClientReliableWrite_Byte (cl, 1);
ClientReliableWrite_String (cl, string);
break; break;
#endif case SCP_QUAKE3:
break;
case SCP_QUAKEWORLD: case SCP_QUAKEWORLD:
ClientReliableWrite_Begin (cl, svc_print, strlen(string)+3); ClientReliableWrite_Begin (cl, svc_print, strlen(string)+3);
ClientReliableWrite_Byte (cl, level); ClientReliableWrite_Byte (cl, level);
ClientReliableWrite_String (cl, string); ClientReliableWrite_String (cl, string);
break; break;
case SCP_DARKPLACES6:
case SCP_DARKPLACES7:
case SCP_NETQUAKE:
#ifdef NQPROT
ClientReliableWrite_Begin (cl, svc_print, strlen(string)+3);
if (level == PRINT_CHAT)
ClientReliableWrite_Byte (cl, 1);
ClientReliableWrite_String (cl, string);
#endif
break;
} }
} }