Pfiles will not save when running Smaug in Windows.

Posted by Dace K on Tue 06 Jul 2004 05:20 AM — 9 posts, 31,295 views.

Canada #0
I have this problem every time I start a new mud, and every time I forget how to fix it..

I spent a few minutes looking around here, yet did not find much advice besides "make a backup directory".

So I had to sit down and figure it out; decided to post it here in case it'll help people with this problem in the future.


When you save in smaug, it saves to a tmpfile, then overwrites the original pfile to cut down on pfile bugs.
Unfortunately, Windows does not allow this..so you have to add a line of code deleting the original pfile first.

Open up save.c, and search for

if (ferr)
{
perror(strsave);
bug("Error writing temp file for %s -- not copying", strsave);
}
else
rename(TEMP_FILE, strsave);
}

replace it with

if (ferr)
{
perror(strsave);
bug("Error writing temp file for %s -- not copying", strsave);
}
else
{
remove(strsave);
rename(TEMP_FILE, strsave);
}}

That should fix all problems with pfile saving and the delete/destroy commands.

Cheers!

~S.
Amended on Thu 08 Jul 2004 12:02 AM by Dace K
USA #1
Heh, that should solve many peoples problems. The only issue is that the main reason people get Smaug Windows is because they don't want to code/don't know how. If thats the case, they probably don't have a compiler, like Cygwin.
Canada #2
Aye, but this problem happens with Cygwin as well :|.
It's because windows doesn't let you rename a file to the same name as an existing file.

..apparently this doesn't fix the bug with destroy/delete, I'll look into that when I get home.
Canada #3
Actually, running smaugfuss in cygwin, I do not have any kind of problem with pfiles not saving. What version are you using?
USA #4
SmaugFUSS should work fine with Cygwin if the makefile flag is on. But I think Satsui is talking about normal Smaug.
USA #5
Strange. I will have to second Greven on the Smaug FUSS not having this problem under Windows, either 95, 98 or 98SE from what I can tell. I also believe I ran several other versions / flavors of SMAUG (including the one offered here, or at least at one time) and it worked fine too.

Weird.
Canada #6
:\. I'm talking about smaug 1.4a from www.smaug.org.

Turns out the bug was that backup dir is defined as ../player/backup in mud.h, whereas the actual backup folder is located at ../backup.

Smaug1.4a is such a heap of bugs :\.
USA #7
You mean the smaug.org that no longer exists? Heh, yeah. Its gone. Not sure why.

Didn't know that it was a backup issue.
USA #8
No, I'm sure he meant the smaug.org which is still reachable at www.game.org/smaug :P

And yes. The "official" version of the codebase is rittled with bugs, hence the need for the FUSS package which has more or less plugged them. At least those poeple know about and have reported somewhere. I myself have never had a problem saving pfiles in Windows, but then that was well after I had fixed that backup dir problem in my code.