Vanilla Development Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS update: Vanilla/robots
Date: Thursday April 20, 2000 @ 18:41
Author: ahn
Update of /home/netrek/cvsroot/Vanilla/robots
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv8208
Modified Files:
inl.c inlcomm.c
Log Message:
When a captain frees an SB slot, SB's armies get moved to homeworld. If
twink captains abuse this feature, it should probably be #ifdef'ed out.
But for now, trust the captains to use this only when SB busts and must
free the slot.
At endgame, reset the player offset position to -1 so that stats do not
carry over to the next game. Back-to-back games are OK, but players must
relogin to get a new player offset position. Players with invalid
offset positions will get kicked out at game start.
****************************************
Index: Vanilla/robots/inl.c
diff -u Vanilla/robots/inl.c:1.27 Vanilla/robots/inl.c:1.28
--- Vanilla/robots/inl.c:1.27 Wed Mar 22 15:59:43 2000
+++ Vanilla/robots/inl.c Thu Apr 20 18:41:19 2000
@@ -1,7 +1,7 @@
-/* $Id: inl.c,v 1.27 2000/03/22 21:59:43 karthik Exp $ */
+/* $Id: inl.c,v 1.28 2000/04/20 23:41:19 ahn Exp $ */
#ifndef lint
-static char vcid[] = "$Id: inl.c,v 1.27 2000/03/22 21:59:43 karthik Exp $";
+static char vcid[] = "$Id: inl.c,v 1.28 2000/04/20 23:41:19 ahn Exp $";
#endif /* lint */
/*
@@ -827,6 +827,15 @@
queues[QU_AWAY].tournmask = ROM;
queues[QU_HOME_OBS].tournmask = FED;
queues[QU_AWAY_OBS].tournmask = ROM;
+
+ /* change all player offset position in playerfile to -1 so that
+ stats don't get saved to next game's playerfile.
+ CAVEAT: player must logout and login to play a new game. -da */
+
+ for (c=0; c<MAXPLAYER; c++)
+ players[c].p_pos = -1;
+
+
}
if (!is_end_tourney) {
@@ -1006,7 +1015,6 @@
start_countdown()
{
int c;
- struct player *j;
inl_stat.change = 0;
@@ -1149,6 +1157,31 @@
j->p_whydead = kreason;
continue;
}
+
+ /* sanity checking. eject players with negative player offset
+ positions. this can happen if there are back-to-back games
+ without a server reset. -da */
+
+ if (!(me->p_flags & PFROBOT) && (j->p_pos < 0)) {
+
+ pmessage(0, MALL, inl_from,
+ "** Player %d ejected, must re-login to play.", j->p_no);
+ pmessage(j->p_no, MINDIV | MCONQ, addr_mess(j->p_no, MINDIV),
+ "You have been ejected due to player DB inconsistency.");
+ pmessage(j->p_no, MINDIV | MCONQ, addr_mess(j->p_no, MINDIV),
+ "This probably happened because of back-to-back games.");
+ pmessage(j->p_no, MINDIV | MCONQ, addr_mess(j->p_no, MINDIV),
+ "You must re-login to play.");
+
+ j->p_status = PEXPLODE;
+ j->p_whydead = KQUIT;
+ j->p_explode = 10;
+ j->p_whodead = 0;
+
+ continue;
+
+ }
+
j->p_status = PEXPLODE;
j->p_whydead = kreason;
if (j->p_ship.s_type == STARBASE)
Index: Vanilla/robots/inlcomm.c
diff -u Vanilla/robots/inlcomm.c:1.12 Vanilla/robots/inlcomm.c:1.13
--- Vanilla/robots/inlcomm.c:1.12 Thu Jul 8 13:28:29 1999
+++ Vanilla/robots/inlcomm.c Thu Apr 20 18:41:19 2000
@@ -995,7 +995,28 @@
/* convert slot # to slot character */
slot = (victim < 10) ? '0' + victim : 'a' + (victim - 10);
-
+
+ /* save some SB armies, but don't save normal ship armies so that
+ captains can't free-scum. -da */
+
+ if ((j->p_ship.s_type == STARBASE) && (j->p_armies > 0)) {
+ int i, k;
+
+ k=10*(remap[j->p_team]-1);
+
+ if (k>=0 && k<=30) {
+ for (i=0; i<10; i++) {
+ if (planets[i+k].pl_owner == j->p_team) {
+ planets[i+k].pl_armies += j->p_armies;
+ pmessage(0, MALL | MGHOST, "GOD->ALL",
+ "%s's %d armies placed on %s",
+ j->p_name, j->p_armies, planets[k+i].pl_name);
+ break;
+ }
+ }
+ }
+ }
+
if (j->p_process)
{
kill(j->p_process, SIGTERM);