Vanilla Development Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS update: Vanilla/ntserv
Date: Friday February 25, 19100 @ 21:44
Author: unbelver
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv1521/ntserv
Modified Files:
util.c proto.h genspkt.c enter.c
Log Message:
LTD_STATS keeps track of how much time is spent in "zones", or regions
of space that are close or far from homeworld during T-mode. It
figures out who the T-mode enemy is via the variable me->p_hist.enemy_team.
Unfortunately, the variable was never set. This commit is to add
calls to set who the enemy is whenever T mode changes or player
switches teams.
--Carlos V.
****************************************
Index: Vanilla/ntserv/util.c
diff -u Vanilla/ntserv/util.c:1.2 Vanilla/ntserv/util.c:1.3
--- Vanilla/ntserv/util.c:1.2 Fri Apr 30 15:18:47 1999
+++ Vanilla/ntserv/util.c Fri Feb 25 21:44:00 2000
@@ -91,3 +91,31 @@
num++;
return (num);
}
+
+#ifdef LTD_STATS
+
+/* find out who the other T mode team is. Its not the team I'm on */
+/* LTD stats needs to know who the enemy is to determine what zone */
+/* a player is in. Time in each zone is kept track of in LTD */
+/* tno == my current team */
+
+void setEnemy(int myteam, struct player *me)
+{
+ int i, other_team;
+
+ other_team = 0;
+
+ for(i = 0; i < MAXTEAM; i++) {
+ if(i == myteam)
+ continue;
+ else {
+ if (realNumShips(i) >= tournplayers)
+ other_team = i;
+ }
+ }
+
+ me->p_hist.enemy_team = other_team;
+
+}
+
+#endif /* LTD_STATS */
Index: Vanilla/ntserv/proto.h
diff -u Vanilla/ntserv/proto.h:1.2 Vanilla/ntserv/proto.h:1.3
--- Vanilla/ntserv/proto.h:1.2 Mon May 31 20:53:22 1999
+++ Vanilla/ntserv/proto.h Fri Feb 25 21:44:00 2000
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.2 1999/06/01 01:53:22 cameron Exp $
+/* $Id: proto.h,v 1.3 2000/02/26 03:44:00 unbelver Exp $
*
* Function prototypes for externally accessed functions.
*/
@@ -213,6 +213,9 @@
int nint(double x);
#endif
int realNumShips(int owner);
+#ifdef LTD_STATS
+void setEnemy(int myteam, struct player *me);
+#endif /* LTD_STATS */
/* warning.c */
void new_warning(int index, const char *fmt, ...);
Index: Vanilla/ntserv/genspkt.c
diff -u Vanilla/ntserv/genspkt.c:1.12 Vanilla/ntserv/genspkt.c:1.13
--- Vanilla/ntserv/genspkt.c:1.12 Fri Feb 25 01:43:21 2000
+++ Vanilla/ntserv/genspkt.c Fri Feb 25 21:44:00 2000
@@ -981,6 +981,11 @@
if ( clientStatus.tourn != status->tourn
|| (force && (ntohl(clientStatus.timeprod) != timeprod_int()))) {
+#ifdef LTD_STATS
+ /* Hey, Tmode changed. Do I have an enemy? */
+ setEnemy(me->p_team, me);
+#endif /* LTD_STATS */
+
clientStatus.type=SP_STATUS;
clientStatus.tourn=status->tourn;
clientStatus.armsbomb=htonl(status->armsbomb/10);
Index: Vanilla/ntserv/enter.c
diff -u Vanilla/ntserv/enter.c:1.6 Vanilla/ntserv/enter.c:1.7
--- Vanilla/ntserv/enter.c:1.6 Thu Jan 6 14:45:25 2000
+++ Vanilla/ntserv/enter.c Fri Feb 25 21:44:00 2000
@@ -192,9 +192,14 @@
if (lastteam != tno || lastrank != mystats->st_rank) {
- /* If switching, become hostile to former team 6/29/92 TC */
+ /* Are joining a new team? take care of a few things if so */
- if ((lastteam >= 0) && (lastteam < NUMTEAM) && (lastteam != tno)) {
+ if ((lastteam < NUMTEAM) && (lastteam != tno)) {
+#ifdef LTD_STATS
+ setEnemy(tno, me);
+#endif /*LTD_STATS*/
+ /* If switching, become hostile to former team 6/29/92 TC */
+ if (lastteam >= 0)
declare_war(1<<lastteam);
}
if (lastrank==-1) lastrank=mystats->st_rank; /* NBT patch */