Fixed the say command when not connected to a source, fixed so it compiles with gcc

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1456 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-10-09 09:40:26 +00:00
parent ff9003eeb0
commit fc770f310d
4 changed files with 23 additions and 23 deletions

View file

@ -168,17 +168,6 @@ void SendBufferToViewer(viewer_t *v, const char *buffer, int length, qboolean re
void Multicast(sv_t *tv, char *buffer, int length, int to, unsigned int playermask)
{
/*
#define dem_cmd 0 //shouldn't be present
#define dem_read 1 //intended for the proxy, equivelent to dem_all :\
#define dem_set 2 //keeps the playerinfo packets in sync, present once, at start, with specific parameters. Ignored.
#define dem_multiple 3 //send to multiple specific players if tracking - basically team_prints.
#define dem_single 4 //send to a single player, sprint, centerprint, etc
#define dem_stats 5 //overkill... same as single
#define dem_all 6 //broadcast to all
*/
viewer_t *v;
switch(to)
{
@ -204,6 +193,14 @@ void Multicast(sv_t *tv, char *buffer, int length, int to, unsigned int playerma
break;
}
}
void Broadcast(cluster_t *cluster, char *buffer, int length)
{
viewer_t *v;
for (v = cluster->viewers; v; v = v->next)
{
SendBufferToViewer(v, buffer, length, true);
}
}
static void ParseServerData(sv_t *tv, netmsg_t *m, int to, unsigned int playermask)
{

View file

@ -71,6 +71,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdarg.h>
#include <stdlib.h>
@ -297,7 +298,7 @@ typedef struct {
unsigned short leafs[MAX_ENTITY_LEAFS];
} entity_t;
typedef struct sv_s {
struct sv_s {
netadr_t serveraddress;
unsigned char buffer[MAX_PROXY_BUFFER]; //this doesn't cycle.
@ -364,9 +365,9 @@ typedef struct sv_s {
//options:
char server[MAX_QPATH];
} sv_t;
};
typedef struct cluster_s {
struct cluster_s {
SOCKET qwdsocket; //udp + quakeworld protocols
char commandinput[512];
@ -393,9 +394,9 @@ typedef struct cluster_s {
int maxviewers;
int maxproxies;
boolean wanttoexit;
qboolean wanttoexit;
} cluster_t;
};
@ -578,6 +579,7 @@ void WriteString(netmsg_t *b, const char *str);
void WriteData(netmsg_t *b, const char *data, int length);
void Multicast(sv_t *tv, char *buffer, int length, int to, unsigned int playermask);
void Broadcast(cluster_t *cluster, char *buffer, int length);
void ParseMessage(sv_t *tv, char *buffer, int length, int to, int mask);
void BuildServerData(sv_t *tv, netmsg_t *msg, qboolean mvd, int servercount);
SOCKET QW_InitUDPSocket(int port);

View file

@ -1037,7 +1037,7 @@ void PMove(viewer_t *v, usercmd_t *cmd)
v->origin[i] += (cmd->forwardmove*fwd[i] + cmd->sidemove*rgt[i] + cmd->upmove*up[i])*(cmd->msec/1000.0f);
}
void QTV_Say(sv_t *qtv, viewer_t *v, char *message)
void QTV_Say(cluster_t *cluster, viewer_t *v, char *message)
{
char buf[1024];
netmsg_t msg;
@ -1054,7 +1054,7 @@ void QTV_Say(sv_t *qtv, viewer_t *v, char *message)
WriteString2(&msg, message);
WriteString(&msg, "\n");
Multicast(qtv, msg.data, msg.cursize, dem_all, (unsigned int)-1);
Broadcast(cluster, msg.data, msg.cursize);
}
viewer_t *QW_IsOn(cluster_t *cluster, char *name)
@ -1089,8 +1089,8 @@ void QW_PrintfToViewer(viewer_t *v, char *format, ...)
SendBufferToViewer(v, buf, strlen(buf)+1, true);
}
static const filename_t ConnectionlessModelList[] = {"", "maps/start.bsp", "progs/player.mdl", ""};
static const filename_t ConnectionlessSoundList[] = {"", ""};
static const filename_t ConnectionlessModelList[] = {{""}, {"maps/start.bsp"}, {"progs/player.mdl"}, {""}};
static const filename_t ConnectionlessSoundList[] = {{""}, {""}};
void Menu_Enter(cluster_t *cluster, viewer_t *viewer, int buttonnum);
@ -1245,9 +1245,9 @@ void ParseQWC(cluster_t *cluster, sv_t *qtv, viewer_t *v, netmsg_t *m)
{
}
else if (!strncmp(buf, "say \"", 5) && !cluster->notalking)
QTV_Say(qtv, v, buf+5);
QTV_Say(cluster, v, buf+5);
else if (!strncmp(buf, "say ", 4) && !cluster->notalking)
QTV_Say(qtv, v, buf+4);
QTV_Say(cluster, v, buf+4);
else if (!strncmp(buf, "servers", 7))
{

View file

@ -1550,4 +1550,5 @@ void Sys_Printf(cluster_t *cluster, char *fmt, ...)
va_end (argptr);
printf("%s", string);
}
}