projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed compiler warnings (after adding "-Wstrict-prototypes")
[rocksndiamonds.git]
/
src
/
libgame
/
misc.c
diff --git
a/src/libgame/misc.c
b/src/libgame/misc.c
index fb265fab44a1c633590580a7c81949be7682577b..48fd6e129f6dd860c002d43c6a1505a7c33e1c14 100644
(file)
--- a/
src/libgame/misc.c
+++ b/
src/libgame/misc.c
@@
-336,7
+336,7
@@
boolean getTokenValueFromString(char *string, char **token, char **value)
/* maximal allowed length of a command line option */
#define MAX_OPTION_LEN 256
/* maximal allowed length of a command line option */
#define MAX_OPTION_LEN 256
-static unsigned int getCurrentMS()
+static unsigned int getCurrentMS(
void
)
{
return SDL_GetTicks();
}
{
return SDL_GetTicks();
}
@@
-558,7
+558,7
@@
static char *get_corrected_real_name(char *real_name)
}
#endif
}
#endif
-char *getLoginName()
+char *getLoginName(
void
)
{
static char *login_name = NULL;
{
static char *login_name = NULL;
@@
-588,7
+588,7
@@
char *getLoginName()
return login_name;
}
return login_name;
}
-char *getRealName()
+char *getRealName(
void
)
{
static char *real_name = NULL;
{
static char *real_name = NULL;
@@
-1141,7
+1141,7
@@
void SetError(char *format, ...)
va_end(ap);
}
va_end(ap);
}
-char *GetError()
+char *GetError(
void
)
{
return internal_error;
}
{
return internal_error;
}
@@
-1516,6
+1516,10
@@
void translate_keyname(Key *keysym, char **x11name, char **name, int mode)
char *name;
} translate_key[] =
{
char *name;
} translate_key[] =
{
+ /* return and escape keys */
+ { KSYM_Return, "XK_Return", "return" },
+ { KSYM_Escape, "XK_Escape", "escape" },
+
/* normal cursor keys */
{ KSYM_Left, "XK_Left", "cursor left" },
{ KSYM_Right, "XK_Right", "cursor right" },
/* normal cursor keys */
{ KSYM_Left, "XK_Left", "cursor left" },
{ KSYM_Right, "XK_Right", "cursor right" },
@@
-2039,12
+2043,37
@@
int get_switch3_from_string(char *s)
return result;
}
return result;
}
+int get_player_nr_from_string(char *s)
+{
+ static char *player_text[] =
+ {
+ "player_1",
+ "player_2",
+ "player_3",
+ "player_4",
+
+ NULL
+ };
+
+ char *s_lower = getStringToLower(s);
+ int result = 0;
+ int i;
+
+ for (i = 0; player_text[i] != NULL; i++)
+ if (strEqual(s_lower, player_text[i]))
+ result = i;
+
+ free(s_lower);
+
+ return result;
+}
+
/* ------------------------------------------------------------------------- */
/* functions for generic lists */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* functions for generic lists */
/* ------------------------------------------------------------------------- */
-ListNode *newListNode()
+ListNode *newListNode(
void
)
{
return checked_calloc(sizeof(ListNode));
}
{
return checked_calloc(sizeof(ListNode));
}
@@
-2819,6
+2848,14
@@
int get_anim_action_parameter_value(char *token)
checked_free(gfx_token);
}
checked_free(gfx_token);
}
+ if (result == -1)
+ {
+ Key key = getKeyFromX11KeyName(token);
+
+ if (key != KSYM_UNDEFINED)
+ result = -(int)key;
+ }
+
if (result == -1)
result = ANIM_EVENT_ACTION_NONE;
if (result == -1)
result = ANIM_EVENT_ACTION_NONE;
@@
-2909,7
+2946,7
@@
int get_parameter_value(char *value_raw, char *suffix, int type)
else if (strEqual(suffix, ".init_event_action") ||
strEqual(suffix, ".anim_event_action"))
{
else if (strEqual(suffix, ".init_event_action") ||
strEqual(suffix, ".anim_event_action"))
{
- result = get_anim_action_parameter_value(value);
+ result = get_anim_action_parameter_value(value
_raw
);
}
else if (strEqual(suffix, ".class"))
{
}
else if (strEqual(suffix, ".class"))
{
@@
-3840,7
+3877,7
@@
char *getLogFilename(char *basename)
return getPath2(getUserGameDataDir(), basename);
}
return getPath2(getUserGameDataDir(), basename);
}
-void OpenLogFiles()
+void OpenLogFiles(
void
)
{
int i;
{
int i;
@@
-3862,7
+3899,7
@@
void OpenLogFiles()
}
}
}
}
-void CloseLogFiles()
+void CloseLogFiles(
void
)
{
int i;
{
int i;
@@
-3884,7
+3921,7
@@
void DumpLogFile(int nr)
fclose(log_file);
}
fclose(log_file);
}
-void NotifyUserAboutErrorFile()
+void NotifyUserAboutErrorFile(
void
)
{
#if defined(PLATFORM_WIN32)
char *title_text = getStringCat2(program.program_title, " Error Message");
{
#if defined(PLATFORM_WIN32)
char *title_text = getStringCat2(program.program_title, " Error Message");
@@
-3911,7
+3948,7
@@
void NotifyUserAboutErrorFile()
#define DEBUG_TIME_IN_MICROSECONDS 0
#if DEBUG_TIME_IN_MICROSECONDS
#define DEBUG_TIME_IN_MICROSECONDS 0
#if DEBUG_TIME_IN_MICROSECONDS
-static double Counter_Microseconds()
+static double Counter_Microseconds(
void
)
{
static struct timeval base_time = { 0, 0 };
struct timeval current_time;
{
static struct timeval base_time = { 0, 0 };
struct timeval current_time;