FUSS Updated

Posted by Samson on Tue 13 Jul 2004 11:39 AM — 11 posts, 36,298 views.

USA #0
Just to let people know, the Smaug/SWR/SWFOTE FUSS packages were updated recently. I went through them and cleaned out alot of warnings with some aggressive compiler flags I use on my own codebase.

Also, the SWFOTE package specifically has some codebase specific fixes added to it which were posted to the SWFOTE forum. These fixes were provided by Rapidrunner and should provide a much more stable platform from which to build on this base.

The updated files can be found at www.mudplanet.org/files.php as usual.
Australia Forum Administrator #1
Thanks, I have put copies in the download area here.
USA #2
I currently use the slightly older version of SWR:FUSS and I would like to know, could you run some diff's or give out a change log so I might know what you changed? I'd like to apply it to my current code base. Thanks :)
Australia Forum Administrator #3
I tried compiling the smaug14afuss.tgz and got this:


make -s smaug
  Compiling o/comm.o....
comm.c: In function `new_descriptor':
comm.c:832: warning: cast discards qualifiers from pointer target type
make[1]: *** [o/comm.o] Error 1
make: *** [all] Error 2


The line in error is in bold:


    if ( sysdata.NO_NAME_RESOLVING )
      dnew->host = STRALLOC( buf );
    else
    {
       from = gethostbyaddr( (char *) &sock.sin_addr,
	  	sizeof(sock.sin_addr), AF_INET );
       dnew->host = STRALLOC( (char *)( from ? from->h_name : buf) );
    }


This is with:


$ gcc --version
gcc (GCC) 3.3.1 (cygming special)


Amended on Wed 14 Jul 2004 01:29 AM by Nick Gammon
Australia Forum Administrator #4
Also, "make clean" does this:


$ make clean
rm -f *.o smaug.exe *~


However the object files are in the "o" subdirectory, so it should do:


$ make clean
rm -f o/*.o smaug.exe *~



Australia Forum Administrator #5
When compiling under Visual C++ 6, I got the following errors/warnings. You may wish to track down the warnings for sake of completenes...


act_wiz.c
g:\smaug14afuss\smaugfuss\src\act_wiz.c(5668) : warning C4013: 'lstat' undefined; assuming extern returning int
g:\smaug14afuss\smaugfuss\src\act_wiz.c(7404) : warning C4013: 'snprintf' undefined; assuming extern returning int

build.c
g:\smaug14afuss\smaugfuss\src\boards.c(1447) : warning C4715: 'read_note' : not all control paths return a value

color.c
g:\smaug14afuss\smaugfuss\src\color.c(367) : warning C4013: 'snprintf' undefined; assuming extern returning int
g:\smaug14afuss\smaugfuss\src\color.c(1319) : warning C4013: 'vsnprintf' undefined; assuming extern returning int

i3.c
g:\smaug14afuss\smaugfuss\src\i3.c(28) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

imc.c
g:\smaug14afuss\smaugfuss\src\imc.c(46) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

mud_comm.c
g:\smaug14afuss\smaugfuss\src\mud_comm.c(1513) : warning C4305: 'function' : truncation from 'const int ' to 'short '

special.c
G:\smaug14afuss\SmaugFUSS\src\special.c(55) : warning C4550: expression evaluates to a function which is missing an argument list

(previous warning occurred 571 times)



I changed mud.h by adding the following lines, and removed the files i3.c and imc.c from the build, and got it down to 2 warnings:


#ifdef WIN32
  #include <winsock.h>
  #include <sys/types.h>
  #pragma warning( disable: 4018 4244 4761)
  #define NOCRYPT
  #define index strchr
  #define rindex strrchr
  #pragma warning( disable : 4550)  // NJG
  #define vsnprintf _vsnprintf      // NJG
  #define snprintf _snprintf        // NJG
  #define lstat stat                // NJG
  #pragma comment( lib, "ws2_32.lib ")  // NJG
  #pragma comment( lib, "winmm.lib" )   // NJG
#else


These are the warnings, which sound genuine:


build.c
g:\smaug14afuss\smaugfuss\src\boards.c(1447) : warning C4715: 'read_note' : not all control paths return a value

mud_comm.c
g:\smaug14afuss\smaugfuss\src\mud_comm.c(1513) : warning C4305: 'function' : truncation from 'const int ' to 'short '

Australia Forum Administrator #6
It is interesting to note compile times here. I compiled the FUSS source under both Cygwin and Visual C++ in debug mode (with debugging symbols, and no optimisation), and release mode (no debugging, optimisation) with the following build times (for everything excepting i3.c and imc.c) ...

Debug build - compile and link

  • Cygwin - 21 seconds
  • Visual C++ - 22 seconds


Release build - compile and link

  • Cygwin - 32 seconds
  • Visual C++ - 30 seconds


This was done on the same PC (hence the same CPU speed, memory size, hard disk speed etc.).

It is interesting that there is virtually no difference in compile speeds. One or two seconds to rebuild the whole project is nothing to worry about.



Using UltraEdit to compile

I also had some success compiling using UltraEdit as the front-end to Cygwin (much like using the Visual Studio environment).

To do this, I used the UltraEdit Advanced menu -> Tool Configuration, and entered:

  • Command line: \cygwin\bin\bash --login -i -c 'cd /home/nick/SmaugFUSS/src;make'
  • Working directory: C:\cygwin\home\Nick\SmaugFUSS\src\
  • Menu item name: make smaugFUSS
  • Save all files first: checked
  • Command output:
    • Output to list box: selected
    • Capture output: checked


Then click "Insert" to add this as a special command, and then OK to close the dialog box.

Having done all this (which you only do once) then there is a new menu item under the Advanced menu:


make smaugFUSS - Ctrl+Shift+0


Then to do a "make" I just select that menu item or type Ctrl+Shift+0, and the whole process kicks in. If there are errors they display in the Output pane near the bottom (select Window -> Output Window to see it). You can double-click any error message and it will open the appropriate file and go to the line in error. Very handy.



USA #7
Cleared the Cygwin warnings, but I'm afraid the other stuff is beyond my reach since I don't have access to a VC++ compiler. I'd also prefer not to remove the intermud code from the distro just because of that either. It compiles as intended now in all 3 packages. I'm sure there must be someone who knows how to get the complete package to compile under VC++, with the intermud code enabled for those who might wish to use it?

Anyway, the 3 package files have been updated again.
Australia Forum Administrator #8
You don't seem to have changed mud.h. If you add the suggested lines (the ones ending with // NJG ) then it won't affect the non-Win32 compiles, and should make it compile cleanly under Visual C++.

Unless I have downloaded the wrong copy, you also don't seem to have changed the "make clean" behaviour.
USA #9
Here's to hoping attempt #3 does the job. I could swear I uploaded that stuff. I must be getting old.
Australia Forum Administrator #10
OK, seems better now. I still get this warning:


build.c
g:\cygwin\home\nick\smaugfuss\src\boards.c(1447) : warning C4715: 'read_note' : not all control paths return a value


This is in:


NOTE_DATA *read_note( char *notefile, FILE *fp )
{
  NOTE_DATA *pnote;
  char *word;

// ... stuff omitted ...

  bug ( "read_note: bad key word." );
  exit( 1 );
}


See, although exit (1) would stop the program, that is a function call, and not, strictly speaking, returning a value. It should really be:


NOTE_DATA *read_note( char *notefile, FILE *fp )
{
  NOTE_DATA *pnote;
  char *word;

// ... stuff omitted ...

  bug ( "read_note: bad key word." );
  exit( 1 );
  return NULL;
}


The other warning is:


mud_comm.c
g:\cygwin\home\nick\smaugfuss\src\mud_comm.c(1513) : warning C4305: 'function' : truncation from 'const int ' to 'short '


The definition of add_timer is:


void add_timer( CHAR_DATA *ch, sh_int type, sh_int count, DO_FUN *fun, int value )


The warning occurs at:


void do_mpnuisance( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char arg1[MAX_STRING_LENGTH];

// ... stuff omitted ...

    victim->pcdata->nuisance->max_time = mktime(now_time);
    add_timer( victim, TIMER_NUISANCE, (28800*2), NULL, 0 );
    return;
}


The 3rd argument (sh_int count) is being passed the value 28800*2 which is 57,600. This is higher than the maximum possible in a short, which is 32767. This is therefore wrong.