SWR server

Posted by Shadoan on Tue 27 Mar 2001 06:26 PM — 23 posts, 81,623 views.

Canada #0
SWR for windows. I tried to get it to work, since its only a .bat file but it wouldn't run, so I downloaded the source code and tried running the .bat file with it but it didn't work so I went to kyndig.com and downloaded their source code, it ran this time but had so many errors it was loading for 5 minutes, I don't know whats wrong with it....
Australia Forum Administrator #1

I am not sure what batch file you are referring to. The port of SWR that I did is at ftp://ftp.gammon.com.au/smaug/StarWars.zip. This is not a batch file, it is a 551 Kb zip file with a new .exe file for SMAUG in it. This should replace the smaug.exe file in the normal SMAUG download.

The source files are at ftp://ftp.gammon.com.au/smaug/StarWarsSce.zip.

USA #2
this is off the subject but still with SWR code...
i got the actual code from:

http://www.swreality.co.uk/swr-2.0a2.tar.gz

and this is the other error i got

make ../bin/swr
make[1]: Entering directory `/home/jmartin4/swr-2.0/src'
gcc -c -g3 -Wall fight.c
fight.c:8: sys/dir.h: No such file or directory
make[1]: *** [fight.o] Error 1
make[1]: Leaving directory `/home/jmartin4/swr-2.0/src'
make: *** [all] Error 2

there is a directory called system which i changed
to sys but its still not finding it... also tweaked
the makefile to what i need in there, still the same
problem... any suggestions?

or.. i could always get the windows one running, but
that didn't make too much sense, plus it gave me a
spamming error about not finding everything...
Australia Forum Administrator #3
Here is how I got it to compile:



1. Edit fight.c, and also save.c, and change the line "#include <sys/dir.h>", as follows:


#include <dirent.h>





2. Edit the file c:/cygwin/usr/include/sys/time.h

and at around line 41, change the "#if defined" line as follows:


/* BSD time macros used by RTEMS code */
//#if defined(__rtems__)
#if 1





3. Edit the file save.c and change the line at line 1777 from:


struct direct *de;


to


struct dirent *de;





4. Changed the third line of file "Makefile" to:


NOCRYPT = -DNOCRYPT

Amended on Sun 01 Apr 2001 08:09 PM by Nick Gammon
USA #4
this is the error now, pretty much the same...

make ../bin/swr
make[1]: Entering directory `/home/jmartin4/swr-2.0/src'
gcc -c -g3 -Wall -DNOCRYPT fight.c
fight.c:8: direct.h: No such file or directory
make[1]: *** [fight.o] Error 1
make[1]: Leaving directory `/home/jmartin4/swr-2.0/src'
make: *** [all] Error 2

my time.h looks like this though

/* time.h -- An implementation of the standard Unix <sys/time.h> file.
Written by Geoffrey Noer <noer@cygnus.com>
Public domain; no rights reserved. */

#ifndef _SYS_TIME_H_
#define _SYS_TIME_H_

#include <_ansi.h>
#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _WINSOCK_H
struct timeval {
long tv_sec;
long tv_usec;
};

struct timezone {
int tz_minuteswest;
int tz_dsttime;
};

#ifdef __CYGWIN__
#include <sys/select.h>
#endif /* __CYGWIN__ */

#endif /* _WINSOCK_H */

#define ITIMER_REAL 0
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2

struct itimerval {
struct timeval it_interval;
struct timeval it_value;
};

int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z));
int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *));
int _EXFUN(utimes, (const char *__path, struct timeval *__tvp));
int _EXFUN(getitimer, (int __which, struct itimerval *__value));
int _EXFUN(setitimer, (int __which, const struct itimerval *__value,
struct itimerval *__ovalue));

#ifdef __cplusplus
}
#endif
#endif /* _SYS_TIME_H_ */

kind of unorganized, but that is what it looks like.
i don't see any #if defined in there... unless i'm blind
and yeah that is the one from usr/include/sys/ in cygwin
Australia Forum Administrator #5
Well, that's a strange thing. You must have an earlier version of cygwin or something. My version of time.h looks similar, except that the following lines are before the line:

