Source files
The Win32 and Unix source are currently maintained in the same source files, so that changes to the Unix version are automatically reflected for people compiling under Win32.
The differences needed for Win32 compilation are surrounded by:
#ifdef WIN32
... Win32 statements or declarations ...
#endif
Source
The current source code of PennMUSH can be found at the site:
ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/
The file name will look something like this:
pennmush-1.6.10p0.tar.gz
(This example is for PennMUSH 1.6.10 patchlevel 0)
Note that in order to compile the source you will need a C compiler. The one I used to compile the executable version is the Microso…
Source files
The Win32 and Unix source are currently maintained in the same source files, so that changes to the Unix version are automatically reflected for people compiling under Win32.
The differences needed for Win32 compilation are surrounded by:
#ifdef WIN32
... Win32 statements or declarations ...
#endif
Source
The current source code of PennMUSH can be found at the site:
ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/
The file name will look something like this:
pennmush-1.6.10p0.tar.gz
(This example is for PennMUSH 1.6.10 patchlevel 0)
Note that in order to compile the source you will need a C compiler. The one I used to compile the executable version is the Microsoft Visual C++ compiler, version 4.2.
You will also need to un-gzip, and un-tar the file, before you can compile it. To do this I recommend using WinZip, which is available from:
Step-by-step instructions for compiling under Win32
Conditions
These instructions were tested under the following conditions;
- Downloaded source for 1.6.9 patchlevel 0
- Used Microsoft Visual C++ compiler 5.0 (should also work with 4.2)
- Compiled on Windows NT 4 (should also work under Windows 95)
- Cool day, light rain
To see how I compiled 1.7.2 p2, follow this link: How to compile version 1.7.2
Download files
- Download the Pennmush source from:
ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/oldsrc/1.6/pennmush-1.6.9p0.tar.gz
- Download SHS.C from:
ftp://lists.pennmush.org/pub/PennMUSH/shs.c
- Obtain SHS.H from [SHS.H Listing] and save to disk as SHS.H
Unzip archive and prepare to compile
- Use Winzip to uncompress "pennmush-1.6.9p0.tar.gz" into an appropriate directory (eg. C:\PENNMUSH).
- Go to the Win32 directory
- Create subdirectory: win32\sce
- Copy all Unix source files from the "src" directory. NB - leave originals there for use during future patching operations (ie. hold down Ctrl key to make a copy rather than move the files).
- Copy all Unix headers from the "hdrs" directory. NB - leave originals there for use during future patching operations.
- Copy all Win32 source from the win32 directory EXCEPT "pennmush.mak", overriding files where necessary. NB - leave originals there for use during future patching operations.
- Add SHS.C and SHS.H (obtained earlier) to the win32\sce directory
- Use your C++ compiler to open PENNMUSH.MAK
- Add SERVICES.C to the project
- Add ACCESS.C to the project
- In SERVICES.C (line 25) change the include from
#include "conmagic.h"
to
#include "confmagic.h"
- Add:
#include <ctype.h>
to the list of includes in ACCESS.C
- Add:
#include <ctype.h>
to the list of includes in ATTRIB.C
- Bring up the "Project Settings" window, C++ tab, Category "Code Generation" and change "Use run-time library" to "Multithreaded" (or "Debug Multithreaded" if you are doing a debug build) - see below.

How it should look
Your finished pennmush\win32\sce directory structure should look like this:

The contents of the "sce" directory should be:

Compile and test
- Compile
- Ignore various warnings.
- Copy the resulting PENNMUSH.EXE from "Windebug" subdirectory to the "GAME" directory
- Amend MUSH.CFG as described in Configuring PennMUSH
- Open a command window, and type: PENNMUSH /RUN
That’s it! It should work.
Using other compilers
I cannot guarantee that you can compile using other compilers (eg. Borland) however there is no reason why not, provided they support Windows sockets, and multiple threads. In case your compiler cannot read the "mak" file, click on Source Listing to see a listing of all of the source files that should be in your project.
Adding patchlevels
Once a new release of PennMUSH is released, minor changes are made by adding "patches". These are files that are created by using the "diff" utility to find the difference between the newer version and the distributed major version. Under Unix (or Linux) it is a simple matter to run the "patch" utility which reapplies the patches back. Patches for the older source files can be found at:
ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/oldpatches/
Example of a patch file
*** /tmp/T0a00543 Mon Sep 30 15:24:20 1996
--- src/funmisc.c Tue Sep 24 10:59:31 1996
***************
*** 119,124 ****
--- 119,126 ----
return;
}
strcpy(renv[r], args[1]);
+ if (!strcmp(called_as, "SETR"))
+ safe_str(args[1], buff, bp);
}
What this means is that:
- In file: funmisc.c
- Around lines: 119 to 124
- Match on the 3 lines with a blank in column 1 (in case the line numbers have changed slightly)
- Add the two new lines with a "+" at the start of them
- In a similar vein, a "!" in column 1 means "change the line" and a "-" means "delete the line".
How to apply patches
A copy of the PATCH program has been ported to Win32. You can obtain it from:
ftp://ftp.ozemail.com.au/pub/gammon/pennmush/patch.zip
Because the PATCH program has been ported from Unix, it is rather idiosyncratic under Windows :(. After lengthy investigation I have found that the following methods will get it to work reasonably well ...
-
You need to convert the source files (*.c, *.h etc.) into "Unix" style text or PATCH will not locate the data to be patched correctly.
-
To this end I have written two utilities, "dos2unix" and "unix2dos" which are designed to convert a wildcarded list of files quickly and easily. These will be available from:
-
PATCH also seems to hang if too many of the files ending in .ORIG (which it iself creates) are left lying around on your disk.
-
To address these problems, I have created a batch file which does the file conversion, applies the patches, deletes the .ORIG files, and converts the files back to DOS format. It is available from:
ftp://ftp.ozemail.com.au/pub/gammon/pennmush/patchit.zip
To use it, copy the above code and paste into a file called PATCHIT.BAT. Then, to apply a patch, you would enter (say):
patchit patch01
Note that this patches the original files (ie. in the Unix directories), so that after doing one or more patches you would then copy the .c and .h files back into the win32\sce directory before recompiling.
You may get errors during the patch process, but if the file with the error is not a .c or .h file I wouldn’t worry too much. Files like "configure" and suchlike are only used during the Unix compilation process anyway.
Using the above process I successfully applied patches 1 through to 10 for PennMUSH version 1.6.9 and recompiled without any errors.
Latest source
The latest source for PennMUSH, along with the appropriate patch files, can be found at:
ftp://pennmush.tinymush.org/pub/DuneMUSH/Source/
Comments to Gammon Software support
Page updated on Wednesday, 15 December 2004