1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include "swserv.h"
int NetHandleSetIntercept(int condescriptor, char *arg)
{
char *strptr;
long object_num, con_object_num;
char sndbuf[CS_DATA_MAX_LEN];
char intercept_arg[CS_DATA_MAX_LEN];
xsw_object_struct *obj_ptr;
con_object_num = connection[condescriptor]->object_num;
if(DBIsObjectGarbage(con_object_num))
return(-1);
else
obj_ptr = xsw_object[con_object_num];
/*
* NET_CMD_INTERCEPT format:
*
* object_num, argument
*/
StringStripSpaces(arg);
strptr = strchr(arg, ' ');
if(strptr == NULL) return(-1);
strncpy(intercept_arg, strptr + 1, CS_DATA_MAX_LEN);
intercept_arg[CS_DATA_MAX_LEN - 1] = '\0';
StringStripSpaces(intercept_arg);
*strptr = '\0';
object_num = atol(arg);
/* Connection must own object. */
if(object_num != con_object_num)
return(-3);
/* Match intercepting object. */
obj_ptr->intercepting_object =
MatchIntercept(object_num, intercept_arg);
if(strcmp(intercept_arg, "#off"))
{
if((strlen(intercept_arg) > 0) &&
(obj_ptr->intercepting_object < 0)
)
{
sprintf(sndbuf,
"Intercept: %s: Cannot find object.",
intercept_arg
);
NetSendLiveMessage(condescriptor, sndbuf);
}
}
/* Set next object values update to now so it gets updated now. */
next.object_values = cur_millitime;
return(0);
}
int NetSendSetIntercept(int condescriptor)
{
return(0);
}
|