1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* Copyright (C) 2003 Benjamin Otte <otte@gnome.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
#ifndef __GAME_PORTABLE_H__
#define __GAME_PORTABLE_H__
#include <glib.h>
#include <glib/gstdio.h>
G_BEGIN_DECLS
/* stuff that should be in gnet */
void game_gnet_set_nodelay (GIOChannel *channel);
gboolean game_gnet_set_nonblock (GIOChannel *channel);
/* stuff to get the right directories */
#ifdef G_OS_WIN32
#define GAME_PERMISSION_REPLAY (-1)
#define GAME_PERMISSION_REPLAY_DIR (-1)
#else
#define GAME_PERMISSION_REPLAY (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
#define GAME_PERMISSION_REPLAY_DIR (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
#endif
const char * game_get_plugin_dir (void);
const char * game_get_high_score_dir (void);
const char * game_get_data_dir (void);
gboolean game_file_copy (const gchar * from,
const gchar * to);
glong game_time_val_difference (GTimeVal * to,
GTimeVal * from);
/* stupid macros go here for now */
#define GAME_STRUCT_AS_TYPE(StructName, struct_name) \
static gpointer \
struct_name ## _copy (gpointer src) \
{ \
return g_memdup (src, sizeof (StructName)); \
} \
\
GType \
struct_name ## _get_type (void) \
{ \
static GType type = 0; \
\
if (type == 0) \
type = g_boxed_type_register_static (G_STRINGIFY (StructName), \
struct_name ## _copy, g_free); \
\
return type; \
}
G_END_DECLS
#endif /* __GAME_PORTABLE_H__ */
|