Date: Friday June 21, 2002 @ 2:41
Author: cameron
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.real-time.com:/var/tmp/cvs-serv28436/ntserv
Modified Files:
main.c ntscmds.c transwarp.c
Log Message:
transwarp permissions
****************************************
Index: Vanilla/ntserv/main.c
diff -u Vanilla/ntserv/main.c:1.23 Vanilla/ntserv/main.c:1.24
--- Vanilla/ntserv/main.c:1.23 Tue May 1 21:00:19 2001
+++ Vanilla/ntserv/main.c Fri Jun 21 02:41:35 2002
@@ -405,6 +405,7 @@
j->voting[me->p_no] = -1;
#endif
me->p_candock = 1;
+ me->p_transwarp = PFGREEN|PFYELLOW|PFRED;
/* Get input until the player quits or dies */
living++;
while (living) input();
Index: Vanilla/ntserv/ntscmds.c
diff -u Vanilla/ntserv/ntscmds.c:1.22 Vanilla/ntserv/ntscmds.c:1.23
--- Vanilla/ntserv/ntscmds.c:1.22 Wed Jun 19 01:50:57 2002
+++ Vanilla/ntserv/ntscmds.c Fri Jun 21 02:41:35 2002
@@ -1,4 +1,4 @@
-/* $Id: ntscmds.c,v 1.22 2002/06/19 06:50:57 cameron Exp $
+/* $Id: ntscmds.c,v 1.23 2002/06/21 07:41:35 cameron Exp $
*/
/*
@@ -54,6 +54,7 @@
#endif
void do_password(char *comm, struct message *mess);
void do_nodock(char *comm, struct message *mess);
+void do_transwarp(char *comm, struct message *mess);
void do_admin(char *comm, struct message *mess);
const char myname[] = {"GOD"};
@@ -123,6 +124,13 @@
do_nodock },
#endif
+#ifdef NOTRANSWARP
+ { "TRANSWARP",
+ C_PR_INPICKUP,
+ "Set transwarp permission for all players. eg. 'TRANSWARP ON|OFF'",
+ do_transwarp },
+#endif
+
#ifdef ALLOW_PAUSE
{ "PAUSE",
0,
@@ -1213,6 +1221,66 @@
pmessage(whofrom, MINDIV, addr, "Slot %c is allowed to dock to SB", *who);
}
else pmessage(whofrom, MINDIV, addr, "dock usage: dock 0 on|off");
+}
+
+void do_transwarp(char *comm, struct message *mess)
+{
+ int whofrom = mess->m_from;
+ struct player *p = &players[whofrom];
+ struct player *victim;
+ char *addr = addr_mess(whofrom,MINDIV);
+ char *who, *what;
+ char *usage = "transwarp usage: 'TRANSWARP ON|GREEN|YELLOW|SHIELD|OFF'";
+ int slot;
+
+ if (p->p_ship.s_type != STARBASE) {
+ pmessage(whofrom, MINDIV, addr, "transwarp: must be a starbase to use this");
+ return;
+ }
+
+#ifdef OBSERVERS
+ if (p->p_status == POBSERV) {
+ pmessage(whofrom, MINDIV, addr, "transwarp: observers may not do this");
+ return;
+ }
+#endif
+
+ what = strtok(comm, " ");
+ if (what == NULL) return;
+
+ what = strtok(NULL, " ");
+ if (what == NULL) {
+ pmessage(whofrom, MINDIV, addr, usage);
+ return;
+ }
+
+ if (!strcmp("off", what) ) {
+ me->p_transwarp = 0;
+ pmessage(me->p_team, MTEAM,
+ addr_mess(me->p_team,MTEAM),
+ "Starbase %s refusing transwarp", me->p_mapchars);
+ } else if (!strcmp("green", what)) {
+ me->p_transwarp = PFGREEN;
+ pmessage(me->p_team, MTEAM,
+ addr_mess(me->p_team,MTEAM),
+ "Starbase %s refusing transwarp in red or yellow alert", me->p_mapchars);
+ } else if (!strcmp("yellow", what)) {
+ me->p_transwarp = PFYELLOW|PFGREEN;
+ pmessage(me->p_team, MTEAM,
+ addr_mess(me->p_team,MTEAM),
+ "Starbase %s refusing transwarp in red alert", me->p_mapchars);
+ } else if (!strcmp("shield", what)) {
+ me->p_transwarp = PFSHIELD;
+ pmessage(me->p_team, MTEAM,
+ addr_mess(me->p_team,MTEAM),
+ "Starbase %s refusing transwarp while shields up", me->p_mapchars);
+ } else if (!strcmp("on", what)) {
+ me->p_transwarp = PFGREEN|PFYELLOW|PFRED;
+ pmessage(me->p_team, MTEAM,
+ addr_mess(me->p_team,MTEAM),
+ "Starbase %s transwarp restored", me->p_mapchars);
+ }
+ else pmessage(whofrom, MINDIV, addr, usage);
}
void do_admin(char *comm, struct message *mess)
Index: Vanilla/ntserv/transwarp.c
diff -u Vanilla/ntserv/transwarp.c:1.3 Vanilla/ntserv/transwarp.c:1.4
--- Vanilla/ntserv/transwarp.c:1.3 Sat Jul 1 02:43:31 2000
+++ Vanilla/ntserv/transwarp.c Fri Jun 21 02:41:35 2002
@@ -1,4 +1,4 @@
-/* $Id: transwarp.c,v 1.3 2000/07/01 07:43:31 xyzzy Exp $
+/* $Id: transwarp.c,v 1.4 2002/06/21 07:41:35 cameron Exp $
* transwarp.c by isae at IASTATE.EDU
*/
#include "copyright.h"
@@ -28,8 +28,12 @@
}
if (me->p_status != PALIVE)
return (0);
+ if (!me->p_candock) {
+ new_warning(UNDEF, "Starbase refuses docking from us in particular, captain!", -1);
+ return (0);
+ }
if (me->p_flags & PFENG) {
- new_warning(UNDEF, "Engine temp is too high to initiate transwarp!", -1);
+ new_warning(UNDEF, "Engine temperature is too high to initiate transwarp!", -1);
return (0);
}
if (me->p_ship.s_type == STARBASE) {
@@ -56,7 +60,22 @@
return (0);
}
if (!(j->p_flags & PFDOCKOK)) {
- new_warning(UNDEF, "Starbase refusing us transwarp permission captain!", -1);
+ new_warning(UNDEF, "Starbase refusing all docking permission captain!", -1);
+ return (0);
+ }
+ if (!(j->p_transwarp & (j->p_flags ^ PFSHIELD))) {
+ char *reason = "";
+ switch (j->p_transwarp) {
+ case PFGREEN:
+ reason = "Starbase refusing transwarp, in red or yellow alert"; break;
+ case PFYELLOW|PFGREEN:
+ reason = "Starbase refusing transwarp, in red alert"; break;
+ case PFSHIELD:
+ reason = "Starbase refusing transwarp, her shields are up"; break;
+ default:
+ reason = "Starbase refusing transwarp, captain!"; break;
+ }
+ new_warning(UNDEF, reason, -1);
return (0);
}
if (me->p_speed > MIN_INITIAL_SPEED) {