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)
{
#ifdef NQPROT
case CP_NETQUAKE:
#ifdef NQPROT
final[0] = clc_disconnect;
final[1] = clc_stringcmd;
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);
break;
#endif
#ifdef Q2CLIENT
break;
case CP_PLUGIN:
break;
case CP_QUAKE2:
#ifdef Q2CLIENT
final[0] = clcq2_stringcmd;
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);
break;
#endif
break;
case CP_QUAKE3:
break;
case CP_QUAKEWORLD:
final[0] = clc_stringcmd;
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);
break;
case CP_UNKNOWN:
break;
}
cls.state = ca_disconnected;
@ -2436,13 +2441,8 @@ void CL_ReadPackets (void)
switch(cls.protocol)
{
#ifdef Q3CLIENT
case CP_QUAKE3:
CLQ3_ParseServerMessage();
break;
#endif
#ifdef NQPROT
case CP_NETQUAKE:
#ifdef NQPROT
switch(NQNetChan_Process(&cls.netchan))
{
case 0:
@ -2454,15 +2454,22 @@ void CL_ReadPackets (void)
CLNQ_ParseServerMessage ();
break;
}
break;
#endif
#ifdef Q2CLIENT
break;
case CP_PLUGIN:
break;
case CP_QUAKE2:
#ifdef Q2CLIENT
if (!Netchan_Process(&cls.netchan))
continue; // wasn't accepted for some reason
CLQ2_ParseServerMessage ();
break;
#endif
case CP_QUAKE3:
#ifdef Q3CLIENT
CLQ3_ParseServerMessage();
#endif
break;
break;
case CP_QUAKEWORLD:
if (cls.demoplayback == DPB_MVD)
{
@ -2479,6 +2486,8 @@ void CL_ReadPackets (void)
}
CL_ParseServerMessage ();
break;
case CP_UNKNOWN:
break;
}
// 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)
{
case SLKEY_PING:
return Master_CompareInteger(a->ping, b->ping, SLIST_TEST_LESS);
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_ADDRESS:
break;
case SLKEY_BASEGAME:
return Master_CompareInteger(a->special, b->special, SLIST_TEST_LESS);
case SLKEY_TIMELIMIT:
return Master_CompareInteger(a->tl, b->tl, SLIST_TEST_LESS);
case SLKEY_CUSTOM:
break;
case SLKEY_FRAGLIMIT:
return Master_CompareInteger(a->fl, b->fl, SLIST_TEST_LESS);
case SLKEY_MAP:
return Master_CompareString(a->map, b->map, SLIST_TEST_LESS);
case SLKEY_FREEPLAYERS:
return Master_CompareInteger(a->maxplayers - a->players, b->maxplayers - b->players, SLIST_TEST_LESS);
case SLKEY_GAMEDIR:
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:
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;
}

View file

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

View file

@ -599,48 +599,8 @@ void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits)
switch (amask->type)
{
#ifdef USEIPX
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;
}
case NA_INVALID:
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_BROADCAST_IP:
n = amask->address.ip;
@ -660,6 +620,50 @@ void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits)
*n = i;
}
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)
{
#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:
#ifdef GNUTLS
gnutls_bye (pluginstreamarray[handle].session, GNUTLS_SHUT_RDWR);
pluginstreamarray[handle].type = STREAM_SOCKET;
Plug_Net_Close_Internal(handle);
return;
#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;
}

View file

@ -943,6 +943,8 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
switch (svs.gametype)
{
case GT_MAX:
break;
case GT_PROGS:
ent = EDICT_NUM(svprogfuncs, 0);
ent->isfree = false;
@ -978,8 +980,8 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
#endif
break;
#ifdef Q2SERVER
case GT_QUAKE2:
#ifdef Q2SERVER
for (i=0 ; i<MAX_CLIENTS ; i++)
{
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;
}
sv.allocated_client_slots = i;
break;
#endif
#ifdef Q3SERVER
break;
case GT_QUAKE3:
#ifdef Q3SERVER
sv.allocated_client_slots = 32;
break;
#endif
break;
}
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);
switch(svs.gametype)
{
case GT_MAX:
break;
case GT_PROGS:
pr_edict_size = PR_LoadEnts(svprogfuncs, file, spawnflagmask);
break;
#ifdef Q2SERVER
case GT_QUAKE2:
#ifdef Q2SERVER
ge->SpawnEntities(sv.name, file, startspot?startspot:"");
break;
#endif
break;
case GT_QUAKE3:
break;
}
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);
switch(svs.gametype)
{
case GT_MAX:
break;
case GT_PROGS:
pr_edict_size = PR_LoadEnts(svprogfuncs, sv.worldmodel->entities, spawnflagmask);
break;
#ifdef Q2SERVER
case GT_QUAKE2:
#ifdef Q2SERVER
ge->SpawnEntities(sv.name, sv.worldmodel->entities, startspot?startspot:"");
break;
#endif
break;
case GT_QUAKE3:
break;
}
}

View file

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

View file

@ -239,28 +239,30 @@ void SV_PrintToClient(client_t *cl, int level, char *string)
{
case SCP_BAD: //bot
break;
#ifdef Q2SERVER
case SCP_QUAKE2:
#ifdef Q2SERVER
ClientReliableWrite_Begin (cl, svcq2_print, strlen(string)+3);
ClientReliableWrite_Byte (cl, level);
ClientReliableWrite_String (cl, string);
break;
#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;
#endif
case SCP_QUAKE3:
break;
case SCP_QUAKEWORLD:
ClientReliableWrite_Begin (cl, svc_print, strlen(string)+3);
ClientReliableWrite_Byte (cl, level);
ClientReliableWrite_String (cl, string);
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;
}
}