Vanilla Development Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS update: Vanilla/ntserv
Date: Friday June 23, 2000 @ 4:12
Author: cameron
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv1956/ntserv
Modified Files:
Makefile daemonII.c gencmds.c getname.c ntscmds.c salt.h
struct.h sysdefaults.c sysdefaults.h
Log Message:
- Prevent beaming down out of T-mode,
- Add change password function,
- Prevent eject without queue (#ifdef'd),
- Alpha compilation fixes,
- Minor message changes.
****************************************
Index: Vanilla/ntserv/Makefile
diff -u Vanilla/ntserv/Makefile:1.19 Vanilla/ntserv/Makefile:1.20
--- Vanilla/ntserv/Makefile:1.19 Thu Dec 30 01:12:24 1999
+++ Vanilla/ntserv/Makefile Fri Jun 23 04:12:58 2000
@@ -37,7 +37,7 @@
SRC = $(R_FILES) data.h defs.h planets.h struct.h \
- packets.h copyright.h
+ packets.h copyright.h
LIBS = $(RSA_LIB) $(EXTRALIBS) -lm
@@ -111,5 +111,8 @@
tags::
@etags $(SRC)
+# Note: on systems that are not using GNU make, the following line
+# will likely trigger an error. Work around this by using GNU make
+# from the command line.
sinclude .depend
# DO NOT DELETE THIS LINE -- make depend depends on it.
Index: Vanilla/ntserv/daemonII.c
diff -u Vanilla/ntserv/daemonII.c:1.32 Vanilla/ntserv/daemonII.c:1.33
--- Vanilla/ntserv/daemonII.c:1.32 Tue May 23 20:16:31 2000
+++ Vanilla/ntserv/daemonII.c Fri Jun 23 04:12:58 2000
@@ -2866,6 +2866,9 @@
army_track(AMT_BEAMDOWN, j, l, 1);
if (j->p_team != l->pl_owner) {
+ /* prevent beaming down to non-team planet out of t */
+ if (!status->tourn) continue;
+
j->p_armies--;
if (l->pl_armies) {
@@ -3346,7 +3349,9 @@
case SIGBUS:
case SIGILL:
case SIGFPE:
+#ifdef SIGSYS
case SIGSYS:
+#endif
(void) SIGNAL(SIGABRT, SIG_DFL);
abort(); /* get the coredump */
default:
Index: Vanilla/ntserv/gencmds.c
diff -u Vanilla/ntserv/gencmds.c:1.6 Vanilla/ntserv/gencmds.c:1.7
--- Vanilla/ntserv/gencmds.c:1.6 Sun Jul 11 22:25:31 1999
+++ Vanilla/ntserv/gencmds.c Fri Jun 23 04:12:58 2000
@@ -98,8 +98,8 @@
struct tm *tmv = localtime(&t);
#ifdef STRFTIME
- sprintf(tbuf, "%02d/%02d %d/%d", tmv->tm_hour,tmv->tm_min,
- tmv->tm_mday,tmv->tm_mon);
+ sprintf(tbuf, "%02d/%02d %d/%d", tmv->tm_hour, tmv->tm_min,
+ tmv->tm_mday, tmv->tm_mon);
#else
strftime(tbuf, 39, "%R %D", tmv);
#endif
@@ -108,7 +108,7 @@
players[mess->m_from].p_monitor, comm);
fclose(glog);
}
- }
+ } /* !C_GLOG */
#ifdef VOTING
if (cmds[i].tag & (C_VC_ALL | C_VC_TEAM))
@@ -176,13 +176,13 @@
else
{
pmessage(from, MINDIV, addr_mess(from, MINDIV),
- " Invalid player number.");
+ "Invalid player number.");
return -1;
}
if (players[what].p_status == PFREE)
{
pmessage(from, MINDIV, addr_mess(from, MINDIV),
- " Player not in the game.");
+ "Player not in the game.");
return -1;
}
return what;
@@ -208,7 +208,7 @@
#ifdef OBSERVERS
if (players[who].p_status == POBSERV)
{
- bounce(who, "Sorry, Observers can't vote");
+ bounce(who, "Sorry, observers can't vote");
return 0;
}
#endif
Index: Vanilla/ntserv/getname.c
diff -u Vanilla/ntserv/getname.c:1.8 Vanilla/ntserv/getname.c:1.9
--- Vanilla/ntserv/getname.c:1.8 Wed Apr 26 21:38:48 2000
+++ Vanilla/ntserv/getname.c Fri Jun 23 04:12:58 2000
@@ -134,6 +134,7 @@
ERROR(1,("Error number: %d\n", errno));
break;
}
+ /* sequential search of player file */
position=0;
while (read(plfd, (char *) &player, sizeof(struct statentry)) ==
sizeof(struct statentry)) {
@@ -220,6 +221,13 @@
}
flushSockBuf();
return;
+}
+
+void changepassword (struct statentry *player, char *passPick)
+{
+ saltbuf sb;
+ strcpy(player->password, (char *) crypt(passPick, salt(player->name, sb)));
+ savepass(player);
}
static void savepass(const struct statentry* se)
Index: Vanilla/ntserv/ntscmds.c
diff -u Vanilla/ntserv/ntscmds.c:1.9 Vanilla/ntserv/ntscmds.c:1.10
--- Vanilla/ntserv/ntscmds.c:1.9 Fri Mar 24 13:55:15 2000
+++ Vanilla/ntserv/ntscmds.c Fri Jun 23 04:12:58 2000
@@ -1,4 +1,4 @@
-/* $Id: ntscmds.c,v 1.9 2000/03/24 19:55:15 karthik Exp $
+/* $Id: ntscmds.c,v 1.10 2000/06/23 09:12:58 cameron Exp $
*/
/*
@@ -52,6 +52,7 @@
void do_balance(void);
void do_triple_planet_mayhem(void);
#endif
+void do_password(char *comm, struct message *mess);
const char myname[] = {"GOD"};
@@ -89,20 +90,24 @@
(void (*)()) do_help }, /* HELP */
{ "CLIENT",
C_PLAYER,
- "Show a user's client. Ex: 'CLIENT 0'",
+ "Show player's client e.g. 'CLIENT 0'",
do_client_query }, /* CLIENT */
{ "PING",
C_PLAYER,
- "Show client's ping (lag). Ex: 'PING 0'",
+ "Show player's ping (lag) e.g. 'PING 0'",
do_ping_query }, /* PING */
{ "STATS",
C_PLAYER,
- "Show player's stats during t-mode. Ex: 'STATS 0'",
+ "Show player's t-mode stats e.g. 'STATS 0'",
do_stats_query }, /* STATS */
{ "WHOIS",
C_PLAYER,
- "Show a user's player and login info. Ex: 'WHOIS 0'",
+ "Show player's login info e.g. 'WHOIS 0'",
do_whois_query }, /* WHOIS */
+ { "PASSWORD",
+ C_PR_INPICKUP,
+ "Change your password e.g. 'password neato neato'",
+ do_password }, /* PASSWORD */
#ifdef ALLOW_PAUSE
{ "PAUSE",
0,
@@ -115,21 +120,22 @@
#endif
{ "SBSTATS",
C_PLAYER,
- "Show player's starbase stats. Ex: 'SBSTATS 0'",
+ "Show player's base stats e.g. 'SBSTATS 0'",
do_sbstats_query }, /* SBSTATS */
/***** Vanilla commands */
{ "QUEUE",
0,
"Show how many people are on the queue.",
do_queue_msg }, /* QUEUE */
+ { "(type QUEUE HOSTS to see the addresses of those on queue)", C_DESC },
{ "TIME",
C_PR_INPICKUP,
- "Show time left on Genocide timer.",
+ "Show time left on surrender timer.",
do_time_msg }, /* TIME */
#ifdef GENO_COUNT
{ "GENOS",
C_PLAYER | C_PR_INPICKUP,
- "Show player's winning genocides. Ex: 'GENOS 0'",
+ "Show player's genocides e.g. 'GENOS 0'",
do_genos_query }, /* GENOS */
#endif
#ifdef VOTING
@@ -141,7 +147,7 @@
#if defined(ALLOW_EJECT)
{ "EJECT",
C_VC_TEAM | C_GLOG | C_PLAYER | C_PR_INPICKUP,
- "To eject a player. Ex: 'EJECT 0'",
+ "Eject a player e.g. 'EJECT 0 IDLE'",
do_player_eject, /* EJECT */
2, 0, 120, 600},
#endif
@@ -200,23 +206,27 @@
void do_player_eject(int who, int player, int mflags, int sendto)
{
register struct player *j;
+ char *reason = NULL;
j = &players[player];
- if (j->p_status == PFREE){
- pmessage(sendto, mflags, addr_mess(who,MTEAM),
- "You cannot eject a free slot.");
- return;
- }
- if (j->p_flags & PFROBOT) {
- pmessage(sendto, mflags, addr_mess(players[who].p_team,MTEAM),
- "You cannot eject a robot.");
- return;
+ if (j->p_status == PFREE) {
+ reason = "You may not eject a free slot.";
+ } else if (j->p_flags & PFROBOT) {
+ reason = "You may not eject a robot.";
+ } else if (j->p_team != players[who].p_team) {
+ reason = "You may not eject players of the other team.";
+#ifdef EJECT_ONLY_IF_QUEUE
+ } else if ((queues[QU_PICKUP].q_flags & QU_OPEN) &&
+ (queues[QU_PICKUP].count == 0)){
+ reason = "You may not eject if there is no queue.";
+#endif
}
- if (j->p_team != players[who].p_team){
+
+ if (reason != NULL) {
pmessage(players[who].p_team, MTEAM,
- addr_mess(players[who].p_team,MTEAM),
- "You can only eject your own teammates.");
+ addr_mess(players[who].p_team,MTEAM),
+ reason);
return;
}
@@ -1030,3 +1040,39 @@
}
}
#endif /* TRIPLE_PLANET_MAYHEM */
+
+void do_password(char *comm, struct message *mess)
+{
+ int who = mess->m_from;
+ struct player *p = &players[who];
+ char *addr = addr_mess(who,MINDIV);
+ char *one, *two;
+
+ /* need code here? if observer skip command */
+
+ one = strtok(comm, " ");
+ if (one == NULL) return;
+
+ one = strtok(NULL, " ");
+ if (one == NULL) {
+ pmessage(who, MINDIV, addr,
+ "Enter your new password twice after the word PASSWORD");
+ return;
+ }
+
+ two = strtok(NULL, " ");
+ if (two == NULL) {
+ pmessage(who, MINDIV, addr,
+ "Need new password twice, with a space between");
+ return;
+ }
+
+ if (strcmp(one, two)) {
+ pmessage(who, MINDIV, addr,
+ "No way, the two passwords are different!");
+ return;
+ }
+
+ pmessage(who, MINDIV, addr,
+ "You want your password to be %s", one);
+}
Index: Vanilla/ntserv/salt.h
diff -u Vanilla/ntserv/salt.h:1.1 Vanilla/ntserv/salt.h:1.2
--- Vanilla/ntserv/salt.h:1.1 Mon Apr 26 18:47:27 1999
+++ Vanilla/ntserv/salt.h Fri Jun 23 04:12:58 2000
@@ -1,7 +1,7 @@
#ifndef SALT_H
#define SALT_H
-typedef char saltbuf[3]; /* Size of salt string buf for crypt(). */
+typedef char *saltbuf;
char* salt(const char*, saltbuf);
Index: Vanilla/ntserv/struct.h
diff -u Vanilla/ntserv/struct.h:1.10 Vanilla/ntserv/struct.h:1.11
--- Vanilla/ntserv/struct.h:1.10 Tue May 23 20:16:31 2000
+++ Vanilla/ntserv/struct.h Fri Jun 23 04:12:58 2000
@@ -83,7 +83,7 @@
#define chaos ((status->gameup) & GU_CHAOS)
#define GU_PAUSED 8
#define ispaused ((status->gameup) & GU_PAUSED)
-#define GU_INROBOT 16
+#define GU_INROBOT 16 /* INL robot is present */
#ifdef NEWBIESERVER
#define GU_NEWBIE 32
#endif
@@ -128,7 +128,7 @@
#define PFOBSERV 0x8000000 /* for observers */
#ifdef SB_TRANSWARP
-#define PFTWARP 0x40000000 /* isae -- SB transwarp */
+#define PFTWARP 0x40000000 /* isae -- SB transwarp */
#endif
#if defined(BASEPRACTICE) || defined(NEWBIESERVER)
Index: Vanilla/ntserv/sysdefaults.c
diff -u Vanilla/ntserv/sysdefaults.c:1.13 Vanilla/ntserv/sysdefaults.c:1.14
--- Vanilla/ntserv/sysdefaults.c:1.13 Fri May 28 03:40:43 1999
+++ Vanilla/ntserv/sysdefaults.c Fri Jun 23 04:12:58 2000
@@ -1,4 +1,4 @@
-/* $Id: sysdefaults.c,v 1.13 1999/05/28 08:40:43 cameron Exp $
+/* $Id: sysdefaults.c,v 1.14 2000/06/23 09:12:58 cameron Exp $
*/
#include <stdio.h>
@@ -119,6 +119,7 @@
}
break;
case SYSDEF_ROBOT:
+ /* cast from pointer to integer of different size [ok] */
if (atoi(s)) start_robot = (int) sysdef_keywords[j].p;
break;
case SYSDEF_SHIP:
Index: Vanilla/ntserv/sysdefaults.h
diff -u Vanilla/ntserv/sysdefaults.h:1.9 Vanilla/ntserv/sysdefaults.h:1.10
--- Vanilla/ntserv/sysdefaults.h:1.9 Sun May 28 08:31:12 2000
+++ Vanilla/ntserv/sysdefaults.h Fri Jun 23 04:12:58 2000
@@ -1,4 +1,4 @@
-/* $Id: sysdefaults.h,v 1.9 2000/05/28 13:31:12 jeffno Exp $ */
+/* $Id: sysdefaults.h,v 1.10 2000/06/23 09:12:58 cameron Exp $ */
/* structure for default values that are represented as array of flags */
struct sysdef_array {
@@ -192,12 +192,13 @@
/*
Procedure for adding new default value.
-James Cameron, 26th January 1999.
+James Cameron, 28th February 2000.
- add to ntserv/data.c
- add to ntserv/data.h
-- add to sysdef_keywords in ntserv/sysdefaults.h, in any order
+- add to sysdef_keywords in ntserv/sysdefaults.h, in any order, prefer end
- add to docs/sample_sysdef with comment about value meanings
- use glade (http://glade.pn.org/) to add to gum/gum.xml and regenerate code
+- leave a comment here if your defaults have not been added to gum
*/