Vanilla Development Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS update: Vanilla/ntserv
Date: Sunday March 19, 2000 @ 3:20
Author: xyzzy
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv19142/ntserv
Modified Files:
data.c data.h feature.c genspkt.c
Log Message:
Added support for SHOW_ALL_TRACTORS. This will let players see the t/p beams
for all ships. It is controlled by the SHOW_ALL_TRACTORS feature, the default
of which is off. For observers, SHOW_ALL_TRACTORS will be turned on, which
will enable them to see the t/p of the person they are observing.
****************************************
Index: Vanilla/ntserv/data.c
diff -u Vanilla/ntserv/data.c:1.12 Vanilla/ntserv/data.c:1.13
--- Vanilla/ntserv/data.c:1.12 Fri Feb 25 01:43:21 2000
+++ Vanilla/ntserv/data.c Sun Mar 19 03:20:02 2000
@@ -1,4 +1,4 @@
-/* $Id: data.c,v 1.12 2000/02/25 07:43:21 xyzzy Exp $
+/* $Id: data.c,v 1.13 2000/03/19 09:20:02 xyzzy Exp $
*/
#include "../ntserv/copyright.h"
@@ -390,4 +390,5 @@
#endif
int F_self_8flags = 0;
int F_19flags = 0; /* pack 19 flags into spare bytes */
+int F_show_all_tractors = 0;
int sent_ship[NUM_TYPES];
Index: Vanilla/ntserv/data.h
diff -u Vanilla/ntserv/data.h:1.9 Vanilla/ntserv/data.h:1.10
--- Vanilla/ntserv/data.h:1.9 Thu Dec 30 09:04:39 1999
+++ Vanilla/ntserv/data.h Sun Mar 19 03:20:02 2000
@@ -1,4 +1,4 @@
-/* $Id: data.h,v 1.9 1999/12/30 15:04:39 xyzzy Exp $
+/* $Id: data.h,v 1.10 2000/03/19 09:20:02 xyzzy Exp $
*/
#ifndef _h_data
@@ -319,6 +319,7 @@
extern int F_rc_distress;
extern int F_self_8flags;
extern int F_19flags;
+extern int F_show_all_tractors;
extern int sent_ship[];
extern char Cambot[FNAMESIZE];
Index: Vanilla/ntserv/feature.c
diff -u Vanilla/ntserv/feature.c:1.7 Vanilla/ntserv/feature.c:1.8
--- Vanilla/ntserv/feature.c:1.7 Fri Feb 25 01:43:21 2000
+++ Vanilla/ntserv/feature.c Sun Mar 19 03:20:02 2000
@@ -52,6 +52,7 @@
{ "CLOAK_MAXWARP", &F_cloak_maxwarp},
{ "SHIP_CAP", &F_ship_cap},
{ "DEAD_WARP", &dead_warp },
+ { "SHOW_ALL_TRACTORS", &F_show_all_tractors},
{ NULL, NULL },
};
@@ -168,17 +169,18 @@
spack->arg1 = 0;
spack->arg2 = 0;
- /* find the server's record of the feature */
- for(i=0,f=features; i< num_features; i++,f++){
-
- if(feature_cmp(cpack->name, f->name)){
- spack->feature_type = f->feature_type;
- spack->value = f->value;
- spack->arg1 = f->arg1;
- spack->arg2 = f->arg2;
- break;
- }
- }
+ /* find the server's record of the feature */
+ for(i=0,f=features; i<num_features; i++,f++) {
+ if(feature_cmp(cpack->name, f->name)) {
+ /* This is an evil hack, turn SAT on in obs mode */
+ if(Observer && !strcmp(f->name,"SHOW_ALL_TRACTORS")) f->value = 1;
+ spack->feature_type = f->feature_type;
+ spack->value = f->value;
+ spack->arg1 = f->arg1;
+ spack->arg2 = f->arg2;
+ break;
+ }
+ }
/* unknown feature name, return */
if(spack->value < 0) return;
Index: Vanilla/ntserv/genspkt.c
diff -u Vanilla/ntserv/genspkt.c:1.13 Vanilla/ntserv/genspkt.c:1.14
--- Vanilla/ntserv/genspkt.c:1.13 Fri Feb 25 21:44:00 2000
+++ Vanilla/ntserv/genspkt.c Sun Mar 19 03:20:02 2000
@@ -315,27 +315,33 @@
#define INVISOMASK (PFCLOAK|PFROBOT|PFPRACTR|PFDOCKOK)
int mask;
+ int tractor = (F_show_all_tractors && pl->p_flags&PFTRACT)?
+ (pl->p_tractor|0x40):0;
if (howmuch == UPDT_ALL)
mask = FLAGMASK;
else
- mask = INVISOMASK;
+ mask = INVISOMASK | (F_show_all_tractors?PFTRACT|PFPRESS:0);
- if (flags->flags != htonl(mask & pl->p_flags)) {
- flags->type=SP_FLAGS;
- flags->pnum=pl->p_no;
- flags->flags=htonl(mask & pl->p_flags);
-
- /* ATM - visible tractor */
- /* flags->tractor = (char) pl->p_tractor |0x40; */
-
- /* S_P2 */
- if(send_short < 2 || pl->p_ship.s_type == STARBASE
- || pl->p_no > 31 || (pl->p_flags & PFROBOT))
- sendClientPacket(flags);
- return (TRUE);
- }
- return (FALSE);
+ if (flags->flags==htonl(mask&pl->p_flags) &&
+ flags->tractor==tractor )
+ /* Nothing has changed, don't send a packet */
+ return FALSE;
+
+ flags->type=SP_FLAGS;
+ flags->pnum=pl->p_no;
+ flags->flags=htonl(mask & pl->p_flags);
+
+ if (send_short>1 && pl->p_ship.s_type!=STARBASE &&
+ flags->tractor==tractor &&
+ !(pl->p_flags&PFROBOT) && pl->p_no<32)
+ /* S_P2 flags already sent, so don't send anything */
+ return FALSE;
+
+ flags->tractor = tractor;
+
+ sendClientPacket(flags);
+ return (TRUE);
}
int sndPStatus( struct pstatus_spacket *pstatus, struct player *pl)