projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
311daa0
)
removed duplicate function to check for string suffix
author
Holger Schemel
<info@artsoft.org>
Mon, 14 Sep 2020 14:56:43 +0000
(16:56 +0200)
committer
Holger Schemel
<info@artsoft.org>
Mon, 14 Sep 2020 14:56:43 +0000
(16:56 +0200)
src/events.c
patch
|
blob
|
history
diff --git
a/src/events.c
b/src/events.c
index 0643e1642c3a77ff7c33ded51282c0c9b1167af1..d912e8206f80834dda3e85e2cebcff2f6d729e2f 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-1780,17
+1780,6
@@
void HandleButton(int mx, int my, int button, int button_nr)
}
}
}
}
-static boolean is_string_suffix(char *string, char *suffix)
-{
- int string_len = strlen(string);
- int suffix_len = strlen(suffix);
-
- if (suffix_len > string_len)
- return FALSE;
-
- return (strEqual(&string[string_len - suffix_len], suffix));
-}
-
#define MAX_CHEAT_INPUT_LEN 32
static void HandleKeysSpecial(Key key)
#define MAX_CHEAT_INPUT_LEN 32
static void HandleKeysSpecial(Key key)
@@
-1820,54
+1809,54
@@
static void HandleKeysSpecial(Key key)
if (game_status == GAME_MODE_MAIN)
{
if (game_status == GAME_MODE_MAIN)
{
- if (
is_string_s
uffix(cheat_input, ":insert-solution-tape") ||
-
is_string_s
uffix(cheat_input, ":ist"))
+ if (
strS
uffix(cheat_input, ":insert-solution-tape") ||
+
strS
uffix(cheat_input, ":ist"))
{
InsertSolutionTape();
}
{
InsertSolutionTape();
}
- else if (
is_string_s
uffix(cheat_input, ":play-solution-tape") ||
-
is_string_s
uffix(cheat_input, ":pst"))
+ else if (
strS
uffix(cheat_input, ":play-solution-tape") ||
+
strS
uffix(cheat_input, ":pst"))
{
PlaySolutionTape();
}
{
PlaySolutionTape();
}
- else if (
is_string_s
uffix(cheat_input, ":reload-graphics") ||
-
is_string_s
uffix(cheat_input, ":rg"))
+ else if (
strS
uffix(cheat_input, ":reload-graphics") ||
+
strS
uffix(cheat_input, ":rg"))
{
ReloadCustomArtwork(1 << ARTWORK_TYPE_GRAPHICS);
DrawMainMenu();
}
{
ReloadCustomArtwork(1 << ARTWORK_TYPE_GRAPHICS);
DrawMainMenu();
}
- else if (
is_string_s
uffix(cheat_input, ":reload-sounds") ||
-
is_string_s
uffix(cheat_input, ":rs"))
+ else if (
strS
uffix(cheat_input, ":reload-sounds") ||
+
strS
uffix(cheat_input, ":rs"))
{
ReloadCustomArtwork(1 << ARTWORK_TYPE_SOUNDS);
DrawMainMenu();
}
{
ReloadCustomArtwork(1 << ARTWORK_TYPE_SOUNDS);
DrawMainMenu();
}
- else if (
is_string_s
uffix(cheat_input, ":reload-music") ||
-
is_string_s
uffix(cheat_input, ":rm"))
+ else if (
strS
uffix(cheat_input, ":reload-music") ||
+
strS
uffix(cheat_input, ":rm"))
{
ReloadCustomArtwork(1 << ARTWORK_TYPE_MUSIC);
DrawMainMenu();
}
{
ReloadCustomArtwork(1 << ARTWORK_TYPE_MUSIC);
DrawMainMenu();
}
- else if (
is_string_s
uffix(cheat_input, ":reload-artwork") ||
-
is_string_s
uffix(cheat_input, ":ra"))
+ else if (
strS
uffix(cheat_input, ":reload-artwork") ||
+
strS
uffix(cheat_input, ":ra"))
{
ReloadCustomArtwork(1 << ARTWORK_TYPE_GRAPHICS |
1 << ARTWORK_TYPE_SOUNDS |
1 << ARTWORK_TYPE_MUSIC);
DrawMainMenu();
}
{
ReloadCustomArtwork(1 << ARTWORK_TYPE_GRAPHICS |
1 << ARTWORK_TYPE_SOUNDS |
1 << ARTWORK_TYPE_MUSIC);
DrawMainMenu();
}
- else if (
is_string_s
uffix(cheat_input, ":dump-level") ||
-
is_string_s
uffix(cheat_input, ":dl"))
+ else if (
strS
uffix(cheat_input, ":dump-level") ||
+
strS
uffix(cheat_input, ":dl"))
{
DumpLevel(&level);
}
{
DumpLevel(&level);
}
- else if (
is_string_s
uffix(cheat_input, ":dump-tape") ||
-
is_string_s
uffix(cheat_input, ":dt"))
+ else if (
strS
uffix(cheat_input, ":dump-tape") ||
+
strS
uffix(cheat_input, ":dt"))
{
DumpTape(&tape);
}
{
DumpTape(&tape);
}
- else if (
is_string_s
uffix(cheat_input, ":fix-tape") ||
-
is_string_s
uffix(cheat_input, ":ft"))
+ else if (
strS
uffix(cheat_input, ":fix-tape") ||
+
strS
uffix(cheat_input, ":ft"))
{
/* fix single-player tapes that contain player input for more than one
player (due to a bug in 3.3.1.2 and earlier versions), which results
{
/* fix single-player tapes that contain player input for more than one
player (due to a bug in 3.3.1.2 and earlier versions), which results
@@
-1880,13
+1869,13
@@
static void HandleKeysSpecial(Key key)
tape.changed = TRUE;
}
tape.changed = TRUE;
}
- else if (
is_string_s
uffix(cheat_input, ":save-native-level") ||
-
is_string_s
uffix(cheat_input, ":snl"))
+ else if (
strS
uffix(cheat_input, ":save-native-level") ||
+
strS
uffix(cheat_input, ":snl"))
{
SaveNativeLevel(&level);
}
{
SaveNativeLevel(&level);
}
- else if (
is_string_s
uffix(cheat_input, ":frames-per-second") ||
-
is_string_s
uffix(cheat_input, ":fps"))
+ else if (
strS
uffix(cheat_input, ":frames-per-second") ||
+
strS
uffix(cheat_input, ":fps"))
{
global.show_frames_per_second = !global.show_frames_per_second;
}
{
global.show_frames_per_second = !global.show_frames_per_second;
}
@@
-1894,18
+1883,18
@@
static void HandleKeysSpecial(Key key)
else if (game_status == GAME_MODE_PLAYING)
{
#ifdef DEBUG
else if (game_status == GAME_MODE_PLAYING)
{
#ifdef DEBUG
- if (
is_string_s
uffix(cheat_input, ".q"))
+ if (
strS
uffix(cheat_input, ".q"))
DEBUG_SetMaximumDynamite();
#endif
}
else if (game_status == GAME_MODE_EDITOR)
{
DEBUG_SetMaximumDynamite();
#endif
}
else if (game_status == GAME_MODE_EDITOR)
{
- if (
is_string_s
uffix(cheat_input, ":dump-brush") ||
-
is_string_s
uffix(cheat_input, ":DB"))
+ if (
strS
uffix(cheat_input, ":dump-brush") ||
+
strS
uffix(cheat_input, ":DB"))
{
DumpBrush();
}
{
DumpBrush();
}
- else if (
is_string_s
uffix(cheat_input, ":DDB"))
+ else if (
strS
uffix(cheat_input, ":DDB"))
{
DumpBrush_Small();
}
{
DumpBrush_Small();
}
@@
-1935,9
+1924,9
@@
static void HandleKeysSpecial(Key key)
}
// special key shortcuts for all game modes
}
// special key shortcuts for all game modes
- if (
is_string_s
uffix(cheat_input, ":dump-event-actions") ||
-
is_string_s
uffix(cheat_input, ":dea") ||
-
is_string_s
uffix(cheat_input, ":DEA"))
+ if (
strS
uffix(cheat_input, ":dump-event-actions") ||
+
strS
uffix(cheat_input, ":dea") ||
+
strS
uffix(cheat_input, ":DEA"))
{
DumpGadgetIdentifiers();
DumpScreenIdentifiers();
{
DumpGadgetIdentifiers();
DumpScreenIdentifiers();