+++ /dev/null
---- njam.cpp.orig 2004-08-31 23:08:03.911280616 -0400
-+++ njam.cpp 2004-08-31 23:57:05.560082024 -0400
-@@ -33,6 +33,9 @@
- // needed for chdir\r
- #ifdef __linux__\r
- #include <unistd.h>\r
-+// for mkdir\r
-+#include <sys/stat.h>\r
-+#include <sys/types.h>\r
- #endif\r
- \r
- #include <stdio.h>\r
-@@ -215,15 +218,31 @@
- SDLNet_Quit();\r
- \r
- // write configuration options\r
-- char filename[] = "njam.conf";\r
-- FILE *fp = fopen(filename, "w+");\r
-- if (fp)\r
-- {\r
-- fprintf(fp, "M=%d\n", (m_GameOptions.PlayMusic ? 1 : 0));\r
-- fprintf(fp, "S=%d\n", (m_GameOptions.PlaySound ? 1 : 0));\r
-- fprintf(fp, "U=%d\n", m_GameOptions.UsedSkin);\r
-- fprintf(fp, "I=%s\n", m_GameOptions.ServerIP);\r
-- fclose(fp);\r
-+ FILE *fp;\r
-+ \r
-+ if(getenv("HOME") && (chdir(getenv("HOME")) == 0))\r
-+ {\r
-+ mkdir(".njam", 0774);\r
-+ \r
-+ if(chdir(".njam") == 0)\r
-+ {\r
-+ char filename[] = "njam.conf";\r
-+ fp = fopen(filename, "w+");\r
-+ \r
-+ if(fp)\r
-+ {\r
-+ fprintf(fp,\r
-+ "M=%d\n",\r
-+ "S=%d\n",\r
-+ "U=%d\n",\r
-+ "I=%d\n",\r
-+ (m_GameOptions.PlayMusic ? 1 : 0),\r
-+ (m_GameOptions.PlaySound ? 1 : 0),\r
-+ m_GameOptions.UsedSkin,\r
-+ m_GameOptions.ServerIP);\r
-+ fclose(fp);\r
-+ }\r
-+ }\r
- }\r
- \r
- // format: NAME#POINTS#LEVEL#\r
-@@ -599,37 +618,52 @@
- m_FontYellow = new NjamFont("data/font-yellow.bmp", 10, 15);\r
- \r
- // Load user settings from .conf file\r
-- char filename[] = "njam.conf";\r
-- FILE *fp = fopen(filename, "r");\r
-- if (fp)\r
-- {\r
-- LogFile("Reading njam.conf file.\n");\r
-- char buff[20];\r
-- while (true)\r
-+ FILE *fp;\r
-+ \r
-+ if(getenv("HOME") && (chdir(getenv("HOME")) == 0) &&\r
-+ (chdir(".njam") == 0))\r
-+ {\r
-+ char filename[] = "njam.conf";\r
-+ fp = fopen(filename, "r");\r
-+ \r
-+ if(fp)\r
- {\r
-- fgets(buff, 20, fp);\r
-- if (feof(fp))\r
-- break;\r
-+ LogFile("Reading njam.conf file.\n");\r
-+ char buff[20];\r
- \r
-- if (buff[1] == '=')\r
-+ while (true)\r
- {\r
-- int i;\r
-- switch (buff[0])\r
-+ fgets(buff, 20, fp);\r
-+ if (feof(fp))\r
-+ break;\r
-+\r
-+ if (buff[1] == '=')\r
- {\r
-- case 'M': m_GameOptions.PlayMusic = (buff[2] == '1'); break;\r
-- case 'S': m_GameOptions.PlaySound = (buff[2] == '1'); break;\r
-- case 'U': m_GameOptions.UsedSkin = (buff[2] - '0'); break;\r
-- case 'I': // serverIP\r
-- for (i=2; buff[i] != '\n' && buff[i] && i<17; i++)\r
-- m_GameOptions.ServerIP[i-2] = buff[i];\r
-- m_GameOptions.ServerIP[i] = '\0';\r
-- break;\r
-- default:\r
-- printf("Unknown configuration file option: %c\n", buff[0]);\r
-+ int i;\r
-+ switch (buff[0])\r
-+ {\r
-+ case 'M': \r
-+ m_GameOptions.PlayMusic = (buff[2] == '1');\r
-+ break;\r
-+ case 'S':\r
-+ m_GameOptions.PlaySound = (buff[2] == '1');\r
-+ break;\r
-+ case 'U':\r
-+ m_GameOptions.UsedSkin = (buff[2] - '0');\r
-+ break;\r
-+ case 'I': // serverIP\r
-+ for (i=2; buff[i] != '\n' && buff[i] && i<17; i++)\r
-+ m_GameOptions.ServerIP[i-2] = buff[i];\r
-+ m_GameOptions.ServerIP[i] = '\0';\r
-+ break;\r
-+ default:\r
-+ printf("Unknown configuration file option: %c\n", \r
-+ buff[0]);\r
-+ }\r
- }\r
- }\r
-+ fclose(fp);\r
- }\r
-- fclose(fp);\r
- }\r
- \r
- // create default hiscore\r
-@@ -992,4 +1026,4 @@
- SDL_Flip(m_Screen);\r
- }\r
- }\r
--//---------------------------------------------------------------------------\r
-+//---------------------------------------------------------------------------
+++ /dev/null
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/games-arcade/njam/njam-1.21.ebuild,v 1.3 2005/12/28 06:42:07 mr_bones_ Exp $
-
-inherit eutils flag-o-matic games
-
-MY_P="${P}-src"
-DESCRIPTION="Multi or single-player network Pacman-like game in SDL"
-HOMEPAGE="http://njam.sourceforge.net/"
-SRC_URI="mirror://sourceforge/njam/${MY_P}.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="x86 ppc ~amd64"
-IUSE=""
-
-DEPEND=">=media-libs/sdl-mixer-1.2.5
- >=media-libs/sdl-image-1.2.2
- >=media-libs/libsdl-1.2.5
- >=media-libs/sdl-net-1.2.4"
-
-S="${WORKDIR}/${MY_P}"
-
-src_unpack() {
- unpack ${A}
- cd "${S}"
-
- # store the conf file in the user's home directory.
- epatch "${FILESDIR}/${PV}-conf.patch"
-
- sed -i \
- -e "s:\"data:\"${GAMES_DATADIR}/${PN}/data:" njam.cpp njamgame.cpp \
- || die "sed njam.cpp and njamgame.cpp failed"
- sed -i \
- -e "s:\"hiscore.dat:\"${GAMES_STATEDIR}/${PN}/hiscore.dat:" \
- -e "s:\"skins:\"${GAMES_DATADIR}/${PN}/skins:" njam.cpp \
- || die "sed njam.cpp failed"
- sed -i \
- -e "s:\"levels:\"${GAMES_DATADIR}/${PN}/levels:" njamedit.cpp \
- || die "sed njamedit.cpp failed"
- sed -i \
- -e "s:\"log.txt:\"/dev/null:" njamutils.cpp \
- || die "sed njamutils.cpp failed"
-
- # njam segfaults on startup with -Os
- replace-flags "-Os" "-O2"
-
- sed -i \
- -e '/^PREFIX/s:=.*:=/usr/share:' \
- -e "s:-O3:${CFLAGS}:" Makefile \
- || die "sed Makefile failed"
-}
-
-src_install() {
- dogamesbin njam || die "dogamesbin failed"
- dodoc CHANGES README TODO
- dohtml html/*
- dodir "${GAMES_DATADIR}/njam"
- cp -r data/ skins/ levels/ "${D}${GAMES_DATADIR}/njam" || die "cp failed"
- dodir "${GAMES_STATEDIR}/${PN}"
- touch "${D}/${GAMES_STATEDIR}/${PN}/hiscore.dat"
- fperms 664 "${GAMES_STATEDIR}/${PN}/hiscore.dat"
- prepgamesdirs
-}