9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] games/doom: fix config file never being loaded or saved
Date: Thu, 30 Jul 2015 20:30:52 +0200	[thread overview]
Message-ID: <aa9cbf0a970a116c8434a9ad2d129b3c@felloff.net> (raw)
In-Reply-To: <CAAGZaiKLN1PXVWCwtHuxzt6fL8zbL9GRn5XvMgtW9K1qf7WNSA@mail.gmail.com>

this can be done better in IdentifyVersion(), where it even used to set
basedefault[].

diff -r b357d5b16135 sys/src/games/doom/d_main.c
--- a/sys/src/games/doom/d_main.c	Thu Jul 30 20:02:23 2015 +0200
+++ b/sys/src/games/doom/d_main.c	Thu Jul 30 20:28:13 2015 +0200
@@ -563,7 +563,7 @@
 //
 void IdentifyVersion (void)
 {
-	char *wadfile;
+	char *wadfile, *slash;
 
 	if (M_CheckParm ("-shdev"))
 	{
@@ -615,35 +615,35 @@
 		language = french;
 		printf("French version\n");
 		D_AddFile (wadfile);
-		return;
 	} else if ( (wadfile = I_IdentifyWAD("doom2.wad")) ) {
 		gamemode = commercial;
 		D_AddFile (wadfile);
-		return;
 	} else if ( (wadfile = I_IdentifyWAD("plutonia.wad")) ) {
 		gamemode = commercial;
 		D_AddFile (wadfile);
-		return;
 	} else if ( (wadfile = I_IdentifyWAD("tnt.wad")) ) {
 		gamemode = commercial;
 		D_AddFile (wadfile);
-		return;
 	} else if ( (wadfile = I_IdentifyWAD("doomu.wad")) ) {
 		gamemode = retail;
 		D_AddFile (wadfile);
-		return;
 	} else if ( (wadfile = I_IdentifyWAD("doom.wad")) ) {
 		gamemode = registered;
 		D_AddFile (wadfile);
-		return;
 	} else if ( (wadfile = I_IdentifyWAD("doom1.wad")) ) {
 		gamemode = shareware;
 		D_AddFile (wadfile);
-		return;
 	} else {
 		printf("Game mode indeterminate.\n");
 		gamemode = indetermined;
+		return;
 	}
+	strncpy(basedefault, wadfile, sizeof(basedefault)-5);
+	basedefault[sizeof(basedefault)-5] = '\0';
+	slash = strrchr(basedefault, '/');
+	if (slash++ == 0)
+		slash = basedefault;
+	strcpy(slash, "cfg");
 }
 
 //

--
cinap


  reply	other threads:[~2015-07-30 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29 16:11 qux
2015-07-30 18:30 ` cinap_lenrek [this message]
2015-07-31 15:30   ` [9front] " qux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa9cbf0a970a116c8434a9ad2d129b3c@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).