Smaug 1.4a win32 - don't need to run from area directory?

Posted by Datac0re on Sat 15 May 2004 03:04 PM — 7 posts, 25,405 views.

#0
Hi everyone, I'm just getting started with Smaug, and one thing that has me scratching my head is that the readme for the win32 version of 1.4a says to just go ahead and run smaug.exe from the root smaug directory, while if I browse to the "docs" sub-directory and read the FAQ there, it mentions how I should run it from the area directory.

Examining the source shows that all of the <whatever>_DIR constants defined in mud.h are all written as "../<whatever>" leading me to believe that you should actually be starting up smaug in a subdirectory instead of the root directory.

However, if I go ahead and run Smaug from the root, the server is loading up everything just fine, including the areas, players, etc...

How on earth is this possible? Shouldn't I be getting all kinds of "directory not found" type of errors?

I even recompiled the source and plopped it into the root directory to make sure that the binary version of the win32 1.4a wasn't changed to allow for this, but lo and behold, the freshly compiled copy loads things just fine also!

Any ideas?
USA #1
I'm not sure, you would probably have to ask someone who actually uses it. However, it is possible that it moves into the area directory before starting up. I boot my MUD from my src directory, however, there is a line in the startup file that reads cd ../area, so it still starts from the area directory. ::shrug:: Just a thought.
USA #2
the windows version is just a program that starts up once you double click on it. the actual unix, cygwin or whatever you have to start it in the directory. so when you compile you make the executable in your root directory and you just double click the program to start.
USA #3
It's worth noting that the documentation for SMAUG is horribly out of date.
Australia Forum Administrator #4
These lines in the source account for it.

If running under the Win32 compile you execute the main function in services.c, which has this code in it (which I wrote) ...


  if (!GetModuleFileName (NULL, fullfilename, sizeof (fullfilename)))
   {
   service_error (GetLastError (), "Cannot locate full filename");
   Win32_Exit (1);
   }

// remove last part of file name to get working directory

  strcpy (directory, fullfilename);

  p = strrchr (directory, '\\');
  if (p)
    *p = 0;

  strcat (directory, "\\area");

// make sure we are running in the "area" subdirectory

  _chdir (directory);

  printf ("Working directory now %s\n", directory);


The important line is the one which changes to the area subdirectory. Can't remember offhand why I did that, there must be a reason. ;)
USA #5
Probably because it makes more sense and it's a whole lot more convenient to run from root directory, and not have to go into area/ first. :)
#6
Wow nothing like getting the answer directly from the author :)

Now this part also makes sense in mud.c:

#ifdef WIN32
int mainthread( int argc, char **argv )
#else
int main( int argc, char **argv )
#endif


Thanks a lot!
-Brian