int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z));



/* BSD time macros used by RTEMS code */
//#if defined(__rtems__)
#if 1
/* Convenience macros for operations on timevals.
   NOTE: `timercmp' does not work for >= or <=.  */
#define	timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)
#define	timerclear(tvp)		((tvp)->tv_sec = (tvp)->tv_usec = 0)
#define	timercmp(a, b, CMP) 						      \
  (((a)->tv_sec == (b)->tv_sec) ? 					      \
   ((a)->tv_usec CMP (b)->tv_usec) : 					      \
   ((a)->tv_sec CMP (b)->tv_sec))
#define	timeradd(a, b, result)						      \
  do {									      \
    (result)->tv_sec = (a)->tv_sec + (b)->tv_sec;			      \
    (result)->tv_usec = (a)->tv_usec + (b)->tv_usec;			      \
    if ((result)->tv_usec >= 1000000)					      \
      {									      \
	++(result)->tv_sec;						      \
	(result)->tv_usec -= 1000000;					      \
      }									      \
  } while (0)
#define	timersub(a, b, result)						      \
  do {									      \
    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;			      \
    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;			      \
    if ((result)->tv_usec < 0) {					      \
      --(result)->tv_sec;						      \
      (result)->tv_usec += 1000000;					      \
    }									      \
  } while (0)
#endif
USA #6
updated the cygwin, but now getting tons
of errors... unrelated to the mud code itself...
gonna try to reinstall, but i'm getting this error.

make ../bin/swr
make[1]: Entering directory `/home/jmartin4/starwars/src'
gcc -c -g3 -Wall -DNOCRYPT act_comm.c
gcc: installation problem, cannot exec `/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-1/cpp0.exe': Permission denied
make[1]: *** [act_comm.o] Error 1
make[1]: Leaving directory `/home/jmartin4/starwars/src'
make: *** [all] Error 2

then i get a windows error: error starting program
The CPP0.exe file is linked to missing export cygwin1.dll:getrlimit.

no clue, but i think i prolly have to reinstall it.
Australia Forum Administrator #7
I think I would completely remove cygwin, and then re-install it (from the latest version from their site). Save or rename your home directory first, I'm not sure whether that gets removed as well.
Amended on Sun 01 Apr 2001 06:25 PM by Nick Gammon
USA #8
nope :)
the problem was the cygwin1.dll file in windows\system
wasn't the correct one... i moved the one in C:\cygwin
into system and it works fine except the usual code
buggies now. ;)
USA #9
here's the problem now....

make ../bin/swr
make[1]: Entering directory `/home/jmartin4/starwars/src'
gcc -c -g3 -Wall -DNOCRYPT fight.c
fight.c:8: direct.h: No such file or directory
make[1]: *** [fight.o] Error 1
make[1]: Leaving directory `/home/jmartin4/starwars/src'
make: *** [all] Error 2

doesn't know where this direct.h file is that you told
me to add in....
Australia Forum Administrator #10
Looks like a typo.

My file had "dirent.h" not "direct.h".

USA #11
*laugh* oopsie. ;)

thanks for noticing that...
i don't think i ever would have.
USA #12
OK... here's the latest... doesn't seem to be finding
the exe, but i couldn't find it anywhere....

make ../bin/swr
make[1]: Entering directory `/home/jmartin4/swr/src'
rm -f ../bin/swr
gcc -o ../bin/swr act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o
build.o clans.o comm.o const.o db.o fight.o handler.o hashstr.o id.o interp.o m
agic.o makeobjs.o misc.o mud_comm.o mud_prog.o player.o requests.o reset.o save.
o shops.o skills.o special.o tables.o track.o update.o space.o morespace.o swski
lls.o planets.o vote.o -lm # -lcrypt
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-2/../../../../i686-pc-cygwin/bin/ld: cann
ot open output file ../bin/swr.exe: No such file or directory
collect2: ld returned 1 exit status
make[1]: *** [../bin/swr] Error 1
make[1]: Leaving directory `/home/jmartin4/swr/src'
make: *** [all] Error 2
Australia Forum Administrator #13
Mine ended up in the bin directory (ie. go up one level and then down to bin).

USA #14
maybe i'm not following... my swr directory used to
be called starwars, and it gave the same error with
swr.exe and in the gzp i never saw a swr.exe, so
is it just creating this file somewhere, because
i can't find it whatsoever....
Australia Forum Administrator #15
The file swr.exe is the result of the link. In other words, the whole point of compiling is to eventually get the swr.exe file, which you then execute to get SMAUG up. Thus, it won't be in the gzip file.

There is a minor bug in the make file (Makefile) which tries to chmod (change mode) the swr file, however under Cygwin the file is swr.exe (not swr) and thus that fails. However that is not a big deal, otherwise it is ready to run.

This is what I saw when I linked:


$ make
rm -f ../bin/swr
gcc -o ../bin/swr act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o
build.o clans.o comm.o const.o db.o fight.o handler.o hashstr.o id.o interp.o m
agic.o makeobjs.o misc.o mud_comm.o mud_prog.o player.o requests.o reset.o save.
o shops.o skills.o special.o tables.o track.o update.o space.o morespace.o swski
lls.o planets.o vote.o -lm # -lcrypt
chmod g+w ../bin/swr
chmod: ../bin/swr: No such file or directory
make[1]: *** [../bin/swr] Error 1
make[1]: Leaving directory `/home/nick/swr-2.0/src'
make: *** [all] Error 2

