summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcompany <company>2003-10-24 02:59:43 +0000
committercompany <company>2003-10-24 02:59:43 +0000
commit78db6872172348ff858d7989936692e0fddd600c (patch)
treec47605558e1ab696a5bfde4a94f638dd19e6296a
parent1a8a15dfb1a81661c32146005daf93b1fbc55970 (diff)
fixes to get the windows build going - it works now
-rw-r--r--configure.ac3
-rw-r--r--libgame/game-highscore.c4
-rw-r--r--libgame/game-portable.c36
-rw-r--r--libgame/game-portable.h2
-rw-r--r--libgame/gnome-cellrendererkeys.c1
-rw-r--r--libgame/gnome-window.c8
-rw-r--r--po/de.po42
7 files changed, 62 insertions, 34 deletions
diff --git a/configure.ac b/configure.ac
index 9cb6a0c..2ccf5df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,9 @@ AS_COMPILER_FLAG(-Wall, LIBGAME_CFLAGS="$LIBGAME_CFLAGS -Wall",)
if test "x$LIBGAME_CVS" = "xyes"; then
AS_COMPILER_FLAG(-Werror, LIBGAME_CFLAGS="$LIBGAME_CFLAGS -Werror",)
fi
+dnl required on gcc and windows - first is for gcc3, second for gcc2
+AS_COMPILER_FLAG(-mms-bitfields, LIBGAME_CFLAGS="$LIBGAME_CFLAGS -mms-bitfields",)
+AS_COMPILER_FLAG(-fnative-struct, LIBGAME_CFLAGS="$LIBGAME_CFLAGS -fnative-struct",)
LIBGAME_CFLAGS="$CFLAGS $LIBGAME_CFLAGS"
diff --git a/libgame/game-highscore.c b/libgame/game-highscore.c
index 05fb03e..efbc2c1 100644
--- a/libgame/game-highscore.c
+++ b/libgame/game-highscore.c
@@ -22,9 +22,9 @@
#include "game-marshal.h"
#include "game-i18n.h"
#include "game-xml.h"
+#include "game-portable.h"
#include <unistd.h>
-#include <pwd.h>
#include <string.h>
#include <time.h>
#include <libxml/tree.h>
@@ -619,7 +619,7 @@ game_high_score_entry_new (const gchar *name, gint *scores, guint score_count)
entry = g_new (GameHighScoreEntry, 1);
entry->name = g_strdup (name);
- entry->user = g_strdup (getpwuid (getuid ())->pw_name);
+ entry->user = g_strdup (game_get_current_user ());
entry->date = time (NULL);
entry->scores = g_new (gint, score_count);
memcpy (entry->scores, scores, sizeof (gint) * score_count);
diff --git a/libgame/game-portable.c b/libgame/game-portable.c
index 1c9f1af..8a98df3 100644
--- a/libgame/game-portable.c
+++ b/libgame/game-portable.c
@@ -22,7 +22,8 @@
# include "config.h"
#endif
-#include <game-portable.h>
+#include "game-portable.h"
+#include "game-i18n.h"
#include <stdio.h>
#ifdef WIN32
@@ -31,17 +32,22 @@
# include <sys/stat.h>
# include <unistd.h>
# include <pwd.h>
+# include <stdlib.h>
#endif
G_CONST_RETURN gchar *
game_get_current_user (void)
{
#ifdef WIN32
- static gchar username[128] = {0, };
- if (username[0] == 0)
- GetUserName (username, sizeof (username) - 1);
- if (username[0] == 0)
- strcpy (username, _("Unknown"));
+ static DWORD size = 128;
+ static gchar *username;
+ if (username == NULL) {
+ username = g_new0 (gchar, size);
+ if (GetUserName (username, &size) == 0) {
+ g_free (username);
+ username = g_strdup (_("Unknown"));
+ }
+ }
return username;
#else
return getpwuid (getuid ())->pw_name;
@@ -62,7 +68,7 @@ game_get_high_score_dir (void)
if (size <= 0)
return NULL;
get_dir = g_new (gchar, size);
- g_assert (size -1 == GetCurrentDirectory (size - 1, get_dir));
+ g_assert (size -1 == GetCurrentDirectory (size, get_dir));
dir = g_build_filename (get_dir, LIBGAME_DIR, NULL);
g_free (get_dir);
#else
@@ -104,3 +110,19 @@ game_ensure_directory (gchar *dir)
return TRUE;
}
+gboolean
+game_file_copy (const gchar *from, const gchar *to)
+{
+#ifdef WIN32
+ return CopyFile (from, to, FALSE);
+#else
+ gboolean ret;
+ gchar *command;
+
+ command = g_strdup_printf ("cp \"%s\" \"%s\"", from, to);
+ ret = system (command) == 0;
+ g_free (command);
+
+ return ret;
+#endif
+}
diff --git a/libgame/game-portable.h b/libgame/game-portable.h
index df8b836..f09d0fe 100644
--- a/libgame/game-portable.h
+++ b/libgame/game-portable.h
@@ -28,6 +28,8 @@ G_BEGIN_DECLS
G_CONST_RETURN gchar * game_get_current_user (void);
G_CONST_RETURN gchar * game_get_high_score_dir (void);
gboolean game_ensure_directory (gchar * dir);
+gboolean game_file_copy (const gchar * from,
+ const gchar * to);
G_END_DECLS
diff --git a/libgame/gnome-cellrendererkeys.c b/libgame/gnome-cellrendererkeys.c
index e7f47f5..2df350c 100644
--- a/libgame/gnome-cellrendererkeys.c
+++ b/libgame/gnome-cellrendererkeys.c
@@ -22,7 +22,6 @@
* $Id$
*/
#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include "gnome-cellrendererkeys.h"
diff --git a/libgame/gnome-window.c b/libgame/gnome-window.c
index aa3d412..bba2408 100644
--- a/libgame/gnome-window.c
+++ b/libgame/gnome-window.c
@@ -291,14 +291,16 @@ cb_stop_recording (GameRecorder *recorder, GameGnomeWindow *window)
continue;
}
g_free (file);
- file = g_strdup_printf ("cp %s%c%s.replay %s%c%s%c%s%c%lu",
- g_get_tmp_dir (), G_DIR_SEPARATOR, game_game_get_name (game),
+ file = g_strdup_printf ("%s%c%s.replay",
+ g_get_tmp_dir (), G_DIR_SEPARATOR, game_game_get_name (game));
+ str = g_strdup_printf ("%s%c%s%c%s%c%lu",
game_get_high_score_dir (), G_DIR_SEPARATOR,
game_game_get_name (game), G_DIR_SEPARATOR,
game_get_current_user (), G_DIR_SEPARATOR,
game_high_score_get_date (window->local_scores, pos - 1));
- system (file);
+ game_file_copy (file, str);
g_free (file);
+ g_free (str);
file = g_strdup_printf ("%s%c%s%c%s.score", game_get_high_score_dir (), G_DIR_SEPARATOR,
game_game_get_name (window->game), G_DIR_SEPARATOR,
game_get_current_user ());
diff --git a/po/de.po b/po/de.po
index f87e5ea..7d46808 100644
--- a/po/de.po
+++ b/po/de.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: libgame\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2003-10-22 05:15+0200\n"
+"POT-Creation-Date: 2003-10-23 23:04+0200\n"
"PO-Revision-Date: 2003-10-10 02:31+0200\n"
"Last-Translator: BENJAMIN OTTE <in7y118@public.uni-hamburg.de>\n"
"Language-Team: German <gnome-de@gnome.org>\n"
@@ -122,7 +122,7 @@ msgstr "Spielerinfo"
msgid "information about players"
msgstr "Informationen über Spieler"
-#: libgame/game-game.c:140 libgame/gnome-window.c:111
+#: libgame/game-game.c:140 libgame/gnome-window.c:107
msgid "max players"
msgstr "maximale Spieler"
@@ -215,7 +215,7 @@ msgstr "Anzahl"
msgid "current number of entries"
msgstr "aktuelle Anzahl von Einträgen"
-#: libgame/game-recorder.c:102 libgame/gnome-window.c:114
+#: libgame/game-recorder.c:102 libgame/gnome-window.c:110
msgid "game"
msgstr "Spiel"
@@ -231,79 +231,79 @@ msgstr "nimmt auf"
msgid "if the game is recorded"
msgstr "ob das Spiel aufgenommen wird"
-#: libgame/gnome-window.c:111
+#: libgame/gnome-window.c:107
msgid "maximum number of supported local players"
msgstr "maximale Anzahl von lokalen Spielern"
-#: libgame/gnome-window.c:114
+#: libgame/gnome-window.c:110
msgid "game this window is used for"
msgstr "Spiel für das dieses Fenster verwendet wird"
-#: libgame/gnome-window.c:158
+#: libgame/gnome-window.c:154
#, c-format
msgid "'%s' is not a valid replay."
msgstr "'%s' ist keine gültige Wiederholung."
-#: libgame/gnome-window.c:172
+#: libgame/gnome-window.c:168
msgid "Select a replay to watch"
msgstr "Wählen Sie eine Wiederholung zum Ansehen aus"
-#: libgame/gnome-window.c:237
+#: libgame/gnome-window.c:233
msgid "Global Highscores"
msgstr "Globale Bestleistungen"
-#: libgame/gnome-window.c:250
+#: libgame/gnome-window.c:246
msgid "My Highscores"
msgstr "Meine Bestleistungen"
-#: libgame/gnome-window.c:319
+#: libgame/gnome-window.c:313
msgid "Save the game you just played?"
msgstr "Möchten Sie das gerade beendetes Spiel abspeichern"
-#: libgame/gnome-window.c:325
+#: libgame/gnome-window.c:319
msgid "Save Replay as"
msgstr "Wiederholung speichern als"
#. file menu
-#: libgame/gnome-window.c:349
+#: libgame/gnome-window.c:343
msgid "_File"
msgstr "_Datei"
-#: libgame/gnome-window.c:354
+#: libgame/gnome-window.c:348
msgid "New _Single Player Game"
msgstr "Neues Einzel_spieler Spiel"
-#: libgame/gnome-window.c:358 libgame/gnome-highscore.c:186
+#: libgame/gnome-window.c:352 libgame/gnome-highscore.c:186
msgid "Watch _Replay"
msgstr "_Wiederholung ansehen"
-#: libgame/gnome-window.c:362
+#: libgame/gnome-window.c:356
msgid "_Pause Game"
msgstr "_Pause"
-#: libgame/gnome-window.c:366
+#: libgame/gnome-window.c:360
msgid "_End Game"
msgstr "Spiel be_enden"
#. view menu
-#: libgame/gnome-window.c:375
+#: libgame/gnome-window.c:369
msgid "_View"
msgstr "_Ansicht"
-#: libgame/gnome-window.c:380
+#: libgame/gnome-window.c:374
msgid "View _Global Highscores"
msgstr "_Globale Bestleistungen ansehen"
-#: libgame/gnome-window.c:384
+#: libgame/gnome-window.c:378
msgid "View _My Highscores"
msgstr "_Meine Bestleistungen ansehen"
#. configuration menu
-#: libgame/gnome-window.c:389
+#: libgame/gnome-window.c:383
msgid "_Configuration"
msgstr "_Konfiguration"
-#: libgame/gnome-window.c:394
+#: libgame/gnome-window.c:388
msgid "_Keyboard"
msgstr "_Tastatur"