9front - general discussion about 9front
 help / color / mirror / Atom feed
From: qux <qu7uux@gmail.com>
To: 9front@9front.org
Subject: Re: [9front] games/doom: fix config file never being loaded or saved
Date: Fri, 31 Jul 2015 18:30:22 +0300	[thread overview]
Message-ID: <CAAGZaiJW27mwfW8L1-TGVeNi5x=o2PE0oGbe=mKSvYJdJVbC2w@mail.gmail.com> (raw)
In-Reply-To: <aa9cbf0a970a116c8434a9ad2d129b3c@felloff.net>

On 7/30/15, cinap_lenrek@felloff.net <cinap_lenrek@felloff.net> wrote:
> 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
>

Yeah, it's much better that way.

Thank you for your work!

qwx


      reply	other threads:[~2015-07-31 15: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 ` [9front] " cinap_lenrek
2015-07-31 15:30   ` qux [this message]

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='CAAGZaiJW27mwfW8L1-TGVeNi5x=o2PE0oGbe=mKSvYJdJVbC2w@mail.gmail.com' \
    --to=qu7uux@gmail.com \
    --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).