Date: Tuesday November 7, 2000 @ 9:22
Author: xyzzy
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv7209
Modified Files:
genspkt.c
Log Message:
Fix updateStatus() so that it has the intended behavior. This should result
in T-mode changes being sent when they happen, instead of some later time.
****************************************
Index: Vanilla/ntserv/genspkt.c
diff -u Vanilla/ntserv/genspkt.c:1.18 Vanilla/ntserv/genspkt.c:1.19
--- Vanilla/ntserv/genspkt.c:1.18 Thu Jul 20 20:08:27 2000
+++ Vanilla/ntserv/genspkt.c Tue Nov 7 09:22:49 2000
@@ -983,27 +983,25 @@
void
updateStatus(int force)
/* if force is false, packet only sent when status->tourn changes */
+/* if force is true, send every 10 seconds as long as timeprod has changed */
{
-/* Update status every 10 seconds? */
- if (repCount % efticks(50) == 0)
- if ( clientStatus.tourn != status->tourn
- || (force && (ntohl(clientStatus.timeprod) != timeprod_int()))) {
-
+ if ((clientStatus.tourn != status->tourn) ||
+ (force && !(repCount%efticks(50)) &&
+ ntohl(clientStatus.timeprod) != timeprod_int())) {
#ifdef LTD_STATS
- /* Hey, Tmode changed. Do I have an enemy? */
- setEnemy(me->p_team, me);
+ /* 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);
- clientStatus.planets=htonl(status->planets/10);
- clientStatus.kills=htonl(status->kills/10);
- clientStatus.losses=htonl(status->losses/10);
- clientStatus.time=htonl(status->time/10);
- clientStatus.timeprod=htonl(timeprod_int());
- sendClientPacket((CVOID) &clientStatus);
- }
+ clientStatus.type=SP_STATUS;
+ clientStatus.tourn=status->tourn;
+ clientStatus.armsbomb=htonl(status->armsbomb/10);
+ clientStatus.planets=htonl(status->planets/10);
+ clientStatus.kills=htonl(status->kills/10);
+ clientStatus.losses=htonl(status->losses/10);
+ clientStatus.time=htonl(status->time/10);
+ clientStatus.timeprod=htonl(timeprod_int());
+ sendClientPacket((CVOID) &clientStatus);
+ }
}
int sndSSelf(struct you_short_spacket *youp, struct player* pl, int howmuch)