$ ls ../bin
swr.exe



Note the swr.exe file in the bin directory.

USA #16
it doesn't seem to make that file at all.
i have something else messed up because i get this
as well as the missing swr.exe

collect2: ld returned 1 exit status

the only bin directory i have is in the cygwin directories
and swr isn't in there after the make.
Australia Forum Administrator #17
The bin directory should be there anyway. How did you unzip the original archive? If you used WinZip then there is a problem that it doesn't automatically create empty directories, which bin would have been.

However using tar will work correctly.

eg.


tar xvzf swr-2.0a2.tar.gz


What I would do at this stage is just create (ie. mkdir) the empty bin directory, at the same level as the src directory, then try relinking.

ld is the GNU linker, by the way.


USA #18
got it... there are tons of bugs though unfortunately...
i'll have to get out my RAID and kill them all myself. ;)

thanks...
Canada #19
Ok i compile everything and it WORKS!!!!!!!!
But now sometimes when i type score...[B][U]BOOOM[/U][/B]
This is what I get:
0 [main] swreality 453205 handle_exceptions: Exception: STATUS_ACCESS_VIOL
ATION
118415 [main] swreality 453205 stackdump: Dumping stack trace to SWREALITY.EXE.
stackdump
Segmentation fault (core dumped)
Australia Forum Administrator #20
Sorry to hear that, but I can't really help debug all of the SWR code.

I didn't write the original SMAUG, and also didn't write the SWR add-ons.

If you are reasonably familiar with C, you could try firing up the debugger and trying to work out where it is going wrong, but sometimes that can be quite time-consuming.

For me, I have to spend my time adding in all the enhancements to MUSHclient that people have been asking for.
#21
Well I had the forementioned problem of swr being non-existent, but that was not much of a problem.
I compiled and ran the file, but during the boot process, it turns up an error on not being able to read in/find the area.lst file. (specifically, the program terminated when it says "Reading in area files...", then puts out the shutdown.txt stating the error i mentioned.

I've gone through db.c and mud.h, backtracking the problem, checking to make sure the program is reading into the proper directories. So far, no luck.

I am pretty much using stock SWR, and compiling under the latest version of Cygnus.
Australia Forum Administrator #22
I usually execute the server from the area directory, and thus it can find the area.lst file - as it is not given a full pathname in the source.

Thus, I do something like this:


cd area
../bin/smaug.exe


(or maybe ../src/smaug.exe)