aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-09-08 21:06:52 -0700
committerPaul Gilbert2019-09-25 20:13:27 -0700
commitc147d0fda0a9607fe5ecbcaeea87533f84402e71 (patch)
tree0348f44f78feb661c088ae90dabb7d11ac4544c7 /engines
parentac9b8fd43d75aca937a32e581e06019833776248 (diff)
downloadscummvm-rg350-c147d0fda0a9607fe5ecbcaeea87533f84402e71.tar.gz
scummvm-rg350-c147d0fda0a9607fe5ecbcaeea87533f84402e71.tar.bz2
scummvm-rg350-c147d0fda0a9607fe5ecbcaeea87533f84402e71.zip
GLK: ADRIFT: Formatting
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/adrift/os_glk.cpp241
-rw-r--r--engines/glk/adrift/scdebug.cpp193
-rw-r--r--engines/glk/adrift/scevents.cpp45
-rw-r--r--engines/glk/adrift/scexpr.cpp94
-rw-r--r--engines/glk/adrift/scgamest.cpp235
-rw-r--r--engines/glk/adrift/scinterf.cpp230
-rw-r--r--engines/glk/adrift/sclibrar.cpp1041
-rw-r--r--engines/glk/adrift/sclocale.cpp87
-rw-r--r--engines/glk/adrift/scmemos.cpp73
-rw-r--r--engines/glk/adrift/scnpcs.cpp38
-rw-r--r--engines/glk/adrift/scobjcts.cpp98
-rw-r--r--engines/glk/adrift/scparser.cpp150
-rw-r--r--engines/glk/adrift/scprintf.cpp112
-rw-r--r--engines/glk/adrift/scprops.cpp91
-rw-r--r--engines/glk/adrift/scprotos.h15
-rw-r--r--engines/glk/adrift/scresour.cpp27
-rw-r--r--engines/glk/adrift/screstrs.cpp83
-rw-r--r--engines/glk/adrift/scrunner.cpp159
-rw-r--r--engines/glk/adrift/scserial.cpp47
-rw-r--r--engines/glk/adrift/sctaffil.cpp69
-rw-r--r--engines/glk/adrift/sctafpar.cpp180
-rw-r--r--engines/glk/adrift/sctasks.cpp72
-rw-r--r--engines/glk/adrift/scutils.cpp54
-rw-r--r--engines/glk/adrift/scvars.cpp133
-rw-r--r--engines/glk/adrift/sxfile.cpp12
-rw-r--r--engines/glk/adrift/sxglob.cpp18
-rw-r--r--engines/glk/adrift/sxscript.cpp58
-rw-r--r--engines/glk/adrift/sxtester.cpp3
-rw-r--r--engines/glk/adrift/sxutils.cpp18
29 files changed, 1241 insertions, 2435 deletions
diff --git a/engines/glk/adrift/os_glk.cpp b/engines/glk/adrift/os_glk.cpp
index 37ac07f941..cfe61acae6 100644
--- a/engines/glk/adrift/os_glk.cpp
+++ b/engines/glk/adrift/os_glk.cpp
@@ -62,23 +62,20 @@ namespace Adrift {
static const glui32 GSC_PORT_VERSION = 0x00010310;
/* Two windows, one for the main text, and one for a status line. */
-static winid_t gsc_main_window = nullptr,
- gsc_status_window = nullptr;
+static winid_t gsc_main_window = nullptr, gsc_status_window = nullptr;
/*
* Transcript stream and input log. These are nullptr if there is no current
* collection of these strings.
*/
-static strid_t gsc_transcript_stream = nullptr,
- gsc_inputlog_stream = nullptr;
+static strid_t gsc_transcript_stream = nullptr, gsc_inputlog_stream = nullptr;
/* Input read log stream, for reading back an input log. */
static strid_t gsc_readlog_stream = nullptr;
/* Options that may be turned off or set by command line flags. */
-static int gsc_commands_enabled = TRUE,
- gsc_abbreviations_enabled = TRUE,
- gsc_unicode_enabled = TRUE;
+static int gsc_commands_enabled = TRUE, gsc_abbreviations_enabled = TRUE,
+ gsc_unicode_enabled = TRUE;
/* Adrift game to interpret. */
static sc_game gsc_game = nullptr;
@@ -86,7 +83,7 @@ static sc_game gsc_game = nullptr;
/* Special out-of-band os_confirm() options used locally with os_glk. */
static const sc_int GSC_CONF_SUBTLE_HINT = INT_MAX,
GSC_CONF_UNSUBTLE_HINT = INT_MAX - 1,
- GSC_CONF_CONTINUE_HINTS = INT_MAX - 2;
+ GSC_CONF_CONTINUE_HINTS = INT_MAX - 2;
/* Forward declaration of event wait functions, and a short delay. */
static void gsc_event_wait_2(glui32 wait_type_1,
@@ -105,8 +102,7 @@ static void gsc_short_delay();
* Fatal error handler. The function returns, expecting the caller to
* abort() or otherwise handle the error.
*/
-static void
-gsc_fatal(const char *string) {
+static void gsc_fatal(const char *string) {
/*
* If the failure happens too early for us to have a window, print
* the message to stderr.
@@ -136,8 +132,7 @@ gsc_fatal(const char *string) {
*
* Non-failing malloc; call gsc_fatal and exit if memory allocation fails.
*/
-static void *
-gsc_malloc(size_t size) {
+static void *gsc_malloc(size_t size) {
void *pointer;
pointer = malloc(size > 0 ? size : 1);
@@ -166,20 +161,20 @@ static const glui32 GSC_ISO_8859_EQUIVALENCE = 256;
* codepages where they're not (dingbats, for example).
*/
enum { GSC_TABLE_SIZE = 256 };
-typedef struct {
+struct gsc_codepages_t {
const glui32 unicode[GSC_TABLE_SIZE];
const sc_char *const ascii[GSC_TABLE_SIZE];
-} gsc_codepages_t;
+};
/*
* Locale contains a name and a pair of codepage structures, a main one and
* an alternate. The latter is intended for monospaced output.
*/
-typedef struct {
+struct gsc_locale_t {
const sc_char *const name;
const gsc_codepages_t main;
const gsc_codepages_t alternate;
-} gsc_locale_t;
+};
/*
@@ -513,8 +508,7 @@ static const gsc_locale_t *const gsc_fallback_locale = &GSC_LATIN1_LOCALE;
*
* Set a locale explicitly from the name passed in.
*/
-static void
-gsc_set_locale(const sc_char *name) {
+static void gsc_set_locale(const sc_char *name) {
const gsc_locale_t *matched = nullptr;
const gsc_locale_t *const *iterator;
assert(name);
@@ -544,8 +538,7 @@ gsc_set_locale(const sc_char *name) {
* Wrapper around g_vm->glk_put_char_uni(). Handles, inelegantly, the problem of
* having to write transcripts as ascii.
*/
-static void
-gsc_put_char_uni(glui32 unicode, const char *ascii) {
+static void gsc_put_char_uni(glui32 unicode, const char *ascii) {
/* If there is an transcript stream, temporarily disconnect it. */
if (gsc_transcript_stream)
g_vm->glk_window_set_echo_stream(gsc_main_window, nullptr);
@@ -570,9 +563,7 @@ gsc_put_char_uni(glui32 unicode, const char *ascii) {
* Write a single character using the supplied locale. Select either the
* main or the alternate codepage depending on the flag passed in.
*/
-static void
-gsc_put_char_locale(sc_char ch,
- const gsc_locale_t *locale, sc_bool is_alternate) {
+static void gsc_put_char_locale(sc_char ch, const gsc_locale_t *locale, sc_bool is_alternate) {
const gsc_codepages_t *codepage;
unsigned char character;
glui32 unicode;
@@ -657,47 +648,40 @@ gsc_put_char_locale(sc_char ch,
*
* Public functions for writing using the current or fallback locale.
*/
-static void
-gsc_put_char(const sc_char character) {
+static void gsc_put_char(const sc_char character) {
const gsc_locale_t *locale;
locale = gsc_locale ? gsc_locale : gsc_fallback_locale;
gsc_put_char_locale(character, locale, FALSE);
}
-static void
-gsc_put_char_alternate(const sc_char character) {
+static void gsc_put_char_alternate(const sc_char character) {
const gsc_locale_t *locale;
locale = gsc_locale ? gsc_locale : gsc_fallback_locale;
gsc_put_char_locale(character, locale, TRUE);
}
-static void
-gsc_put_buffer_using(const sc_char *buffer,
- sc_int length, void (*putchar_function)(sc_char)) {
+static void gsc_put_buffer_using(const sc_char *buffer, sc_int length, void (*putchar_function)(sc_char)) {
sc_int index_;
for (index_ = 0; index_ < length; index_++)
putchar_function(buffer[index_]);
}
-static void
-gsc_put_buffer(const sc_char *buffer, sc_int length) {
+static void gsc_put_buffer(const sc_char *buffer, sc_int length) {
assert(buffer);
gsc_put_buffer_using(buffer, length, gsc_put_char);
}
-static void
-gsc_put_string(const sc_char *string) {
+static void gsc_put_string(const sc_char *string) {
assert(string);
gsc_put_buffer_using(string, strlen(string), gsc_put_char);
}
-static void
-gsc_put_string_alternate(const sc_char *string) {
+static void gsc_put_string_alternate(const sc_char *string) {
assert(string);
gsc_put_buffer_using(string, strlen(string), gsc_put_char_alternate);
@@ -712,8 +696,7 @@ gsc_put_string_alternate(const sc_char *string) {
* reverse translations in line input. Returns '?' if there is no translation
* available.
*/
-static sc_char
-gsc_unicode_to_locale(glui32 unicode, const gsc_locale_t *locale) {
+static sc_char gsc_unicode_to_locale(glui32 unicode, const gsc_locale_t *locale) {
const gsc_codepages_t *codepage;
sc_int character;
@@ -733,9 +716,8 @@ gsc_unicode_to_locale(glui32 unicode, const gsc_locale_t *locale) {
return character < GSC_TABLE_SIZE ? (sc_char) character : '?';
}
-static void
-gsc_unicode_buffer_to_locale(const glui32 *unicode, sc_int length,
- sc_char *buffer, const gsc_locale_t *locale) {
+static void gsc_unicode_buffer_to_locale(const glui32 *unicode, sc_int length,
+ sc_char *buffer, const gsc_locale_t *locale) {
sc_int index_;
for (index_ = 0; index_ < length; index_++)
@@ -749,9 +731,7 @@ gsc_unicode_buffer_to_locale(const glui32 *unicode, sc_int length,
* Read in a line and translate out of the given locale. Returns the count
* of characters placed in the buffer.
*/
-static sc_int
-gsc_read_line_locale(sc_char *buffer,
- sc_int length, const gsc_locale_t *locale) {
+static sc_int gsc_read_line_locale(sc_char *buffer, sc_int length, const gsc_locale_t *locale) {
event_t event;
/*
@@ -791,8 +771,7 @@ gsc_read_line_locale(sc_char *buffer,
*
* Public function for reading using the current or fallback locale.
*/
-static sc_int
-gsc_read_line(sc_char *buffer, sc_int length) {
+static sc_int gsc_read_line(sc_char *buffer, sc_int length) {
const gsc_locale_t *locale;
locale = gsc_locale ? gsc_locale : gsc_fallback_locale;
@@ -824,8 +803,7 @@ static const sc_char *const GSC_WHITESPACE = "\t\n\v\f\r ";
* Return TRUE if string is non-null, not zero-length or contains characters
* other than whitespace.
*/
-static sc_bool
-gsc_is_string_usable(const sc_char *string) {
+static sc_bool gsc_is_string_usable(const sc_char *string) {
/* If non-null, scan for any non-space character. */
if (string) {
sc_int index_;
@@ -847,8 +825,7 @@ gsc_is_string_usable(const sc_char *string) {
* Update the status line from the current game state. This is for windowing
* Glk libraries.
*/
-static void
-gsc_status_update() {
+static void gsc_status_update() {
glui32 width, height;
uint index;
assert(gsc_status_window);
@@ -913,8 +890,7 @@ gsc_status_update() {
* Helper for gsc_status_print(), concatenates strings only up to the
* available length.
*/
-static void
-gsc_status_safe_strcat(char *dest, size_t length, const char *src) {
+static void gsc_status_safe_strcat(char *dest, size_t length, const char *src) {
size_t available, src_length;
/* Append only as many characters as will fit. */
@@ -932,8 +908,7 @@ gsc_status_safe_strcat(char *dest, size_t length, const char *src) {
* main window, if it has changed since the last call. This is for non-
* windowing Glk libraries.
*/
-static void
-gsc_status_print() {
+static void gsc_status_print() {
static char current_status[GSC_STATUS_BUFFER_LENGTH + 1];
const sc_char *room;
@@ -980,8 +955,7 @@ gsc_status_print() {
* Front end function for updating status. Either updates the status window
* or prints the status line to the main window.
*/
-static void
-gsc_status_notify() {
+static void gsc_status_notify() {
if (gsc_status_window)
gsc_status_update();
else
@@ -996,8 +970,7 @@ gsc_status_notify() {
* This function should be called on the appropriate Glk window resize and
* arrange events.
*/
-static void
-gsc_status_redraw() {
+static void gsc_status_redraw() {
if (gsc_status_window) {
winid_t parent;
@@ -1031,10 +1004,10 @@ static int gsc_help_requested = FALSE,
gsc_help_hints_silenced = FALSE;
/* Font descriptor type, encapsulating size and monospaced boolean. */
-typedef struct {
+struct gsc_font_size_t {
sc_bool is_monospaced;
sc_int size;
-} gsc_font_size_t;
+};
/* Font stack and attributes for nesting tags. */
enum { GSC_MAX_STYLE_NESTING = 32 };
@@ -1070,18 +1043,15 @@ static const glui32 GSC_CANCEL_WAIT_1 = ' ',
* Register a request for help, and print a note of how to get Glk command
* help from the interpreter unless silenced.
*/
-static void
-gsc_output_register_help_request() {
+static void gsc_output_register_help_request() {
gsc_help_requested = TRUE;
}
-static void
-gsc_output_silence_help_hints() {
+static void gsc_output_silence_help_hints() {
gsc_help_hints_silenced = TRUE;
}
-static void
-gsc_output_provide_help_hint() {
+static void gsc_output_provide_help_hint() {
if (gsc_help_requested && !gsc_help_hints_silenced) {
g_vm->glk_set_style(style_Emphasized);
g_vm->glk_put_string("[Try 'glk help' for help on special interpreter"
@@ -1160,8 +1130,7 @@ static void gsc_set_glk_style() {
* Push the settings of a font tag onto the font stack, and pop on end of
* font tag. Set the appropriate Glk style.
*/
-static void
-gsc_handle_font_tag(const sc_char *argument) {
+static void gsc_handle_font_tag(const sc_char *argument) {
/* Ignore the call on stack overrun. */
if (gsc_font_index < GSC_MAX_STYLE_NESTING) {
sc_char *lower, *face, *size;
@@ -1222,8 +1191,7 @@ gsc_handle_font_tag(const sc_char *argument) {
}
}
-static void
-gsc_handle_endfont_tag() {
+static void gsc_handle_endfont_tag() {
/* Unless underrun, pop the font stack and set Glk style. */
if (gsc_font_index > 0) {
gsc_font_index--;
@@ -1238,8 +1206,7 @@ gsc_handle_endfont_tag() {
* Increment the required attribute nesting counter, or decrement on end
* tag. Set the appropriate Glk style.
*/
-static void
-gsc_handle_attribute_tag(sc_int tag) {
+static void gsc_handle_attribute_tag(sc_int tag) {
/*
* Increment the required attribute nesting counter, and set Glk style.
*/
@@ -1262,8 +1229,7 @@ gsc_handle_attribute_tag(sc_int tag) {
gsc_set_glk_style();
}
-static void
-gsc_handle_endattribute_tag(sc_int tag) {
+static void gsc_handle_endattribute_tag(sc_int tag) {
/*
* Decrement the required attribute nesting counter, unless underrun, and
* set Glk style.
@@ -1356,8 +1322,7 @@ static void gsc_handle_wait_tag(const sc_char *argument) {
* Drop all stacked fonts and nested attributes, and return to normal Glk
* style.
*/
-static void
-gsc_reset_glk_style() {
+static void gsc_reset_glk_style() {
/* Reset the font stack and attributes, and set a normal style. */
gsc_font_index = 0;
gsc_attribute_bold = 0;
@@ -1374,8 +1339,7 @@ gsc_reset_glk_style() {
* Interpret selected Adrift output control tags. Not all are implemented
* here; several are ignored.
*/
-void
-os_print_tag(sc_int tag, const sc_char *argument) {
+void os_print_tag(sc_int tag, const sc_char *argument) {
event_t event;
assert(argument);
@@ -1495,8 +1459,7 @@ void os_print_string(const sc_char *string) {
* Debugging output goes to the main Glk window -- no special effects or
* dedicated debugging window attempted.
*/
-void
-os_print_string_debug(const sc_char *string) {
+void os_print_string_debug(const sc_char *string) {
assert(string);
assert(g_vm->glk_stream_get_current());
@@ -1516,8 +1479,7 @@ os_print_string_debug(const sc_char *string) {
* Convenience functions to print strings in assorted styles. A standout
* string is one that hints that it's from the interpreter, not the game.
*/
-static void
-gsc_styled_string(glui32 style, const char *message) {
+static void gsc_styled_string(glui32 style, const char *message) {
assert(message);
g_vm->glk_set_style(style);
@@ -1525,8 +1487,7 @@ gsc_styled_string(glui32 style, const char *message) {
g_vm->glk_set_style(style_Normal);
}
-static void
-gsc_styled_char(glui32 style, char c) {
+static void gsc_styled_char(glui32 style, char c) {
char buffer[2];
buffer[0] = c;
@@ -1534,28 +1495,23 @@ gsc_styled_char(glui32 style, char c) {
gsc_styled_string(style, buffer);
}
-static void
-gsc_standout_string(const char *message) {
+static void gsc_standout_string(const char *message) {
gsc_styled_string(style_Emphasized, message);
}
-static void
-gsc_standout_char(char c) {
+static void gsc_standout_char(char c) {
gsc_styled_char(style_Emphasized, c);
}
-static void
-gsc_normal_string(const char *message) {
+static void gsc_normal_string(const char *message) {
gsc_styled_string(style_Normal, message);
}
-static void
-gsc_normal_char(char c) {
+static void gsc_normal_char(char c) {
gsc_styled_char(style_Normal, c);
}
-static void
-gsc_header_string(const char *message) {
+static void gsc_header_string(const char *message) {
gsc_styled_string(style_Header, message);
}
@@ -1567,8 +1523,7 @@ gsc_header_string(const char *message) {
* hints at all, and those that do are usually sparse in what they hint at, so
* it's sort of good enough for the moment.
*/
-void
-os_display_hints(sc_game game) {
+void os_display_hints(sc_game game) {
sc_game_hint hint;
sc_int refused;
@@ -1628,9 +1583,7 @@ os_display_hints(sc_game game) {
*
* Stub functions. The unused variables defeat gcc warnings.
*/
-void
-os_play_sound(const sc_char *filepath,
- sc_int offset, sc_int length, sc_bool is_looping) {
+void os_play_sound(const sc_char *filepath, sc_int offset, sc_int length, sc_bool is_looping) {
const sc_char *unused1;
sc_int unused2, unused3;
sc_bool unused4;
@@ -1640,8 +1593,7 @@ os_play_sound(const sc_char *filepath,
unused4 = is_looping;
}
-void
-os_stop_sound() {
+void os_stop_sound() {
}
@@ -1659,8 +1611,7 @@ os_stop_sound() {
#ifdef LINUX_GRAPHICS
static int gsclinux_graphics_enabled = TRUE;
static char *gsclinux_game_file = nullptr;
-void
-os_show_graphic(const sc_char *filepath, sc_int offset, sc_int length) {
+void os_show_graphic(const sc_char *filepath, sc_int offset, sc_int length) {
const sc_char *unused1;
unused1 = filepath;
@@ -1687,8 +1638,7 @@ os_show_graphic(const sc_char *filepath, sc_int offset, sc_int length) {
}
}
#else
-void
-os_show_graphic(const sc_char *filepath, sc_int offset, sc_int length) {
+void os_show_graphic(const sc_char *filepath, sc_int offset, sc_int length) {
const sc_char *unused1;
sc_int unused2, unused3;
unused1 = filepath;
@@ -1707,8 +1657,7 @@ os_show_graphic(const sc_char *filepath, sc_int offset, sc_int length) {
*
* Turn game output scripting (logging) on and off.
*/
-static void
-gsc_command_script(const char *argument) {
+static void gsc_command_script(const char *argument) {
assert(argument);
if (sc_strcasecmp(argument, "on") == 0) {
@@ -1775,8 +1724,7 @@ gsc_command_script(const char *argument) {
*
* Turn game input logging on and off.
*/
-static void
-gsc_command_inputlog(const char *argument) {
+static void gsc_command_inputlog(const char *argument) {
assert(argument);
if (sc_strcasecmp(argument, "on") == 0) {
@@ -1839,8 +1787,7 @@ gsc_command_inputlog(const char *argument) {
*
* Set the game input log, to read input from a file.
*/
-static void
-gsc_command_readlog(const char *argument) {
+static void gsc_command_readlog(const char *argument) {
assert(argument);
if (sc_strcasecmp(argument, "on") == 0) {
@@ -1908,8 +1855,7 @@ gsc_command_readlog(const char *argument) {
*
* Turn abbreviation expansions on and off.
*/
-static void
-gsc_command_abbreviations(const char *argument) {
+static void gsc_command_abbreviations(const char *argument) {
assert(argument);
if (sc_strcasecmp(argument, "on") == 0) {
@@ -1954,8 +1900,7 @@ gsc_command_abbreviations(const char *argument) {
*
* Print out the Glk library version number.
*/
-static void
-gsc_command_print_version_number(glui32 version) {
+static void gsc_command_print_version_number(glui32 version) {
char buffer[64];
sprintf(buffer, "%lu.%lu.%lu",
@@ -1965,8 +1910,7 @@ gsc_command_print_version_number(glui32 version) {
gsc_normal_string(buffer);
}
-static void
-gsc_command_version(const char *argument) {
+static void gsc_command_version(const char *argument) {
glui32 version;
assert(argument);
@@ -1987,8 +1931,7 @@ gsc_command_version(const char *argument) {
* Turn command escapes off. Once off, there's no way to turn them back on.
* Commands must be on already to enter this function.
*/
-static void
-gsc_command_commands(const char *argument) {
+static void gsc_command_commands(const char *argument) {
assert(argument);
if (sc_strcasecmp(argument, "on") == 0) {
@@ -2021,8 +1964,7 @@ gsc_command_commands(const char *argument) {
*
* Print licensing terms.
*/
-static void
-gsc_command_license(const char *argument) {
+static void gsc_command_license(const char *argument) {
assert(argument);
gsc_normal_string("This program is free software; you can redistribute it"
@@ -2052,11 +1994,11 @@ gsc_command_license(const char *argument) {
/* Glk subcommands and handler functions. */
-typedef const struct {
+struct gsc_command_t {
const char *const command; /* Glk subcommand. */
void (* const handler)(const char *argument); /* Subcommand handler. */
const int takes_argument; /* Argument flag. */
-} gsc_command_t;
+};
typedef gsc_command_t *gsc_commandref_t;
static void gsc_command_summary(const char *argument);
@@ -2081,8 +2023,7 @@ static gsc_command_t GSC_COMMAND_TABLE[] = {
*
* Report all current Glk settings.
*/
-static void
-gsc_command_summary(const char *argument) {
+static void gsc_command_summary(const char *argument) {
gsc_commandref_t entry;
assert(argument);
@@ -2106,8 +2047,7 @@ gsc_command_summary(const char *argument) {
*
* Document the available Glk commands.
*/
-static void
-gsc_command_help(const char *command) {
+static void gsc_command_help(const char *command) {
gsc_commandref_t entry, matched;
assert(command);
@@ -2234,8 +2174,7 @@ gsc_command_help(const char *command) {
* This function is handed each input line. If the line contains a specific
* Glk port command, handle it and return TRUE, otherwise return FALSE.
*/
-static int
-gsc_command_escape(const char *string) {
+static int gsc_command_escape(const char *string) {
int posn;
char *string_copy, *command, *argument;
assert(string);
@@ -2356,8 +2295,7 @@ static gsc_abbreviation_t GSC_ABBREVIATIONS[] = {
* Expand a few common one-character abbreviations commonly found in other
* game systems.
*/
-static void
-gsc_expand_abbreviations(char *buffer, int size) {
+static void gsc_expand_abbreviations(char *buffer, int size) {
char *command, abbreviation;
const char *expansion;
gsc_abbreviationref_t entry;
@@ -2404,8 +2342,7 @@ gsc_expand_abbreviations(char *buffer, int size) {
*
* Read and return a line of player input.
*/
-sc_bool
-os_read_line(sc_char *buffer, sc_int length) {
+sc_bool os_read_line(sc_char *buffer, sc_int length) {
sc_int characters;
assert(buffer && length > 0);
@@ -2520,8 +2457,7 @@ os_read_line(sc_char *buffer, sc_int length) {
* window, so this is just a call to the normal readline, with an additional
* prompt.
*/
-sc_bool
-os_read_line_debug(sc_char *buffer, sc_int length) {
+sc_bool os_read_line_debug(sc_char *buffer, sc_int length) {
gsc_output_silence_help_hints();
gsc_reset_glk_style();
g_vm->glk_put_string("[SCARE debug]");
@@ -2534,8 +2470,7 @@ os_read_line_debug(sc_char *buffer, sc_int length) {
*
* Confirm a game action with a yes/no prompt.
*/
-sc_bool
-os_confirm(sc_int type) {
+sc_bool os_confirm(sc_int type) {
sc_char response;
/*
@@ -2625,8 +2560,7 @@ static const glui32 GSC_DELAY_TIMEOUTS_COUNT = 10;
* improve the display where 'r', or confirming restart, triggers an otherwise
* immediate, and abrupt, restart.
*/
-static void
-gsc_short_delay() {
+static void gsc_short_delay() {
/* Ignore the call if the Glk doesn't have timers. */
if (g_vm->glk_gestalt(gestalt_Timer, 0)) {
glui32 timeout;
@@ -2650,8 +2584,7 @@ gsc_short_delay() {
* Process Glk events until one of the expected type, or types, arrives.
* Return the event of that type.
*/
-static void
-gsc_event_wait_2(glui32 wait_type_1, glui32 wait_type_2, event_t *event) {
+static void gsc_event_wait_2(glui32 wait_type_1, glui32 wait_type_2, event_t *event) {
assert(event);
do {
@@ -2671,8 +2604,7 @@ gsc_event_wait_2(glui32 wait_type_1, glui32 wait_type_2, event_t *event) {
} while (!(event->type == (EvType)wait_type_1 || event->type == (EvType)wait_type_2));
}
-static void
-gsc_event_wait(glui32 wait_type, event_t *event) {
+static void gsc_event_wait(glui32 wait_type, event_t *event) {
assert(event);
gsc_event_wait_2(wait_type, evtype_None, event);
@@ -2719,16 +2651,14 @@ void *os_open_file(sc_bool is_save) {
*
* Write/read the given buffered data to/from the open Glk stream.
*/
-void
-os_write_file(void *opaque, const sc_byte *buffer, sc_int length) {
+void os_write_file(void *opaque, const sc_byte *buffer, sc_int length) {
strid_t stream = (strid_t) opaque;
assert(opaque && buffer);
g_vm->glk_put_buffer_stream(stream, (char *) buffer, length);
}
-sc_int
-os_read_file(void *opaque, sc_byte *buffer, sc_int length) {
+sc_int os_read_file(void *opaque, sc_byte *buffer, sc_int length) {
strid_t stream = (strid_t) opaque;
assert(opaque && buffer);
@@ -2741,8 +2671,7 @@ os_read_file(void *opaque, sc_byte *buffer, sc_int length) {
*
* Close the opened Glk stream.
*/
-void
-os_close_file(void *opaque) {
+void os_close_file(void *opaque) {
strid_t stream = (strid_t) opaque;
assert(opaque);
@@ -2788,8 +2717,7 @@ static sc_int gsc_callback(void *opaque, sc_byte *buffer, sc_int length) {
* Offer the option to restart, undo, or quit. Returns the selected game
* end option. Called on game completion.
*/
-static enum gsc_end_option
-gsc_get_ending_option() {
+static enum gsc_end_option gsc_get_ending_option() {
sc_char response;
/* Ensure back to normal style, and update status. */
@@ -2858,10 +2786,8 @@ gsc_get_ending_option() {
* and generally handle options. The second is called from g_vm->glk_main, and
* does the real work of running the game.
*/
-static int
-gsc_startup_code(Common::SeekableReadStream *game_stream, strid_t restore_stream,
- sc_uint trace_flags, sc_bool enable_debugger,
- sc_bool stable_random, const sc_char *locale) {
+static int gsc_startup_code(Common::SeekableReadStream *game_stream, strid_t restore_stream,
+ sc_uint trace_flags, sc_bool enable_debugger, sc_bool stable_random, const sc_char *locale) {
winid_t window;
assert(game_stream);
@@ -2960,8 +2886,7 @@ gsc_startup_code(Common::SeekableReadStream *game_stream, strid_t restore_stream
return TRUE;
}
-static void
-gsc_main() {
+static void gsc_main() {
sc_bool is_running;
/* Ensure SCARE internal types have the right sizes. */
@@ -3100,7 +3025,7 @@ void adrift_main() {
/* Glk linkage relevant only to the UNIX platform */
/*---------------------------------------------------------------------*/
-#ifdef UNUSED
+#if 0
/*
* Glk arguments for UNIX versions of the Glk interpreter.
*/
diff --git a/engines/glk/adrift/scdebug.cpp b/engines/glk/adrift/scdebug.cpp
index 35900c37f4..a752506702 100644
--- a/engines/glk/adrift/scdebug.cpp
+++ b/engines/glk/adrift/scdebug.cpp
@@ -32,7 +32,7 @@ static const sc_uint DEBUG_MAGIC = 0xc4584d2e;
enum { DEBUG_BUFFER_SIZE = 256 };
/* Debugging command and command argument type. */
-typedef enum {
+enum sc_command_t {
DEBUG_NONE = 0, DEBUG_CONTINUE, DEBUG_STEP, DEBUG_BUFFER, DEBUG_RESOURCES,
DEBUG_HELP, DEBUG_GAME,
DEBUG_PLAYER, DEBUG_ROOMS, DEBUG_OBJECTS, DEBUG_NPCS, DEBUG_EVENTS,
@@ -45,18 +45,15 @@ typedef enum {
DEBUG_CLEARTASKS, DEBUG_CLEARVARIABLES,
DEBUG_WATCHALL, DEBUG_CLEARALL, DEBUG_RANDOM,
DEBUG_QUIT
-}
-sc_command_t;
+};
-typedef enum
-{ COMMAND_QUERY = 0, COMMAND_RANGE, COMMAND_ONE, COMMAND_ALL }
-sc_command_type_t;
+enum sc_command_type_t { COMMAND_QUERY = 0, COMMAND_RANGE, COMMAND_ONE, COMMAND_ALL };
/* Table connecting debugging command strings to commands. */
-typedef struct {
+struct sc_strings_t {
const sc_char *const command_string;
const sc_command_t command;
-} sc_strings_t;
+};
static const sc_strings_t DEBUG_COMMANDS[] = {
{"continue", DEBUG_CONTINUE}, {"step", DEBUG_STEP}, {"buffer", DEBUG_BUFFER},
{"resources", DEBUG_RESOURCES}, {"help", DEBUG_HELP}, {"game", DEBUG_GAME},
@@ -83,7 +80,7 @@ static const sc_strings_t DEBUG_COMMANDS[] = {
* added to the game on enabling debug, and removed and destroyed on
* disabling debugging.
*/
-typedef struct sc_debugger_s {
+struct sc_debugger_s {
sc_uint magic;
sc_bool *watch_objects;
sc_bool *watch_npcs;
@@ -94,7 +91,8 @@ typedef struct sc_debugger_s {
sc_bool single_step;
sc_bool quit_pending;
sc_uint elapsed_seconds;
-} sc_debugger_t;
+};
+typedef sc_debugger_s sc_debugger_t;
/*
@@ -102,8 +100,7 @@ typedef struct sc_debugger_s {
*
* Return TRUE if pointer is a valid debugger, FALSE otherwise.
*/
-static sc_bool
-debug_is_valid(sc_debuggerref_t debug) {
+static sc_bool debug_is_valid(sc_debuggerref_t debug) {
return debug && debug->magic == DEBUG_MAGIC;
}
@@ -113,8 +110,7 @@ debug_is_valid(sc_debuggerref_t debug) {
*
* Return the debugger reference from a game, or NULL if none.
*/
-static sc_debuggerref_t
-debug_get_debugger(sc_gameref_t game) {
+static sc_debuggerref_t debug_get_debugger(sc_gameref_t game) {
assert(gs_is_game_valid(game));
return game->debugger;
@@ -126,8 +122,7 @@ debug_get_debugger(sc_gameref_t game) {
*
* Common helper to return the count of variables defined in a game.
*/
-static sc_int
-debug_variable_count(sc_gameref_t game) {
+static sc_int debug_variable_count(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key;
sc_int variable_count;
@@ -146,8 +141,7 @@ debug_variable_count(sc_gameref_t game) {
* Create a new set of debug control information, and append it to the
* game passed in.
*/
-static void
-debug_initialize(sc_gameref_t game) {
+static void debug_initialize(sc_gameref_t game) {
sc_debuggerref_t debug;
/* Create the easy bits of the new debugging set. */
@@ -194,8 +188,7 @@ debug_initialize(sc_gameref_t game) {
* Destroy a debug data set, free its heap memory, and remove its reference
* from the game.
*/
-static void
-debug_finalize(sc_gameref_t game) {
+static void debug_finalize(sc_gameref_t game) {
sc_debuggerref_t debug = debug_get_debugger(game);
assert(debug_is_valid(debug));
@@ -220,8 +213,7 @@ debug_finalize(sc_gameref_t game) {
*
* Print debugging help.
*/
-static void
-debug_help(sc_command_t topic) {
+static void debug_help(sc_command_t topic) {
/* Is help general, or specific? */
if (topic == DEBUG_NONE) {
if_print_debug(
@@ -539,15 +531,13 @@ debug_help(sc_command_t topic) {
*
* Low level output helpers.
*/
-static void
-debug_print_quoted(const sc_char *string) {
+static void debug_print_quoted(const sc_char *string) {
if_print_debug_character('"');
if_print_debug(string);
if_print_debug_character('"');
}
-static void
-debug_print_player(sc_gameref_t game) {
+static void debug_print_player(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
const sc_char *playername;
@@ -559,8 +549,7 @@ debug_print_player(sc_gameref_t game) {
debug_print_quoted(playername);
}
-static void
-debug_print_room(sc_gameref_t game, sc_int room) {
+static void debug_print_room(sc_gameref_t game, sc_int room) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_char buffer[32];
@@ -583,8 +572,7 @@ debug_print_room(sc_gameref_t game, sc_int room) {
debug_print_quoted(name);
}
-static void
-debug_print_object(sc_gameref_t game, sc_int object) {
+static void debug_print_object(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_bool bstatic;
@@ -618,8 +606,7 @@ debug_print_object(sc_gameref_t game, sc_int object) {
debug_print_quoted(name);
}
-static void
-debug_print_npc(sc_gameref_t game, sc_int npc) {
+static void debug_print_npc(sc_gameref_t game, sc_int npc) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_char buffer[32];
@@ -646,8 +633,7 @@ debug_print_npc(sc_gameref_t game, sc_int npc) {
debug_print_quoted(name);
}
-static void
-debug_print_event(sc_gameref_t game, sc_int event) {
+static void debug_print_event(sc_gameref_t game, sc_int event) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_char buffer[32];
@@ -670,8 +656,7 @@ debug_print_event(sc_gameref_t game, sc_int event) {
debug_print_quoted(name);
}
-static void
-debug_print_task(sc_gameref_t game, sc_int task) {
+static void debug_print_task(sc_gameref_t game, sc_int task) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
sc_char buffer[32];
@@ -695,8 +680,7 @@ debug_print_task(sc_gameref_t game, sc_int task) {
debug_print_quoted(command);
}
-static void
-debug_print_variable(sc_gameref_t game, sc_int variable) {
+static void debug_print_variable(sc_gameref_t game, sc_int variable) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[3], vt_rvalue;
@@ -742,8 +726,7 @@ debug_print_variable(sc_gameref_t game, sc_int variable) {
*
* Display overall game details.
*/
-static void
-debug_game(sc_gameref_t game, sc_command_type_t type) {
+static void debug_game(sc_gameref_t game, sc_command_type_t type) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_debuggerref_t debug = debug_get_debugger(game);
sc_vartype_t vt_key[2];
@@ -890,9 +873,7 @@ debug_game(sc_gameref_t game, sc_command_type_t type) {
*
* Print a few brief details about the player status.
*/
-static void
-debug_player(sc_gameref_t game,
- sc_command_t command, sc_command_type_t type) {
+static void debug_player(sc_gameref_t game, sc_command_t command, sc_command_type_t type) {
if (type != COMMAND_QUERY) {
if_print_debug("The Player command takes no arguments.\n");
return;
@@ -948,9 +929,7 @@ debug_player(sc_gameref_t game,
* Normalize a set of arguments parsed from a debugger command line, for
* debug commands that take ranges.
*/
-static sc_bool
-debug_normalize_arguments(sc_command_type_t type,
- sc_int *arg1, sc_int *arg2, sc_int limit) {
+static sc_bool debug_normalize_arguments(sc_command_type_t type, sc_int *arg1, sc_int *arg2, sc_int limit) {
sc_int low = 0, high = 0;
/* Set range low and high depending on the command type. */
@@ -990,13 +969,11 @@ debug_normalize_arguments(sc_command_type_t type,
*
* Print details of rooms and their direct contents.
*/
-static sc_bool
-debug_filter_room(sc_gameref_t game, sc_int room) {
+static sc_bool debug_filter_room(sc_gameref_t game, sc_int room) {
return room == gs_playerroom(game);
}
-static void
-debug_dump_room(sc_gameref_t game, sc_int room) {
+static void debug_dump_room(sc_gameref_t game, sc_int room) {
sc_int object, npc;
debug_print_room(game, room);
@@ -1037,13 +1014,11 @@ debug_dump_room(sc_gameref_t game, sc_int room) {
*
* Print the changeable details of game objects.
*/
-static sc_bool
-debug_filter_object(sc_gameref_t game, sc_int object) {
+static sc_bool debug_filter_object(sc_gameref_t game, sc_int object) {
return obj_indirectly_in_room(game, object, gs_playerroom(game));
}
-static void
-debug_dump_object(sc_gameref_t game, sc_int object) {
+static void debug_dump_object(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int openness;
sc_vartype_t vt_key[3];
@@ -1171,13 +1146,11 @@ debug_dump_object(sc_gameref_t game, sc_int object) {
*
* Print stuff about NPCs.
*/
-static sc_bool
-debug_filter_npc(sc_gameref_t game, sc_int npc) {
+static sc_bool debug_filter_npc(sc_gameref_t game, sc_int npc) {
return npc_in_room(game, npc, gs_playerroom(game));
}
-static void
-debug_dump_npc(sc_gameref_t game, sc_int npc) {
+static void debug_dump_npc(sc_gameref_t game, sc_int npc) {
debug_print_npc(game, npc);
if_print_debug_character('\n');
@@ -1239,13 +1212,11 @@ debug_dump_npc(sc_gameref_t game, sc_int npc) {
*
* Print stuff about events.
*/
-static sc_bool
-debug_filter_event(sc_gameref_t game, sc_int event) {
+static sc_bool debug_filter_event(sc_gameref_t game, sc_int event) {
return gs_event_state(game, event) == ES_RUNNING;
}
-static void
-debug_dump_event(sc_gameref_t game, sc_int event) {
+static void debug_dump_event(sc_gameref_t game, sc_int event) {
sc_char buffer[32];
debug_print_event(game, event);
@@ -1284,13 +1255,11 @@ debug_dump_event(sc_gameref_t game, sc_int event) {
*
* Print stuff about tasks.
*/
-static sc_bool
-debug_filter_task(sc_gameref_t game, sc_int task) {
+static sc_bool debug_filter_task(sc_gameref_t game, sc_int task) {
return task_can_run_task(game, task);
}
-static void
-debug_dump_task(sc_gameref_t game, sc_int task) {
+static void debug_dump_task(sc_gameref_t game, sc_int task) {
debug_print_task(game, task);
if_print_debug_character('\n');
@@ -1314,8 +1283,7 @@ debug_dump_task(sc_gameref_t game, sc_int task) {
*
* Print stuff about variables.
*/
-static void
-debug_dump_variable(sc_gameref_t game, sc_int variable) {
+static void debug_dump_variable(sc_gameref_t game, sc_int variable) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[3], vt_rvalue;
@@ -1358,9 +1326,8 @@ debug_dump_variable(sc_gameref_t game, sc_int variable) {
*
* Common handler for iterating dumps of classes.
*/
-static void
-debug_dump_common(sc_gameref_t game, sc_command_t command,
- sc_command_type_t type, sc_int arg1, sc_int arg2) {
+static void debug_dump_common(sc_gameref_t game, sc_command_t command,
+ sc_command_type_t type, sc_int arg1, sc_int arg2) {
sc_int low = arg1, high = arg2;
sc_int limit, index_;
const sc_char *class_;
@@ -1492,8 +1459,7 @@ debug_dump_common(sc_gameref_t game, sc_command_t command,
*
* Print the current raw printfilter contents.
*/
-static void
-debug_buffer(sc_gameref_t game, sc_command_type_t type) {
+static void debug_buffer(sc_gameref_t game, sc_command_type_t type) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_char *buffer;
@@ -1515,8 +1481,7 @@ debug_buffer(sc_gameref_t game, sc_command_type_t type) {
*
* Helper for debug_resources().
*/
-static void
-debug_print_resource(const sc_resource_t *resource) {
+static void debug_print_resource(const sc_resource_t *resource) {
sc_char buffer[32];
debug_print_quoted(resource->name);
@@ -1534,8 +1499,7 @@ debug_print_resource(const sc_resource_t *resource) {
*
* Print any active and requested resources.
*/
-static void
-debug_resources(sc_gameref_t game, sc_command_type_t type) {
+static void debug_resources(sc_gameref_t game, sc_command_type_t type) {
sc_bool printed = FALSE;
if (type != COMMAND_QUERY) {
@@ -1592,8 +1556,7 @@ debug_resources(sc_gameref_t game, sc_command_type_t type) {
* Report the PRNG in use, and seed the random number generator to the
* given value.
*/
-static void
-debug_random(sc_command_type_t type, sc_int new_seed) {
+static void debug_random(sc_command_type_t type, sc_int new_seed) {
const sc_char *random_type;
sc_char buffer[32];
@@ -1633,9 +1596,8 @@ debug_random(sc_command_type_t type, sc_int new_seed) {
*
* Common handler for setting and clearing watchpoints.
*/
-static void
-debug_watchpoint_common(sc_gameref_t game, sc_command_t command,
- sc_command_type_t type, sc_int arg1, sc_int arg2) {
+static void debug_watchpoint_common(sc_gameref_t game, sc_command_t command,
+ sc_command_type_t type, sc_int arg1, sc_int arg2) {
const sc_debuggerref_t debug = debug_get_debugger(game);
sc_int low = arg1, high = arg2;
sc_int limit, index_;
@@ -1801,9 +1763,7 @@ debug_watchpoint_common(sc_gameref_t game, sc_command_t command,
*
* Common handler to list out and clear all set watchpoints at a stroke.
*/
-static void
-debug_watchall_common(sc_gameref_t game,
- sc_command_t command, sc_command_type_t type) {
+static void debug_watchall_common(sc_gameref_t game, sc_command_t command, sc_command_type_t type) {
const sc_debuggerref_t debug = debug_get_debugger(game);
assert(debug_is_valid(debug));
@@ -1854,8 +1814,7 @@ debug_watchall_common(sc_gameref_t game,
*
* Compare two objects, and return TRUE if the same.
*/
-static sc_bool
-debug_compare_object(sc_gameref_t from, sc_gameref_t with, sc_int object) {
+static sc_bool debug_compare_object(sc_gameref_t from, sc_gameref_t with, sc_int object) {
const sc_objectstate_t *from_object = from->objects + object;
const sc_objectstate_t *with_object = with->objects + object;
@@ -1874,8 +1833,7 @@ debug_compare_object(sc_gameref_t from, sc_gameref_t with, sc_int object) {
*
* Compare two NPCs, and return TRUE if the same.
*/
-static sc_bool
-debug_compare_npc(sc_gameref_t from, sc_gameref_t with, sc_int npc) {
+static sc_bool debug_compare_npc(sc_gameref_t from, sc_gameref_t with, sc_int npc) {
const sc_npcstate_t *from_npc = from->npcs + npc;
const sc_npcstate_t *with_npc = with->npcs + npc;
@@ -1897,8 +1855,7 @@ debug_compare_npc(sc_gameref_t from, sc_gameref_t with, sc_int npc) {
*
* Compare two events, and return TRUE if the same.
*/
-static sc_bool
-debug_compare_event(sc_gameref_t from, sc_gameref_t with, sc_int event) {
+static sc_bool debug_compare_event(sc_gameref_t from, sc_gameref_t with, sc_int event) {
const sc_eventstate_t *from_event = from->events + event;
const sc_eventstate_t *with_event = with->events + event;
@@ -1912,8 +1869,7 @@ debug_compare_event(sc_gameref_t from, sc_gameref_t with, sc_int event) {
*
* Compare two tasks, and return TRUE if the same.
*/
-static sc_bool
-debug_compare_task(sc_gameref_t from, sc_gameref_t with, sc_int task) {
+static sc_bool debug_compare_task(sc_gameref_t from, sc_gameref_t with, sc_int task) {
const sc_taskstate_t *from_task = from->tasks + task;
const sc_taskstate_t *with_task = with->tasks + task;
@@ -1927,8 +1883,7 @@ debug_compare_task(sc_gameref_t from, sc_gameref_t with, sc_int task) {
*
* Compare two variables, and return TRUE if the same.
*/
-static sc_bool
-debug_compare_variable(sc_gameref_t from, sc_gameref_t with, sc_int variable) {
+static sc_bool debug_compare_variable(sc_gameref_t from, sc_gameref_t with, sc_int variable) {
const sc_prop_setref_t bundle = from->bundle;
const sc_var_setref_t from_var = from->vars;
const sc_var_setref_t with_var = with->vars;
@@ -1975,12 +1930,9 @@ debug_compare_variable(sc_gameref_t from, sc_gameref_t with, sc_int variable) {
* watchpoints flags array. Prints entries that differ, and returns TRUE
* if any differed.
*/
-static sc_bool
-debug_check_class(sc_gameref_t from, sc_gameref_t with,
- const sc_char *class_, sc_int class_count,
- const sc_bool *watchpoints,
- sc_bool(*const compare_function)
- (sc_gameref_t, sc_gameref_t, sc_int)) {
+static sc_bool debug_check_class(sc_gameref_t from, sc_gameref_t with, const sc_char *class_,
+ sc_int class_count, const sc_bool *watchpoints,
+ sc_bool(*const compare_function) (sc_gameref_t, sc_gameref_t, sc_int)) {
sc_int index_;
sc_bool triggered = FALSE;
@@ -2020,8 +1972,7 @@ debug_check_class(sc_gameref_t from, sc_gameref_t with,
* TRUE if any triggered, FALSE if none (or if the undo game isn't available,
* in which case no check is possible).
*/
-static sc_bool
-debug_check_watchpoints(sc_gameref_t game) {
+static sc_bool debug_check_watchpoints(sc_gameref_t game) {
const sc_debuggerref_t debug = debug_get_debugger(game);
const sc_gameref_t undo = game->undo;
sc_bool triggered;
@@ -2071,10 +2022,8 @@ debug_check_watchpoints(sc_gameref_t game) {
* appropriate command and its arguments. Returns DEBUG_NONE if the parse
* fails.
*/
-static sc_command_t
-debug_parse_command(const sc_char *command_string,
- sc_command_type_t *type,
- sc_int *arg1, sc_int *arg2, sc_command_t *help_topic) {
+static sc_command_t debug_parse_command(const sc_char *command_string,
+ sc_command_type_t *type, sc_int *arg1, sc_int *arg2, sc_command_t *help_topic) {
sc_command_t return_command;
sc_command_type_t return_type;
sc_int val1, val2, converted, matches;
@@ -2186,10 +2135,8 @@ debug_parse_command(const sc_char *command_string,
*
* Dispatch a debugging command to the appropriate handler.
*/
-static void
-debug_dispatch(sc_gameref_t game,
- sc_command_t command, sc_command_type_t type,
- sc_int arg1, sc_int arg2, sc_command_t help_topic) {
+static void debug_dispatch(sc_gameref_t game, sc_command_t command, sc_command_type_t type,
+ sc_int arg1, sc_int arg2, sc_command_t help_topic) {
/* Demultiplex debugging command, and call handlers. */
switch (command) {
case DEBUG_HELP:
@@ -2256,8 +2203,7 @@ debug_dispatch(sc_gameref_t game,
*
* Create a small debugging dialog with the user.
*/
-static void
-debug_dialog(sc_gameref_t game) {
+static void debug_dialog(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_debuggerref_t debug = debug_get_debugger(game);
const sc_var_setref_t vars = gs_get_vars(game);
@@ -2342,8 +2288,7 @@ debug_dialog(sc_gameref_t game) {
* Handle a single debugging command line from the outside world. Returns
* TRUE if valid, FALSE if invalid (parse failed, not understood).
*/
-sc_bool
-debug_run_command(sc_gameref_t game, const sc_char *debug_command) {
+sc_bool debug_run_command(sc_gameref_t game, const sc_char *debug_command) {
const sc_debuggerref_t debug = debug_get_debugger(game);
sc_command_t command, help_topic;
sc_command_type_t type;
@@ -2379,8 +2324,7 @@ debug_run_command(sc_gameref_t game, const sc_char *debug_command) {
* a polite refusal if debugging is not enabled, otherwise runs a debugging
* dialog. Uses if_print_string() as this isn't debug output.
*/
-sc_bool
-debug_cmd_debugger(sc_gameref_t game) {
+sc_bool debug_cmd_debugger(sc_gameref_t game) {
const sc_debuggerref_t debug = debug_get_debugger(game);
/* If debugging disallowed (not initialized), ignore the call. */
@@ -2410,8 +2354,7 @@ debug_cmd_debugger(sc_gameref_t game) {
* The second is called on exit from the game, and may make a final sweep for
* watchpoints and offer the debug dialog one last time.
*/
-void
-debug_game_started(sc_gameref_t game) {
+void debug_game_started(sc_gameref_t game) {
const sc_debuggerref_t debug = debug_get_debugger(game);
/* If debugging disallowed (not initialized), ignore the call. */
@@ -2438,8 +2381,7 @@ debug_game_started(sc_gameref_t game) {
}
}
-void
-debug_game_ended(sc_gameref_t game) {
+void debug_game_ended(sc_gameref_t game) {
const sc_debuggerref_t debug = debug_get_debugger(game);
/* If debugging disallowed (not initialized), ignore the call. */
@@ -2481,8 +2423,7 @@ debug_game_ended(sc_gameref_t game) {
* Called after each turn by the main game loop. Checks for any set
* watchpoints, and triggers a debug dialog when any fire.
*/
-void
-debug_turn_update(sc_gameref_t game) {
+void debug_turn_update(sc_gameref_t game) {
const sc_debuggerref_t debug = debug_get_debugger(game);
/* If debugging disallowed (not initialized), ignore the call. */
@@ -2517,8 +2458,7 @@ debug_turn_update(sc_gameref_t game) {
* and free'd on disabling; as a result, any set watchpoints are lost on
* disabling.
*/
-void
-debug_set_enabled(sc_gameref_t game, sc_bool enable) {
+void debug_set_enabled(sc_gameref_t game, sc_bool enable) {
const sc_debuggerref_t debug = debug_get_debugger(game);
/*
@@ -2534,8 +2474,7 @@ debug_set_enabled(sc_gameref_t game, sc_bool enable) {
}
}
-sc_bool
-debug_get_enabled(sc_gameref_t game) {
+sc_bool debug_get_enabled(sc_gameref_t game) {
const sc_debuggerref_t debug = debug_get_debugger(game);
return debug != NULL;
diff --git a/engines/glk/adrift/scevents.cpp b/engines/glk/adrift/scevents.cpp
index 0048cd6dd9..b7cea8b0f6 100644
--- a/engines/glk/adrift/scevents.cpp
+++ b/engines/glk/adrift/scevents.cpp
@@ -42,8 +42,7 @@ static sc_bool evt_trace = FALSE;
*
* Return TRUE if any task at all matches the given completion state.
*/
-static sc_bool
-evt_any_task_in_state(sc_gameref_t game, sc_bool state) {
+static sc_bool evt_any_task_in_state(sc_gameref_t game, sc_bool state) {
sc_int task;
/* Scan tasks for any whose completion matches input. */
@@ -62,8 +61,7 @@ evt_any_task_in_state(sc_gameref_t game, sc_bool state) {
*
* Return TRUE if player is in the right room for event text.
*/
-sc_bool
-evt_can_see_event(sc_gameref_t game, sc_int event) {
+sc_bool evt_can_see_event(sc_gameref_t game, sc_int event) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int type;
@@ -102,8 +100,7 @@ evt_can_see_event(sc_gameref_t game, sc_int event) {
*
* Move an object from within an event.
*/
-static void
-evt_move_object(sc_gameref_t game, sc_int object, sc_int destination) {
+static void evt_move_object(sc_gameref_t game, sc_int object, sc_int destination) {
/* Ignore negative values of object. */
if (object >= 0) {
if (evt_trace) {
@@ -158,8 +155,7 @@ evt_move_object(sc_gameref_t game, sc_int object, sc_int destination) {
* comment. It's arguable if this is a feature or a bug; nevertheless, we
* can do the same thing here, though it's ugly.
*/
-static sc_bool
-evt_fixup_v390_v380_immediate_restart(sc_gameref_t game, sc_int event) {
+static sc_bool evt_fixup_v390_v380_immediate_restart(sc_gameref_t game, sc_int event) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int version;
@@ -195,8 +191,7 @@ evt_fixup_v390_v380_immediate_restart(sc_gameref_t game, sc_int event) {
*
* Change an event from WAITING to RUNNING.
*/
-static void
-evt_start_event(sc_gameref_t game, sc_int event) {
+static void evt_start_event(sc_gameref_t game, sc_int event) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
@@ -253,8 +248,7 @@ evt_start_event(sc_gameref_t game, sc_int event) {
*
* Return the starter type for an event.
*/
-static sc_int
-evt_get_starter_type(sc_gameref_t game, sc_int event) {
+static sc_int evt_get_starter_type(sc_gameref_t game, sc_int event) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int startertype;
@@ -273,8 +267,7 @@ evt_get_starter_type(sc_gameref_t game, sc_int event) {
*
* Move an event to FINISHED, or restart it.
*/
-static void
-evt_finish_event(sc_gameref_t game, sc_int event) {
+static void evt_finish_event(sc_gameref_t game, sc_int event) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
@@ -415,16 +408,14 @@ evt_finish_event(sc_gameref_t game, sc_int event) {
*
* Return the status of start, pause and resume states of an event.
*/
-static sc_bool
-evt_has_starter_task(sc_gameref_t game, sc_int event) {
+static sc_bool evt_has_starter_task(sc_gameref_t game, sc_int event) {
sc_int startertype;
startertype = evt_get_starter_type(game, event);
return startertype == 3;
}
-static sc_bool
-evt_starter_task_is_complete(sc_gameref_t game, sc_int event) {
+static sc_bool evt_starter_task_is_complete(sc_gameref_t game, sc_int event) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int task;
@@ -447,8 +438,7 @@ evt_starter_task_is_complete(sc_gameref_t game, sc_int event) {
return start;
}
-static sc_bool
-evt_pauser_task_is_complete(sc_gameref_t game, sc_int event) {
+static sc_bool evt_pauser_task_is_complete(sc_gameref_t game, sc_int event) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int pausetask;
@@ -474,8 +464,7 @@ evt_pauser_task_is_complete(sc_gameref_t game, sc_int event) {
return pause;
}
-static sc_bool
-evt_resumer_task_is_complete(sc_gameref_t game, sc_int event) {
+static sc_bool evt_resumer_task_is_complete(sc_gameref_t game, sc_int event) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int resumetask;
@@ -508,8 +497,7 @@ evt_resumer_task_is_complete(sc_gameref_t game, sc_int event) {
* Print messages and handle resources for the event where we're in mid-event
* and getting close to some number of turns from its end.
*/
-static void
-evt_handle_preftime_notifications(sc_gameref_t game, sc_int event) {
+static void evt_handle_preftime_notifications(sc_gameref_t game, sc_int event) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
@@ -556,8 +544,7 @@ evt_handle_preftime_notifications(sc_gameref_t game, sc_int event) {
*
* Attempt to advance an event by one turn.
*/
-static void
-evt_tick_event(sc_gameref_t game, sc_int event) {
+static void evt_tick_event(sc_gameref_t game, sc_int event) {
if (evt_trace) {
sc_trace("Event: ticking event %ld: state %ld, time %ld\n", event,
gs_event_state(game, event), gs_event_time(game, event));
@@ -742,8 +729,7 @@ evt_tick_event(sc_gameref_t game, sc_int event) {
*
* Attempt to advance each event by one turn.
*/
-void
-evt_tick_events(sc_gameref_t game) {
+void evt_tick_events(sc_gameref_t game) {
sc_int event;
/*
@@ -778,8 +764,7 @@ evt_tick_events(sc_gameref_t game) {
*
* Set event tracing on/off.
*/
-void
-evt_debug_trace(sc_bool flag) {
+void evt_debug_trace(sc_bool flag) {
evt_trace = flag;
}
diff --git a/engines/glk/adrift/scexpr.cpp b/engines/glk/adrift/scexpr.cpp
index a316b7cdec..2375b5e5a7 100644
--- a/engines/glk/adrift/scexpr.cpp
+++ b/engines/glk/adrift/scexpr.cpp
@@ -71,11 +71,11 @@ enum {
* Small tables tying multicharacter tokens strings to tokens. At present,
* the string lengths for names are not used.
*/
-typedef struct {
+struct sc_expr_multichar_t {
const sc_char *const name;
const sc_int length;
const sc_int token;
-} sc_expr_multichar_t;
+};
static const sc_expr_multichar_t FUNCTION_TOKENS[] = {
{"either", 6, TOK_EITHER},
@@ -103,8 +103,7 @@ static const sc_expr_multichar_t OPERATOR_TOKENS[] = {
* Multicharacter token table search, returns the matching token, or
* TOK_NONE if no match.
*/
-static sc_int
-expr_multichar_search(const sc_char *name, const sc_expr_multichar_t *table) {
+static sc_int expr_multichar_search(const sc_char *name, const sc_expr_multichar_t *table) {
const sc_expr_multichar_t *entry;
/* Scan the table for a case-independent full string match. */
@@ -131,8 +130,7 @@ static sc_int expr_current_token = TOK_NONE;
*
* Start and wrap up expression string tokenization.
*/
-static void
-expr_tokenize_start(const sc_char *expression) {
+static void expr_tokenize_start(const sc_char *expression) {
static sc_bool initialized = FALSE;
/* On first call only, verify the string lengths in the tables. */
@@ -171,8 +169,7 @@ expr_tokenize_start(const sc_char *expression) {
expr_current_token = TOK_NONE;
}
-static void
-expr_tokenize_end(void) {
+static void expr_tokenize_end(void) {
/* Deallocate temporary strings, clear expression. */
sc_free(expr_temporary);
expr_temporary = NULL;
@@ -189,8 +186,7 @@ expr_tokenize_end(void) {
* Return the next token from the current expression. The initial token may
* be adjusted into a unary +/- depending on the value of the previous token.
*/
-static sc_int
-expr_next_token_unadjusted(sc_vartype_t *token_value) {
+static sc_int expr_next_token_unadjusted(sc_vartype_t *token_value) {
sc_int c;
assert(expr_expression);
@@ -334,8 +330,7 @@ expr_next_token_unadjusted(sc_vartype_t *token_value) {
}
}
-static sc_int
-expr_next_token(void) {
+static sc_int expr_next_token(void) {
sc_int token;
sc_vartype_t token_value;
@@ -391,8 +386,7 @@ expr_next_token(void) {
* Return the token value of the current token. Undefined if the current
* token is not numeric, an id, or a variable.
*/
-static void
-expr_current_token_value(sc_vartype_t *value) {
+static void expr_current_token_value(sc_vartype_t *value) {
/* Quick check that the value is a valid one. */
switch (expr_current_token) {
case TOK_INTEGER:
@@ -416,10 +410,10 @@ expr_current_token_value(sc_vartype_t *value) {
* integers and strings, and flags strings for possible garbage collection
* on parse errors.
*/
-typedef struct {
+struct sc_stack_t {
sc_bool is_collectible;
sc_vartype_t value;
-} sc_stack_t;
+};
static sc_stack_t expr_eval_stack[MAX_NESTING_DEPTH];
static sc_int expr_eval_stack_index = 0;
@@ -432,8 +426,7 @@ static sc_var_setref_t expr_varset = NULL;
* Reset the evaluation stack to an empty state, and register the variables
* set to use when referencing %...% variables.
*/
-static void
-expr_eval_start(sc_var_setref_t vars) {
+static void expr_eval_start(sc_var_setref_t vars) {
expr_eval_stack_index = 0;
expr_varset = vars;
}
@@ -445,8 +438,7 @@ expr_eval_start(sc_var_setref_t vars) {
* In case of parse error, empty out and free all collectible malloced
* strings left in the evaluation array.
*/
-static void
-expr_eval_garbage_collect(void) {
+static void expr_eval_garbage_collect(void) {
sc_int index_;
/*
@@ -473,8 +465,7 @@ expr_eval_garbage_collect(void) {
* for this case, the input string is assumed to be already malloc'ed, and
* the caller should not subsequently free the string.
*/
-static void
-expr_eval_push_integer(sc_int value) {
+static void expr_eval_push_integer(sc_int value) {
if (expr_eval_stack_index >= MAX_NESTING_DEPTH)
sc_fatal("expr_eval_push_integer: stack overflow\n");
@@ -482,8 +473,7 @@ expr_eval_push_integer(sc_int value) {
expr_eval_stack[expr_eval_stack_index++].value.integer = value;
}
-static void
-expr_eval_push_string(const sc_char *value) {
+static void expr_eval_push_string(const sc_char *value) {
sc_char *value_copy;
if (expr_eval_stack_index >= MAX_NESTING_DEPTH)
@@ -496,8 +486,7 @@ expr_eval_push_string(const sc_char *value) {
expr_eval_stack[expr_eval_stack_index++].value.mutable_string = value_copy;
}
-static void
-expr_eval_push_alloced_string(sc_char *value) {
+static void expr_eval_push_alloced_string(sc_char *value) {
if (expr_eval_stack_index >= MAX_NESTING_DEPTH)
sc_fatal("expr_eval_push_alloced_string: stack overflow\n");
@@ -513,8 +502,7 @@ expr_eval_push_alloced_string(sc_char *value) {
* Pop values off the values stack. Returned strings are malloc'ed copies,
* and the caller is responsible for freeing them.
*/
-static sc_int
-expr_eval_pop_integer(void) {
+static sc_int expr_eval_pop_integer(void) {
if (expr_eval_stack_index == 0)
sc_fatal("expr_eval_pop_integer: stack underflow\n");
@@ -522,8 +510,7 @@ expr_eval_pop_integer(void) {
return expr_eval_stack[--expr_eval_stack_index].value.integer;
}
-static sc_char *
-expr_eval_pop_string(void) {
+static sc_char *expr_eval_pop_string(void) {
if (expr_eval_stack_index == 0)
sc_fatal("expr_eval_pop_string: stack underflow\n");
@@ -538,8 +525,7 @@ expr_eval_pop_string(void) {
*
* Return the top of the values stack as the expression result.
*/
-static void
-expr_eval_result(sc_vartype_t *vt_rvalue) {
+static void expr_eval_result(sc_vartype_t *vt_rvalue) {
if (expr_eval_stack_index != 1)
sc_fatal("expr_eval_result: values stack not completed\n");
@@ -555,8 +541,7 @@ expr_eval_result(sc_vartype_t *vt_rvalue) {
* Return the absolute value of the given sc_int. Replacement for labs(),
* avoids tying sc_int to long types too closely.
*/
-static sc_int
-expr_eval_abs(sc_int value) {
+static sc_int expr_eval_abs(sc_int value) {
return value < 0 ? -value : value;
}
@@ -569,8 +554,7 @@ static jmp_buf expr_parse_error;
*
* Evaluate the effect of a token into the values stack.
*/
-static void
-expr_eval_action(sc_int token) {
+static void expr_eval_action(sc_int token) {
sc_vartype_t token_value;
switch (token) {
@@ -1069,8 +1053,7 @@ static void expr_parse_string_expr(void);
*
* Match a token to the lookahead, then advance lookahead.
*/
-static void
-expr_parse_match(sc_int token) {
+static void expr_parse_match(sc_int token) {
if (expr_parse_lookahead == token)
expr_parse_lookahead = expr_next_token();
else {
@@ -1089,10 +1072,10 @@ expr_parse_match(sc_int token) {
* a list with no operators (although in practice we need to put a TOK_NONE
* in here since some C compilers won't accept { } as an empty initializer).
*/
-typedef struct {
+struct sc_precedence_entry_t {
const sc_int token_count;
const sc_int tokens[6];
-} sc_precedence_entry_t;
+};
#if 0
/*
* Conventional (BASIC, C) precedence table for the parser. Exponentiation
@@ -1136,8 +1119,7 @@ static const sc_precedence_entry_t PRECEDENCE_TABLE[] = {
* Helper for expr_parse_numeric_element(). Search the token list for the
* entry passed in, and return TRUE if it contains the given token.
*/
-static int
-expr_parse_contains_token(const sc_precedence_entry_t *entry, sc_int token) {
+static int expr_parse_contains_token(const sc_precedence_entry_t *entry, sc_int token) {
sc_bool is_matched;
sc_int index_;
@@ -1161,8 +1143,7 @@ expr_parse_contains_token(const sc_precedence_entry_t *entry, sc_int token) {
* to match tokens, then decide whether, and how, to recurse into itself, or
* whether to parse a highest-precedence factor.
*/
-static void
-expr_parse_numeric_element(sc_int precedence) {
+static void expr_parse_numeric_element(sc_int precedence) {
const sc_precedence_entry_t *entry;
/* See if the level passed in has listed tokens. */
@@ -1195,8 +1176,7 @@ expr_parse_numeric_element(sc_int precedence) {
*
* Parse a complete numeric (sub-)expression.
*/
-static void
-expr_parse_numeric_expr(void) {
+static void expr_parse_numeric_expr(void) {
/* Call the parser of the lowest precedence operators. */
expr_parse_numeric_element(0);
}
@@ -1207,8 +1187,7 @@ expr_parse_numeric_expr(void) {
*
* Parse a numeric expression factor.
*/
-static void
-expr_parse_numeric_factor(void) {
+static void expr_parse_numeric_factor(void) {
/* Handle factors based on lookahead token. */
switch (expr_parse_lookahead) {
/* Handle straightforward factors first. */
@@ -1365,8 +1344,7 @@ expr_parse_numeric_factor(void) {
*
* Parse a complete string (sub-)expression.
*/
-static void
-expr_parse_string_expr(void) {
+static void expr_parse_string_expr(void) {
/*
* Parse a string factor, then all repeated concatenations. Because the '+'
* and '&' are context sensitive, we have to invent/translate them into the
@@ -1386,8 +1364,7 @@ expr_parse_string_expr(void) {
*
* Parse a string expression factor.
*/
-static void
-expr_parse_string_factor(void) {
+static void expr_parse_string_factor(void) {
/* Handle factors based on lookahead token. */
switch (expr_parse_lookahead) {
/* Handle straightforward factors first. */
@@ -1499,9 +1476,8 @@ expr_parse_string_factor(void) {
* Parse a string expression into a runtime values stack. Return the
* value of the expression.
*/
-static sc_bool
-expr_evaluate_expression(const sc_char *expression, sc_var_setref_t vars,
- sc_int assign_type, sc_vartype_t *vt_rvalue) {
+static sc_bool expr_evaluate_expression(const sc_char *expression, sc_var_setref_t vars,
+ sc_int assign_type, sc_vartype_t *vt_rvalue) {
assert(assign_type == VAR_INTEGER || assign_type == VAR_STRING);
/* Reset values stack and start tokenizer. */
@@ -1540,9 +1516,7 @@ expr_evaluate_expression(const sc_char *expression, sc_var_setref_t vars,
* the return value is malloc'ed, and the caller is responsible for freeing
* it.
*/
-sc_bool
-expr_eval_numeric_expression(const sc_char *expression,
- sc_var_setref_t vars, sc_int *rvalue) {
+sc_bool expr_eval_numeric_expression(const sc_char *expression, sc_var_setref_t vars, sc_int *rvalue) {
sc_vartype_t vt_rvalue;
sc_bool status;
assert(expression && vars && rvalue);
@@ -1554,9 +1528,7 @@ expr_eval_numeric_expression(const sc_char *expression,
return status;
}
-sc_bool
-expr_eval_string_expression(const sc_char *expression,
- sc_var_setref_t vars, sc_char **rvalue) {
+sc_bool expr_eval_string_expression(const sc_char *expression, sc_var_setref_t vars, sc_char **rvalue) {
sc_vartype_t vt_rvalue;
sc_bool status;
assert(expression && vars && rvalue);
diff --git a/engines/glk/adrift/scgamest.cpp b/engines/glk/adrift/scgamest.cpp
index f2af6b85d6..84abf6bb9e 100644
--- a/engines/glk/adrift/scgamest.cpp
+++ b/engines/glk/adrift/scgamest.cpp
@@ -36,8 +36,7 @@ static const sc_uint GAME_MAGIC = 0x35aed26e;
*
* Move the player to a given room, and check presence in a given room.
*/
-void
-gs_move_player_to_room(sc_gameref_t game, sc_int room) {
+void gs_move_player_to_room(sc_gameref_t game, sc_int room) {
assert(gs_is_game_valid(game));
if (room < 0) {
@@ -53,8 +52,7 @@ gs_move_player_to_room(sc_gameref_t game, sc_int room) {
game->playerposition = 0;
}
-sc_bool
-gs_player_in_room(sc_gameref_t game, sc_int room) {
+sc_bool gs_player_in_room(sc_gameref_t game, sc_int room) {
assert(gs_is_game_valid(game));
return game->playerroom == room;
}
@@ -65,8 +63,7 @@ gs_player_in_room(sc_gameref_t game, sc_int room) {
*
* Helper for event, room, object, and npc range assertions.
*/
-static sc_bool
-gs_in_range(sc_int value, sc_int limit) {
+static sc_bool gs_in_range(sc_int value, sc_int limit) {
return value >= 0 && value < limit;
}
@@ -76,26 +73,22 @@ gs_in_range(sc_int value, sc_int limit) {
*
* Game accessors and mutators.
*/
-sc_var_setref_t
-gs_get_vars(sc_gameref_t gs) {
+sc_var_setref_t gs_get_vars(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->vars;
}
-sc_prop_setref_t
-gs_get_bundle(sc_gameref_t gs) {
+sc_prop_setref_t gs_get_bundle(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->bundle;
}
-sc_filterref_t
-gs_get_filter(sc_gameref_t gs) {
+sc_filterref_t gs_get_filter(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->filter;
}
-sc_memo_setref_t
-gs_get_memento(sc_gameref_t gs) {
+sc_memo_setref_t gs_get_memento(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->memento;
}
@@ -104,38 +97,32 @@ gs_get_memento(sc_gameref_t gs) {
/*
* Game accessors and mutators for the player.
*/
-void
-gs_set_playerroom(sc_gameref_t gs, sc_int room) {
+void gs_set_playerroom(sc_gameref_t gs, sc_int room) {
assert(gs_is_game_valid(gs));
gs->playerroom = room;
}
-void
-gs_set_playerposition(sc_gameref_t gs, sc_int position) {
+void gs_set_playerposition(sc_gameref_t gs, sc_int position) {
assert(gs_is_game_valid(gs));
gs->playerposition = position;
}
-void
-gs_set_playerparent(sc_gameref_t gs, sc_int parent) {
+void gs_set_playerparent(sc_gameref_t gs, sc_int parent) {
assert(gs_is_game_valid(gs));
gs->playerparent = parent;
}
-sc_int
-gs_playerroom(sc_gameref_t gs) {
+sc_int gs_playerroom(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->playerroom;
}
-sc_int
-gs_playerposition(sc_gameref_t gs) {
+sc_int gs_playerposition(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->playerposition;
}
-sc_int
-gs_playerparent(sc_gameref_t gs) {
+sc_int gs_playerparent(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->playerparent;
}
@@ -144,38 +131,32 @@ gs_playerparent(sc_gameref_t gs) {
/*
* Game accessors and mutators for events.
*/
-sc_int
-gs_event_count(sc_gameref_t gs) {
+sc_int gs_event_count(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->event_count;
}
-void
-gs_set_event_state(sc_gameref_t gs, sc_int event, sc_int state) {
+void gs_set_event_state(sc_gameref_t gs, sc_int event, sc_int state) {
assert(gs_is_game_valid(gs) && gs_in_range(event, gs->event_count));
gs->events[event].state = state;
}
-void
-gs_set_event_time(sc_gameref_t gs, sc_int event, sc_int etime) {
+void gs_set_event_time(sc_gameref_t gs, sc_int event, sc_int etime) {
assert(gs_is_game_valid(gs) && gs_in_range(event, gs->event_count));
gs->events[event].time = etime;
}
-sc_int
-gs_event_state(sc_gameref_t gs, sc_int event) {
+sc_int gs_event_state(sc_gameref_t gs, sc_int event) {
assert(gs_is_game_valid(gs) && gs_in_range(event, gs->event_count));
return gs->events[event].state;
}
-sc_int
-gs_event_time(sc_gameref_t gs, sc_int event) {
+sc_int gs_event_time(sc_gameref_t gs, sc_int event) {
assert(gs_is_game_valid(gs) && gs_in_range(event, gs->event_count));
return gs->events[event].time;
}
-void
-gs_decrement_event_time(sc_gameref_t gs, sc_int event) {
+void gs_decrement_event_time(sc_gameref_t gs, sc_int event) {
assert(gs_is_game_valid(gs) && gs_in_range(event, gs->event_count));
gs->events[event].time--;
}
@@ -184,20 +165,17 @@ gs_decrement_event_time(sc_gameref_t gs, sc_int event) {
/*
* Game accessors and mutators for rooms.
*/
-sc_int
-gs_room_count(sc_gameref_t gs) {
+sc_int gs_room_count(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->room_count;
}
-void
-gs_set_room_seen(sc_gameref_t gs, sc_int room, sc_bool seen) {
+void gs_set_room_seen(sc_gameref_t gs, sc_int room, sc_bool seen) {
assert(gs_is_game_valid(gs) && gs_in_range(room, gs->room_count));
gs->rooms[room].visited = seen;
}
-sc_bool
-gs_room_seen(sc_gameref_t gs, sc_int room) {
+sc_bool gs_room_seen(sc_gameref_t gs, sc_int room) {
assert(gs_is_game_valid(gs) && gs_in_range(room, gs->room_count));
return gs->rooms[room].visited;
}
@@ -206,32 +184,27 @@ gs_room_seen(sc_gameref_t gs, sc_int room) {
/*
* Game accessors and mutators for tasks.
*/
-sc_int
-gs_task_count(sc_gameref_t gs) {
+sc_int gs_task_count(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->task_count;
}
-void
-gs_set_task_done(sc_gameref_t gs, sc_int task, sc_bool done) {
+void gs_set_task_done(sc_gameref_t gs, sc_int task, sc_bool done) {
assert(gs_is_game_valid(gs) && gs_in_range(task, gs->task_count));
gs->tasks[task].done = done;
}
-void
-gs_set_task_scored(sc_gameref_t gs, sc_int task, sc_bool scored) {
+void gs_set_task_scored(sc_gameref_t gs, sc_int task, sc_bool scored) {
assert(gs_is_game_valid(gs) && gs_in_range(task, gs->task_count));
gs->tasks[task].scored = scored;
}
-sc_bool
-gs_task_done(sc_gameref_t gs, sc_int task) {
+sc_bool gs_task_done(sc_gameref_t gs, sc_int task) {
assert(gs_is_game_valid(gs) && gs_in_range(task, gs->task_count));
return gs->tasks[task].done;
}
-sc_bool
-gs_task_scored(sc_gameref_t gs, sc_int task) {
+sc_bool gs_task_scored(sc_gameref_t gs, sc_int task) {
assert(gs_is_game_valid(gs) && gs_in_range(task, gs->task_count));
return gs->tasks[task].scored;
}
@@ -240,142 +213,120 @@ gs_task_scored(sc_gameref_t gs, sc_int task) {
/*
* Game accessors and mutators for objects.
*/
-sc_int
-gs_object_count(sc_gameref_t gs) {
+sc_int gs_object_count(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->object_count;
}
-void
-gs_set_object_openness(sc_gameref_t gs, sc_int object, sc_int openness) {
+void gs_set_object_openness(sc_gameref_t gs, sc_int object, sc_int openness) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].openness = openness;
}
-void
-gs_set_object_state(sc_gameref_t gs, sc_int object, sc_int state) {
+void gs_set_object_state(sc_gameref_t gs, sc_int object, sc_int state) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].state = state;
}
-void
-gs_set_object_seen(sc_gameref_t gs, sc_int object, sc_bool seen) {
+void gs_set_object_seen(sc_gameref_t gs, sc_int object, sc_bool seen) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].seen = seen;
}
-void
-gs_set_object_unmoved(sc_gameref_t gs, sc_int object, sc_bool unmoved) {
+void gs_set_object_unmoved(sc_gameref_t gs, sc_int object, sc_bool unmoved) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].unmoved = unmoved;
}
-void
-gs_set_object_static_unmoved(sc_gameref_t gs, sc_int object, sc_bool unmoved) {
+void gs_set_object_static_unmoved(sc_gameref_t gs, sc_int object, sc_bool unmoved) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].static_unmoved = unmoved;
}
-sc_int
-gs_object_openness(sc_gameref_t gs, sc_int object) {
+sc_int gs_object_openness(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
return gs->objects[object].openness;
}
-sc_int
-gs_object_state(sc_gameref_t gs, sc_int object) {
+sc_int gs_object_state(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
return gs->objects[object].state;
}
-sc_bool
-gs_object_seen(sc_gameref_t gs, sc_int object) {
+sc_bool gs_object_seen(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
return gs->objects[object].seen;
}
-sc_bool
-gs_object_unmoved(sc_gameref_t gs, sc_int object) {
+sc_bool gs_object_unmoved(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
return gs->objects[object].unmoved;
}
-sc_bool
-gs_object_static_unmoved(sc_gameref_t gs, sc_int object) {
+sc_bool gs_object_static_unmoved(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
return gs->objects[object].static_unmoved;
}
-sc_int
-gs_object_position(sc_gameref_t gs, sc_int object) {
+sc_int gs_object_position(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
return gs->objects[object].position;
}
-sc_int
-gs_object_parent(sc_gameref_t gs, sc_int object) {
+sc_int gs_object_parent(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
return gs->objects[object].parent;
}
-static void
-gs_object_move_onto_unchecked(sc_gameref_t gs, sc_int object, sc_int onto) {
+static void gs_object_move_onto_unchecked(sc_gameref_t gs, sc_int object, sc_int onto) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].position = OBJ_ON_OBJECT;
gs->objects[object].parent = onto;
}
-static void
-gs_object_move_into_unchecked(sc_gameref_t gs, sc_int object, sc_int into) {
+static void gs_object_move_into_unchecked(sc_gameref_t gs, sc_int object, sc_int into) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].position = OBJ_IN_OBJECT;
gs->objects[object].parent = into;
}
-static void
-gs_object_make_hidden_unchecked(sc_gameref_t gs, sc_int object) {
+static void gs_object_make_hidden_unchecked(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].position = OBJ_HIDDEN;
gs->objects[object].parent = -1;
}
-static void
-gs_object_player_get_unchecked(sc_gameref_t gs, sc_int object) {
+static void gs_object_player_get_unchecked(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].position = OBJ_HELD_PLAYER;
gs->objects[object].parent = -1;
}
-static void
-gs_object_npc_get_unchecked(sc_gameref_t gs, sc_int object, sc_int npc) {
+static void gs_object_npc_get_unchecked(sc_gameref_t gs, sc_int object, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].position = OBJ_HELD_NPC;
gs->objects[object].parent = npc;
}
-static void
-gs_object_player_wear_unchecked(sc_gameref_t gs, sc_int object) {
+static void gs_object_player_wear_unchecked(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].position = OBJ_WORN_PLAYER;
gs->objects[object].parent = 0;
}
-static void
-gs_object_npc_wear_unchecked(sc_gameref_t gs, sc_int object, sc_int npc) {
+static void gs_object_npc_wear_unchecked(sc_gameref_t gs, sc_int object, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].position = OBJ_WORN_NPC;
gs->objects[object].parent = npc;
}
-static void
-gs_object_to_room_unchecked(sc_gameref_t gs, sc_int object, sc_int room) {
+static void gs_object_to_room_unchecked(sc_gameref_t gs, sc_int object, sc_int room) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
gs->objects[object].position = room + 1;
gs->objects[object].parent = -1;
}
-void
-gs_object_move_onto(sc_gameref_t gs, sc_int object, sc_int onto) {
+void gs_object_move_onto(sc_gameref_t gs, sc_int object, sc_int onto) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
if (gs->objects[object].position != OBJ_ON_OBJECT
|| gs->objects[object].parent != onto) {
@@ -384,8 +335,7 @@ gs_object_move_onto(sc_gameref_t gs, sc_int object, sc_int onto) {
}
}
-void
-gs_object_move_into(sc_gameref_t gs, sc_int object, sc_int into) {
+void gs_object_move_into(sc_gameref_t gs, sc_int object, sc_int into) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
if (gs->objects[object].position != OBJ_IN_OBJECT
|| gs->objects[object].parent != into) {
@@ -394,8 +344,7 @@ gs_object_move_into(sc_gameref_t gs, sc_int object, sc_int into) {
}
}
-void
-gs_object_make_hidden(sc_gameref_t gs, sc_int object) {
+void gs_object_make_hidden(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
if (gs->objects[object].position != OBJ_HIDDEN) {
gs_object_make_hidden_unchecked(gs, object);
@@ -403,8 +352,7 @@ gs_object_make_hidden(sc_gameref_t gs, sc_int object) {
}
}
-void
-gs_object_player_get(sc_gameref_t gs, sc_int object) {
+void gs_object_player_get(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
if (gs->objects[object].position != OBJ_HELD_PLAYER) {
gs_object_player_get_unchecked(gs, object);
@@ -412,8 +360,7 @@ gs_object_player_get(sc_gameref_t gs, sc_int object) {
}
}
-void
-gs_object_npc_get(sc_gameref_t gs, sc_int object, sc_int npc) {
+void gs_object_npc_get(sc_gameref_t gs, sc_int object, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
if (gs->objects[object].position != OBJ_HELD_NPC
|| gs->objects[object].parent != npc) {
@@ -422,8 +369,7 @@ gs_object_npc_get(sc_gameref_t gs, sc_int object, sc_int npc) {
}
}
-void
-gs_object_player_wear(sc_gameref_t gs, sc_int object) {
+void gs_object_player_wear(sc_gameref_t gs, sc_int object) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
if (gs->objects[object].position != OBJ_WORN_PLAYER) {
gs_object_player_wear_unchecked(gs, object);
@@ -431,8 +377,7 @@ gs_object_player_wear(sc_gameref_t gs, sc_int object) {
}
}
-void
-gs_object_npc_wear(sc_gameref_t gs, sc_int object, sc_int npc) {
+void gs_object_npc_wear(sc_gameref_t gs, sc_int object, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
if (gs->objects[object].position != OBJ_WORN_NPC
|| gs->objects[object].parent != npc) {
@@ -441,8 +386,7 @@ gs_object_npc_wear(sc_gameref_t gs, sc_int object, sc_int npc) {
}
}
-void
-gs_object_to_room(sc_gameref_t gs, sc_int object, sc_int room) {
+void gs_object_to_room(sc_gameref_t gs, sc_int object, sc_int room) {
assert(gs_is_game_valid(gs) && gs_in_range(object, gs->object_count));
if (gs->objects[object].position != room + 1) {
gs_object_to_room_unchecked(gs, object, room);
@@ -454,83 +398,70 @@ gs_object_to_room(sc_gameref_t gs, sc_int object, sc_int room) {
/*
* Game accessors and mutators for NPCs.
*/
-sc_int
-gs_npc_count(sc_gameref_t gs) {
+sc_int gs_npc_count(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
return gs->npc_count;
}
-void
-gs_set_npc_location(sc_gameref_t gs, sc_int npc, sc_int location) {
+void gs_set_npc_location(sc_gameref_t gs, sc_int npc, sc_int location) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
gs->npcs[npc].location = location;
}
-sc_int
-gs_npc_location(sc_gameref_t gs, sc_int npc) {
+sc_int gs_npc_location(sc_gameref_t gs, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
return gs->npcs[npc].location;
}
-void
-gs_set_npc_position(sc_gameref_t gs, sc_int npc, sc_int position) {
+void gs_set_npc_position(sc_gameref_t gs, sc_int npc, sc_int position) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
gs->npcs[npc].position = position;
}
-sc_int
-gs_npc_position(sc_gameref_t gs, sc_int npc) {
+sc_int gs_npc_position(sc_gameref_t gs, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
return gs->npcs[npc].position;
}
-void
-gs_set_npc_parent(sc_gameref_t gs, sc_int npc, sc_int parent) {
+void gs_set_npc_parent(sc_gameref_t gs, sc_int npc, sc_int parent) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
gs->npcs[npc].parent = parent;
}
-sc_int
-gs_npc_parent(sc_gameref_t gs, sc_int npc) {
+sc_int gs_npc_parent(sc_gameref_t gs, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
return gs->npcs[npc].parent;
}
-void
-gs_set_npc_seen(sc_gameref_t gs, sc_int npc, sc_bool seen) {
+void gs_set_npc_seen(sc_gameref_t gs, sc_int npc, sc_bool seen) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
gs->npcs[npc].seen = seen;
}
-sc_bool
-gs_npc_seen(sc_gameref_t gs, sc_int npc) {
+sc_bool gs_npc_seen(sc_gameref_t gs, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
return gs->npcs[npc].seen;
}
-sc_int
-gs_npc_walkstep_count(sc_gameref_t gs, sc_int npc) {
+sc_int gs_npc_walkstep_count(sc_gameref_t gs, sc_int npc) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count));
return gs->npcs[npc].walkstep_count;
}
-void
-gs_set_npc_walkstep(sc_gameref_t gs,
+void gs_set_npc_walkstep(sc_gameref_t gs,
sc_int npc, sc_int walk, sc_int walkstep) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count)
&& gs_in_range(walk, gs->npcs[npc].walkstep_count));
gs->npcs[npc].walksteps[walk] = walkstep;
}
-sc_int
-gs_npc_walkstep(sc_gameref_t gs, sc_int npc, sc_int walk) {
+sc_int gs_npc_walkstep(sc_gameref_t gs, sc_int npc, sc_int walk) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count)
&& gs_in_range(walk, gs->npcs[npc].walkstep_count));
return gs->npcs[npc].walksteps[walk];
}
-void
-gs_decrement_npc_walkstep(sc_gameref_t gs, sc_int npc, sc_int walk) {
+void gs_decrement_npc_walkstep(sc_gameref_t gs, sc_int npc, sc_int walk) {
assert(gs_is_game_valid(gs) && gs_in_range(npc, gs->npc_count)
&& gs_in_range(walk, gs->npcs[npc].walkstep_count));
gs->npcs[npc].walksteps[walk]--;
@@ -540,29 +471,25 @@ gs_decrement_npc_walkstep(sc_gameref_t gs, sc_int npc, sc_int walk) {
/*
* Convenience functions for bulk clearance of references.
*/
-void
-gs_clear_npc_references(sc_gameref_t gs) {
+void gs_clear_npc_references(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
memset(gs->npc_references,
FALSE, gs->npc_count * sizeof(*gs->npc_references));
}
-void
-gs_clear_object_references(sc_gameref_t gs) {
+void gs_clear_object_references(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
memset(gs->object_references,
FALSE, gs->object_count * sizeof(*gs->object_references));
}
-void
-gs_set_multiple_references(sc_gameref_t gs) {
+void gs_set_multiple_references(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
memset(gs->multiple_references,
TRUE, gs->object_count * sizeof(*gs->multiple_references));
}
-void
-gs_clear_multiple_references(sc_gameref_t gs) {
+void gs_clear_multiple_references(sc_gameref_t gs) {
assert(gs_is_game_valid(gs));
memset(gs->multiple_references,
FALSE, gs->object_count * sizeof(*gs->multiple_references));
@@ -574,9 +501,7 @@ gs_clear_multiple_references(sc_gameref_t gs) {
*
* Create and initialize a game state.
*/
-sc_gameref_t
-gs_create(sc_var_setref_t vars,
- sc_prop_setref_t bundle, sc_filterref_t filter) {
+sc_gameref_t gs_create(sc_var_setref_t vars, sc_prop_setref_t bundle, sc_filterref_t filter) {
sc_gameref_t game;
sc_vartype_t vt_key[4];
sc_int index_, bytes;
@@ -871,8 +796,7 @@ gs_create(sc_var_setref_t vars,
*
* Return TRUE if pointer is a valid game, FALSE otherwise.
*/
-sc_bool
-gs_is_game_valid(sc_gameref_t game) {
+sc_bool gs_is_game_valid(sc_gameref_t game) {
return game && game->magic == GAME_MAGIC;
}
@@ -883,8 +807,7 @@ gs_is_game_valid(sc_gameref_t game) {
* Helper for gs_copy(), copies one malloc'ed string to another, or NULL
* if from is NULL, taking care not to leak memory.
*/
-static void
-gs_string_copy(sc_char **to_string, const sc_char *from_string) {
+static void gs_string_copy(sc_char **to_string, const sc_char *from_string) {
/* Free any current contents of to_string. */
sc_free(*to_string);
@@ -903,8 +826,7 @@ gs_string_copy(sc_char **to_string, const sc_char *from_string) {
* Deep-copy the dynamic parts of a game onto another existing
* game structure.
*/
-void
-gs_copy(sc_gameref_t to, sc_gameref_t from) {
+void gs_copy(sc_gameref_t to, sc_gameref_t from) {
const sc_prop_setref_t bundle = from->bundle;
sc_vartype_t vt_key[3];
sc_int var_count, var, npc;
@@ -1048,8 +970,7 @@ gs_copy(sc_gameref_t to, sc_gameref_t from) {
*
* Free all the memory associated with a game state.
*/
-void
-gs_destroy(sc_gameref_t game) {
+void gs_destroy(sc_gameref_t game) {
sc_int npc;
assert(gs_is_game_valid(game));
diff --git a/engines/glk/adrift/scinterf.cpp b/engines/glk/adrift/scinterf.cpp
index c5e53e959d..ff7456b120 100644
--- a/engines/glk/adrift/scinterf.cpp
+++ b/engines/glk/adrift/scinterf.cpp
@@ -45,8 +45,7 @@ static sc_uint if_trace_flags = 0;
* First-time runtime checks for the overall interpreter. This function
* tries to ensure correct compile options.
*/
-static void
-if_initialize(void) {
+static void if_initialize(void) {
static sc_bool initialized = FALSE;
/* Only do checks on the first call. */
@@ -79,13 +78,11 @@ if_initialize(void) {
* Set and retrieve tracing flags. Setting new values propagates the new
* tracing setting to all modules that support it.
*/
-static sc_bool
-if_bool(sc_uint flag) {
+static sc_bool if_bool(sc_uint flag) {
return flag ? TRUE : FALSE;
}
-void
-sc_set_trace_flags(sc_uint trace_flags) {
+void sc_set_trace_flags(sc_uint trace_flags) {
if_initialize();
/* Save the value for queries. */
@@ -105,8 +102,7 @@ sc_set_trace_flags(sc_uint trace_flags) {
pf_debug_trace(if_bool(trace_flags & SC_TRACE_PRINTFILTER));
}
-sc_bool
-if_get_trace_flag(sc_uint bitmask) {
+sc_bool if_get_trace_flag(sc_uint bitmask) {
return if_bool(if_trace_flags & bitmask);
}
@@ -122,28 +118,22 @@ if_get_trace_flag(sc_uint bitmask) {
*
* Call OS-specific print function for the given arguments.
*/
-static void
-if_print_string_common(const sc_char *string,
- void (*print_string_function)(const sc_char *)) {
+static void if_print_string_common(const sc_char *string, void (*print_string_function)(const sc_char *)) {
assert(string);
if (string[0] != NUL)
print_string_function(string);
}
-void
-if_print_string(const sc_char *string) {
+void if_print_string(const sc_char *string) {
if_print_string_common(string, os_print_string);
}
-void
-if_print_debug(const sc_char *string) {
+void if_print_debug(const sc_char *string) {
if_print_string_common(string, os_print_string_debug);
}
-static void
-if_print_character_common(sc_char character,
- void (*print_string_function)(const sc_char *)) {
+static void if_print_character_common(sc_char character, void (*print_string_function)(const sc_char *)) {
if (character != NUL) {
sc_char buffer[2];
@@ -153,18 +143,15 @@ if_print_character_common(sc_char character,
}
}
-void
-if_print_character(sc_char character) {
+void if_print_character(sc_char character) {
if_print_character_common(character, os_print_string);
}
-void
-if_print_debug_character(sc_char character) {
+void if_print_debug_character(sc_char character) {
if_print_character_common(character, os_print_string_debug);
}
-void
-if_print_tag(sc_int tag, const sc_char *arg) {
+void if_print_tag(sc_int tag, const sc_char *arg) {
assert(arg);
os_print_tag(tag, arg);
@@ -179,9 +166,8 @@ if_print_tag(sc_int tag, const sc_char *arg) {
* Call OS-specific line read function. Clean up any read data a little
* before returning it to the caller.
*/
-static void
-if_read_line_common(sc_char *buffer, sc_int length,
- sc_bool(*read_line_function)(sc_char *, sc_int)) {
+static void if_read_line_common(sc_char *buffer, sc_int length,
+ sc_bool(*read_line_function)(sc_char *, sc_int)) {
sc_bool is_line_available;
sc_int last;
assert(buffer && length > 0);
@@ -204,13 +190,11 @@ if_read_line_common(sc_char *buffer, sc_int length,
buffer[last--] = NUL;
}
-void
-if_read_line(sc_char *buffer, sc_int length) {
+void if_read_line(sc_char *buffer, sc_int length) {
if_read_line_common(buffer, length, os_read_line);
}
-void
-if_read_debug(sc_char *buffer, sc_int length) {
+void if_read_debug(sc_char *buffer, sc_int length) {
if_read_line_common(buffer, length, os_read_line_debug);
}
@@ -220,8 +204,7 @@ if_read_debug(sc_char *buffer, sc_int length) {
*
* Call OS-specific confirm function.
*/
-sc_bool
-if_confirm(sc_int type) {
+sc_bool if_confirm(sc_int type) {
return os_confirm(type);
}
@@ -234,27 +217,23 @@ if_confirm(sc_int type) {
*
* Call OS-specific functions for saving and restoring games.
*/
-void *
-if_open_saved_game(sc_bool is_save) {
+void *if_open_saved_game(sc_bool is_save) {
return os_open_file(is_save);
}
-void
-if_write_saved_game(void *opaque, const sc_byte *buffer, sc_int length) {
+void if_write_saved_game(void *opaque, const sc_byte *buffer, sc_int length) {
assert(buffer);
os_write_file(opaque, buffer, length);
}
-sc_int
-if_read_saved_game(void *opaque, sc_byte *buffer, sc_int length) {
+sc_int if_read_saved_game(void *opaque, sc_byte *buffer, sc_int length) {
assert(buffer);
return os_read_file(opaque, buffer, length);
}
-void
-if_close_saved_game(void *opaque) {
+void if_close_saved_game(void *opaque) {
os_close_file(opaque);
}
@@ -264,8 +243,7 @@ if_close_saved_game(void *opaque) {
*
* Call OS-specific hint display function.
*/
-void
-if_display_hints(sc_gameref_t game) {
+void if_display_hints(sc_gameref_t game) {
assert(gs_is_game_valid(game));
os_display_hints((sc_game) game);
@@ -278,18 +256,15 @@ if_display_hints(sc_gameref_t game) {
*
* Call OS-specific sound and graphic handler functions.
*/
-void
-if_update_sound(const sc_char *filename,
- sc_int sound_offset, sc_int sound_length,
- sc_bool is_looping) {
+void if_update_sound(const sc_char *filename, sc_int sound_offset, sc_int sound_length,
+ sc_bool is_looping) {
if (strlen(filename) > 0)
os_play_sound(filename, sound_offset, sound_length, is_looping);
else
os_stop_sound();
}
-void
-if_update_graphic(const sc_char *filename,
+void if_update_graphic(const sc_char *filename,
sc_int graphic_offset, sc_int graphic_length) {
os_show_graphic(filename, graphic_offset, graphic_length);
}
@@ -301,14 +276,12 @@ if_update_graphic(const sc_char *filename,
*
* Return a version string and Adrift emulation level.
*/
-const sc_char *
-sc_scare_version(void) {
+const sc_char *sc_scare_version(void) {
if_initialize();
return "SCARE " SCARE_VERSION SCARE_PATCH_LEVEL;
}
-sc_int
-sc_scare_emulation(void) {
+sc_int sc_scare_emulation(void) {
if_initialize();
return SCARE_EMULATION;
}
@@ -321,8 +294,7 @@ sc_scare_emulation(void) {
* Standard FILE* reader and writer callback for constructing callback-style
* calls from filename and stream variants.
*/
-static sc_int
-if_file_read_callback(void *opaque, sc_byte *buffer, sc_int length) {
+static sc_int if_file_read_callback(void *opaque, sc_byte *buffer, sc_int length) {
Common::SeekableReadStream *stream = (Common::SeekableReadStream *)opaque;
sc_int bytes;
@@ -350,8 +322,7 @@ static void if_file_write_callback(void *opaque, const sc_byte *buffer, sc_int l
* Called by the OS-specific layer to create a run context. The _filename()
* and _stream() variants are adapters for run_create().
*/
-sc_game
-sc_game_from_filename(const sc_char *filename) {
+sc_game sc_game_from_filename(const sc_char *filename) {
Common::File *stream;
sc_game game;
@@ -384,9 +355,7 @@ sc_game sc_game_from_stream(Common::SeekableReadStream *stream) {
return run_create(if_file_read_callback, stream);
}
-sc_game
-sc_game_from_callback(sc_int(*callback)(void *, sc_byte *, sc_int),
- void *opaque) {
+sc_game sc_game_from_callback(sc_int(*callback)(void *, sc_byte *, sc_int), void *opaque) {
if_initialize();
if (!callback) {
sc_error("sc_game_from_callback: nullptr callback\n");
@@ -403,8 +372,7 @@ sc_game_from_callback(sc_int(*callback)(void *, sc_byte *, sc_int),
* Common function to verify that the game passed in to functions below
* is a valid game. Returns TRUE on game error, FALSE if okay.
*/
-static sc_bool
-if_game_error(sc_gameref_t game, const sc_char *function_name) {
+static sc_bool if_game_error(sc_gameref_t game, const sc_char *function_name) {
/* Check for invalid game -- null pointer or bad magic. */
if (!gs_is_game_valid(game)) {
if (game)
@@ -435,8 +403,7 @@ if_game_error(sc_gameref_t game, const sc_char *function_name) {
* behaving like sc_restart_game()), but will return if the game could not
* be restored. sc_undo_game_turn() behaves like sc_load_game().
*/
-void
-sc_interpret_game(sc_game game) {
+void sc_interpret_game(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_interpret_game"))
@@ -445,8 +412,7 @@ sc_interpret_game(sc_game game) {
run_interpret(game_);
}
-void
-sc_restart_game(sc_game game) {
+void sc_restart_game(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_restart_game"))
@@ -455,8 +421,7 @@ sc_restart_game(sc_game game) {
run_restart(game_);
}
-sc_bool
-sc_save_game(sc_game game) {
+sc_bool sc_save_game(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_save_game"))
@@ -465,8 +430,7 @@ sc_save_game(sc_game game) {
return run_save_prompted(game_);
}
-sc_bool
-sc_load_game(sc_game game) {
+sc_bool sc_load_game(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_load_game"))
@@ -475,8 +439,7 @@ sc_load_game(sc_game game) {
return run_restore_prompted(game_);
}
-sc_bool
-sc_undo_game_turn(sc_game game) {
+sc_bool sc_undo_game_turn(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_undo_game_turn"))
@@ -485,8 +448,7 @@ sc_undo_game_turn(sc_game game) {
return run_undo(game_);
}
-void
-sc_quit_game(sc_game game) {
+void sc_quit_game(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_quit_game"))
@@ -510,8 +472,7 @@ sc_quit_game(sc_game game) {
* These alternative forms allow the caller to directly specify the data
* streams.
*/
-sc_bool
-sc_save_game_to_filename(sc_game game, const sc_char *filename) {
+sc_bool sc_save_game_to_filename(sc_game game, const sc_char *filename) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
Common::OutSaveFile *sf;
@@ -536,8 +497,7 @@ sc_save_game_to_filename(sc_game game, const sc_char *filename) {
return TRUE;
}
-void
-sc_save_game_to_stream(sc_game game, Common::SeekableReadStream *stream) {
+void sc_save_game_to_stream(sc_game game, Common::SeekableReadStream *stream) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_save_game_to_stream"))
@@ -551,10 +511,8 @@ sc_save_game_to_stream(sc_game game, Common::SeekableReadStream *stream) {
run_save(game_, if_file_write_callback, stream);
}
-void
-sc_save_game_to_callback(sc_game game,
- void (*callback)(void *, const sc_byte *, sc_int),
- void *opaque) {
+void sc_save_game_to_callback(sc_game game,
+ void (*callback)(void *, const sc_byte *, sc_int), void *opaque) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_save_game_to_callback"))
@@ -568,8 +526,7 @@ sc_save_game_to_callback(sc_game game,
run_save(game_, callback, opaque);
}
-sc_bool
-sc_load_game_from_filename(sc_game game, const sc_char *filename) {
+sc_bool sc_load_game_from_filename(sc_game game, const sc_char *filename) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
Common::InSaveFile *sf;
sc_bool status;
@@ -594,8 +551,7 @@ sc_load_game_from_filename(sc_game game, const sc_char *filename) {
return status;
}
-sc_bool
-sc_load_game_from_stream(sc_game game, Common::SeekableReadStream *stream) {
+sc_bool sc_load_game_from_stream(sc_game game, Common::SeekableReadStream *stream) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_load_game_from_stream"))
@@ -609,10 +565,8 @@ sc_load_game_from_stream(sc_game game, Common::SeekableReadStream *stream) {
return run_restore(game_, if_file_read_callback, stream);
}
-sc_bool
-sc_load_game_from_callback(sc_game game,
- sc_int(*callback)(void *, sc_byte *, sc_int),
- void *opaque) {
+sc_bool sc_load_game_from_callback(sc_game game,
+ sc_int(*callback)(void *, sc_byte *, sc_int), void *opaque) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_load_game_from_callback"))
@@ -632,8 +586,7 @@ sc_load_game_from_callback(sc_game game,
*
* Called by the OS-specific layer to free run context memory.
*/
-void
-sc_free_game(sc_game game) {
+void sc_free_game(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_free_game"))
@@ -662,8 +615,7 @@ sc_free_game(sc_game game) {
*
* Return a few attributes of a game.
*/
-sc_bool
-sc_is_game_running(sc_game game) {
+sc_bool sc_is_game_running(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_is_game_running"))
@@ -672,8 +624,7 @@ sc_is_game_running(sc_game game) {
return run_is_running(game_);
}
-const sc_char *
-sc_get_game_name(sc_game game) {
+const sc_char *sc_get_game_name(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_char *retval;
@@ -700,8 +651,7 @@ sc_get_game_author(sc_game game) {
return retval;
}
-const sc_char *
-sc_get_game_compile_date(sc_game game) {
+const sc_char *sc_get_game_compile_date(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_char *retval;
@@ -713,8 +663,7 @@ sc_get_game_compile_date(sc_game game) {
return retval;
}
-sc_int
-sc_get_game_turns(sc_game game) {
+sc_int sc_get_game_turns(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_int retval;
@@ -726,8 +675,7 @@ sc_get_game_turns(sc_game game) {
return retval;
}
-sc_int
-sc_get_game_score(sc_game game) {
+sc_int sc_get_game_score(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_int retval;
@@ -739,8 +687,7 @@ sc_get_game_score(sc_game game) {
return retval;
}
-sc_int
-sc_get_game_max_score(sc_game game) {
+sc_int sc_get_game_max_score(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_int retval;
@@ -752,8 +699,7 @@ sc_get_game_max_score(sc_game game) {
return retval;
}
-const sc_char *
-sc_get_game_room(sc_game game) {
+const sc_char *sc_get_game_room(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_char *retval;
@@ -765,8 +711,7 @@ sc_get_game_room(sc_game game) {
return retval;
}
-const sc_char *
-sc_get_game_status_line(sc_game game) {
+const sc_char *sc_get_game_status_line(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_char *retval;
@@ -778,8 +723,7 @@ sc_get_game_status_line(sc_game game) {
return retval;
}
-const sc_char *
-sc_get_game_preferred_font(sc_game game) {
+const sc_char *sc_get_game_preferred_font(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_char *retval;
@@ -791,8 +735,7 @@ sc_get_game_preferred_font(sc_game game) {
return retval;
}
-sc_bool
-sc_get_game_bold_room_names(sc_game game) {
+sc_bool sc_get_game_bold_room_names(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_bool retval;
@@ -804,8 +747,7 @@ sc_get_game_bold_room_names(sc_game game) {
return retval;
}
-sc_bool
-sc_get_game_verbose(sc_game game) {
+sc_bool sc_get_game_verbose(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_bool retval;
@@ -817,8 +759,7 @@ sc_get_game_verbose(sc_game game) {
return retval;
}
-sc_bool
-sc_get_game_notify_score_change(sc_game game) {
+sc_bool sc_get_game_notify_score_change(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_bool retval;
@@ -830,8 +771,7 @@ sc_get_game_notify_score_change(sc_game game) {
return retval;
}
-sc_bool
-sc_has_game_completed(sc_game game) {
+sc_bool sc_has_game_completed(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_has_game_completed"))
@@ -840,8 +780,7 @@ sc_has_game_completed(sc_game game) {
return run_has_completed(game_);
}
-sc_bool
-sc_is_game_undo_available(sc_game game) {
+sc_bool sc_is_game_undo_available(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_is_game_undo_available"))
@@ -858,8 +797,7 @@ sc_is_game_undo_available(sc_game game) {
*
* Set a few attributes of a game.
*/
-void
-sc_set_game_bold_room_names(sc_game game, sc_bool flag) {
+void sc_set_game_bold_room_names(sc_game game, sc_bool flag) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_bool bold, verbose, notify;
@@ -871,8 +809,7 @@ sc_set_game_bold_room_names(sc_game game, sc_bool flag) {
run_set_attributes(game_, flag, verbose, notify);
}
-void
-sc_set_game_verbose(sc_game game, sc_bool flag) {
+void sc_set_game_verbose(sc_game game, sc_bool flag) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_bool bold, verbose, notify;
@@ -884,8 +821,7 @@ sc_set_game_verbose(sc_game game, sc_bool flag) {
run_set_attributes(game_, bold, flag, notify);
}
-void
-sc_set_game_notify_score_change(sc_game game, sc_bool flag) {
+void sc_set_game_notify_score_change(sc_game game, sc_bool flag) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
sc_bool bold, verbose, notify;
@@ -904,8 +840,7 @@ sc_set_game_notify_score_change(sc_game game, sc_bool flag) {
*
* Indicate the game's use of resources.
*/
-sc_bool
-sc_does_game_use_sounds(sc_game game) {
+sc_bool sc_does_game_use_sounds(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_does_game_use_sounds"))
@@ -914,8 +849,7 @@ sc_does_game_use_sounds(sc_game game) {
return res_has_sound(game_);
}
-sc_bool
-sc_does_game_use_graphics(sc_game game) {
+sc_bool sc_does_game_use_graphics(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_does_game_use_graphics"))
@@ -934,8 +868,7 @@ sc_does_game_use_graphics(sc_game game) {
*
* Iterate currently available hints, and return strings for a hint.
*/
-sc_game_hint
-sc_get_first_game_hint(sc_game game) {
+sc_game_hint sc_get_first_game_hint(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_get_first_game_hint"))
@@ -944,8 +877,7 @@ sc_get_first_game_hint(sc_game game) {
return run_hint_iterate(game_, nullptr);
}
-sc_game_hint
-sc_get_next_game_hint(sc_game game, sc_game_hint hint) {
+sc_game_hint sc_get_next_game_hint(sc_game game, sc_game_hint hint) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_hintref_t hint_ = (const sc_hintref_t)hint;
@@ -959,8 +891,7 @@ sc_get_next_game_hint(sc_game game, sc_game_hint hint) {
return run_hint_iterate(game_, hint_);
}
-const sc_char *
-sc_get_game_hint_question(sc_game game, sc_game_hint hint) {
+const sc_char *sc_get_game_hint_question(sc_game game, sc_game_hint hint) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_hintref_t hint_ = (const sc_hintref_t)hint;
@@ -974,8 +905,7 @@ sc_get_game_hint_question(sc_game game, sc_game_hint hint) {
return run_get_hint_question(game_, hint_);
}
-const sc_char *
-sc_get_game_subtle_hint(sc_game game, sc_game_hint hint) {
+const sc_char *sc_get_game_subtle_hint(sc_game game, sc_game_hint hint) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_hintref_t hint_ = (const sc_hintref_t)hint;
@@ -989,8 +919,7 @@ sc_get_game_subtle_hint(sc_game game, sc_game_hint hint) {
return run_get_subtle_hint(game_, hint_);
}
-const sc_char *
-sc_get_game_unsubtle_hint(sc_game game, sc_game_hint hint) {
+const sc_char *sc_get_game_unsubtle_hint(sc_game game, sc_game_hint hint) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
const sc_hintref_t hint_ = (const sc_hintref_t)hint;
@@ -1012,8 +941,7 @@ sc_get_game_unsubtle_hint(sc_game game, sc_game_hint hint) {
*
* Enable, disable, and query game debugging, and run a single debug command.
*/
-void
-sc_set_game_debugger_enabled(sc_game game, sc_bool flag) {
+void sc_set_game_debugger_enabled(sc_game game, sc_bool flag) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_set_game_debugger_enabled"))
@@ -1022,8 +950,7 @@ sc_set_game_debugger_enabled(sc_game game, sc_bool flag) {
debug_set_enabled(game_, flag);
}
-sc_bool
-sc_get_game_debugger_enabled(sc_game game) {
+sc_bool sc_get_game_debugger_enabled(sc_game game) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_get_game_debugger_enabled"))
@@ -1032,8 +959,7 @@ sc_get_game_debugger_enabled(sc_game game) {
return debug_get_enabled(game_);
}
-sc_bool
-sc_run_game_debugger_command(sc_game game, const sc_char *debug_command) {
+sc_bool sc_run_game_debugger_command(sc_game game, const sc_char *debug_command) {
const sc_gameref_t game_ = (const sc_gameref_t)game;
if (if_game_error(game_, "sc_run_game_debugger_command"))
@@ -1049,8 +975,7 @@ sc_run_game_debugger_command(sc_game game, const sc_char *debug_command) {
*
* Set the interpreter locale, and get the currently set locale.
*/
-sc_bool
-sc_set_locale(const sc_char *name) {
+sc_bool sc_set_locale(const sc_char *name) {
if (!name) {
sc_error("sc_set_locale: nullptr name\n");
return FALSE;
@@ -1059,8 +984,7 @@ sc_set_locale(const sc_char *name) {
return loc_set_locale(name);
}
-const sc_char *
-sc_get_locale(void) {
+const sc_char *sc_get_locale(void) {
return loc_get_locale();
}
@@ -1072,16 +996,14 @@ sc_get_locale(void) {
* Turn portable random number generation on and off, and supply a new seed
* for random number generators.
*/
-void
-sc_set_portable_random(sc_bool flag) {
+void sc_set_portable_random(sc_bool flag) {
if (flag)
sc_set_congruential_random();
else
sc_set_platform_random();
}
-void
-sc_reseed_random_sequence(sc_uint new_seed) {
+void sc_reseed_random_sequence(sc_uint new_seed) {
if (new_seed == 0) {
sc_error("sc_reseed_random_sequence: new_seed may not be 0\n");
return;
diff --git a/engines/glk/adrift/sclibrar.cpp b/engines/glk/adrift/sclibrar.cpp
index bfa1711aea..51e4224eeb 100644
--- a/engines/glk/adrift/sclibrar.cpp
+++ b/engines/glk/adrift/sclibrar.cpp
@@ -58,8 +58,7 @@ static sc_bool lib_trace = FALSE;
* directly rather than using the printfilter to avoid possible clashes
* with ALRs.
*/
-void
-lib_warn_battle_system(void) {
+void lib_warn_battle_system(void) {
if_print_tag(SC_TAG_FONT, "size=16");
if_print_string("SCARE WARNING");
if_print_tag(SC_TAG_ENDFONT, "");
@@ -85,8 +84,7 @@ lib_warn_battle_system(void) {
*
* Return a random member of a roomgroup.
*/
-sc_int
-lib_random_roomgroup_member(sc_gameref_t game, sc_int roomgroup) {
+sc_int lib_random_roomgroup_member(sc_gameref_t game, sc_int roomgroup) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
sc_int count, room;
@@ -119,8 +117,7 @@ lib_random_roomgroup_member(sc_gameref_t game, sc_int roomgroup) {
*
* Return TRUE if a particular alternate room description should be used.
*/
-static sc_bool
-lib_use_room_alt(sc_gameref_t game, sc_int room, sc_int alt) {
+static sc_bool lib_use_room_alt(sc_gameref_t game, sc_int room, sc_int alt) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int type;
@@ -247,8 +244,7 @@ lib_use_room_alt(sc_gameref_t game, sc_int room, sc_int alt) {
* the alts list when generating room names or descriptions. Returns -1 if
* no alt overrides the default room long description.
*/
-static sc_int
-lib_find_starting_alt(sc_gameref_t game, sc_int room) {
+static sc_int lib_find_starting_alt(sc_gameref_t game, sc_int room) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int alt_count, alt, retval;
@@ -305,8 +301,7 @@ lib_find_starting_alt(sc_gameref_t game, sc_int room) {
*
* Get/print out the name for a given room.
*/
-const sc_char *
-lib_get_room_name(sc_gameref_t game, sc_int room) {
+const sc_char *lib_get_room_name(sc_gameref_t game, sc_int room) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int alt_count, alt, start;
@@ -357,8 +352,7 @@ lib_get_room_name(sc_gameref_t game, sc_int room) {
return name;
}
-void
-lib_print_room_name(sc_gameref_t game, sc_int room) {
+void lib_print_room_name(sc_gameref_t game, sc_int room) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_char *name;
@@ -382,8 +376,7 @@ lib_print_room_name(sc_gameref_t game, sc_int room) {
* prefix -- any "a"/"an"/"some" is replaced by "the" -- and with the full
* prefix.
*/
-static void
-lib_print_object_np(sc_gameref_t game, sc_int object) {
+static void lib_print_object_np(sc_gameref_t game, sc_int object) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -448,8 +441,7 @@ lib_print_object_np(sc_gameref_t game, sc_int object) {
pf_buffer_string(filter, name);
}
-static void
-lib_print_object(sc_gameref_t game, sc_int object) {
+static void lib_print_object(sc_gameref_t game, sc_int object) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -483,8 +475,7 @@ lib_print_object(sc_gameref_t game, sc_int object) {
* Convenience functions to print out an NPC's name, with and without
* any prefix.
*/
-static void
-lib_print_npc_np(sc_gameref_t game, sc_int npc) {
+static void lib_print_npc_np(sc_gameref_t game, sc_int npc) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -500,8 +491,7 @@ lib_print_npc_np(sc_gameref_t game, sc_int npc) {
}
#if 0
-static void
-lib_print_npc(sc_gameref_t game, sc_int npc) {
+static void lib_print_npc(sc_gameref_t game, sc_int npc) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -530,11 +520,8 @@ lib_print_npc(sc_gameref_t game, sc_int npc) {
* Convenience functions for multiple handlers. Returns the appropriate
* response string for a game, based on perspective or object plurality.
*/
-static const sc_char *
-lib_select_response(sc_gameref_t game,
- const sc_char *second_person,
- const sc_char *first_person,
- const sc_char *third_person) {
+static const sc_char *lib_select_response(sc_gameref_t game,
+ const sc_char *second_person, const sc_char *first_person, const sc_char *third_person) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
sc_int perspective;
@@ -564,9 +551,8 @@ lib_select_response(sc_gameref_t game,
return response;
}
-static const sc_char *
-lib_select_plurality(sc_gameref_t game, sc_int object,
- const sc_char *singular, const sc_char *plural) {
+static const sc_char *lib_select_plurality(sc_gameref_t game, sc_int object,
+ const sc_char *singular, const sc_char *plural) {
return obj_appears_plural(game, object) ? plural : singular;
}
@@ -578,8 +564,7 @@ lib_select_plurality(sc_gameref_t game, sc_int object,
* gone walkabout and offers a changed description, return that; otherwise
* return the standard inroom text.
*/
-static const sc_char *
-lib_get_npc_inroom_text(sc_gameref_t game, sc_int npc) {
+static const sc_char *lib_get_npc_inroom_text(sc_gameref_t game, sc_int npc) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int walk_count, walk;
@@ -617,8 +602,7 @@ lib_get_npc_inroom_text(sc_gameref_t game, sc_int npc) {
*
* Print a list of the contents of a room.
*/
-static void
-lib_print_room_contents(sc_gameref_t game, sc_int room) {
+static void lib_print_room_contents(sc_gameref_t game, sc_int room) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
@@ -775,8 +759,7 @@ lib_print_room_contents(sc_gameref_t game, sc_int room) {
*
* Print out the long description for a given room.
*/
-void
-lib_print_room_description(sc_gameref_t game, sc_int room) {
+void lib_print_room_description(sc_gameref_t game, sc_int room) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
@@ -917,8 +900,7 @@ lib_print_room_description(sc_gameref_t game, sc_int room) {
*
* Return TRUE if the player can move in the given direction.
*/
-static sc_bool
-lib_can_go(sc_gameref_t game, sc_int room, sc_int direction) {
+static sc_bool lib_can_go(sc_gameref_t game, sc_int room, sc_int direction) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int restriction;
@@ -1036,8 +1018,7 @@ static const sc_char *const DIRNAMES_8[] = {
*
* Print a list of exits from the player room.
*/
-sc_bool
-lib_cmd_print_room_exits(sc_gameref_t game) {
+sc_bool lib_cmd_print_room_exits(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
@@ -1115,8 +1096,7 @@ lib_cmd_print_room_exits(sc_gameref_t game) {
* Print out details of the player room, in brief if verbose not set and the
* room has already been visited.
*/
-static void
-lib_describe_player_room(sc_gameref_t game, sc_bool force_verbose) {
+static void lib_describe_player_room(sc_gameref_t game, sc_bool force_verbose) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
@@ -1149,8 +1129,7 @@ lib_describe_player_room(sc_gameref_t game, sc_bool force_verbose) {
*
* Command handler for "look" command.
*/
-sc_bool
-lib_cmd_look(sc_gameref_t game) {
+sc_bool lib_cmd_look(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_character(filter, '\n');
@@ -1164,8 +1143,7 @@ lib_cmd_look(sc_gameref_t game) {
*
* Called on "quit". Exits from the game main loop.
*/
-sc_bool
-lib_cmd_quit(sc_gameref_t game) {
+sc_bool lib_cmd_quit(sc_gameref_t game) {
if (if_confirm(SC_CONF_QUIT))
game->is_running = FALSE;
@@ -1180,8 +1158,7 @@ lib_cmd_quit(sc_gameref_t game) {
* Called on "restart". Exits from the game main loop with restart
* request set.
*/
-sc_bool
-lib_cmd_restart(sc_gameref_t game) {
+sc_bool lib_cmd_restart(sc_gameref_t game) {
if (if_confirm(SC_CONF_RESTART)) {
game->is_running = FALSE;
game->do_restart = TRUE;
@@ -1197,8 +1174,7 @@ lib_cmd_restart(sc_gameref_t game) {
*
* Called on "undo". Restores any undo game or memo to the main game.
*/
-sc_bool
-lib_cmd_undo(sc_gameref_t game) {
+sc_bool lib_cmd_undo(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_memo_setref_t memento = gs_get_memento(game);
@@ -1246,8 +1222,7 @@ lib_cmd_undo(sc_gameref_t game) {
* Prints a history of saved commands for the game. Print directly rather
* than using the printfilter to avoid possible clashes with ALRs.
*/
-static sc_bool
-lib_cmd_history_common(sc_gameref_t game, sc_int limit) {
+static sc_bool lib_cmd_history_common(sc_gameref_t game, sc_int limit) {
const sc_var_setref_t vars = gs_get_vars(game);
const sc_memo_setref_t memento = gs_get_memento(game);
sc_int first, count, timestamp;
@@ -1319,8 +1294,7 @@ lib_cmd_history_common(sc_gameref_t game, sc_int limit) {
return TRUE;
}
-sc_bool
-lib_cmd_history_number(sc_gameref_t game) {
+sc_bool lib_cmd_history_number(sc_gameref_t game) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_int limit;
@@ -1336,8 +1310,7 @@ lib_cmd_history_number(sc_gameref_t game) {
return lib_cmd_history_common(game, limit);
}
-sc_bool
-lib_cmd_history(sc_gameref_t game) {
+sc_bool lib_cmd_history(sc_gameref_t game) {
return lib_cmd_history_common(game, 0);
}
@@ -1353,8 +1326,7 @@ lib_cmd_history(sc_gameref_t game) {
* flag. The others allow the user to select a command from the history list
* to re-run.
*/
-sc_bool
-lib_cmd_again(sc_gameref_t game) {
+sc_bool lib_cmd_again(sc_gameref_t game) {
game->do_again = TRUE;
game->redo_sequence = 0;
@@ -1362,8 +1334,7 @@ lib_cmd_again(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_redo_number(sc_gameref_t game) {
+sc_bool lib_cmd_redo_number(sc_gameref_t game) {
const sc_var_setref_t vars = gs_get_vars(game);
const sc_memo_setref_t memento = gs_get_memento(game);
sc_int sequence;
@@ -1398,8 +1369,7 @@ lib_cmd_redo_number(sc_gameref_t game) {
return TRUE;
}
-static sc_bool
-lib_cmd_redo_text_last_common(sc_gameref_t game, const sc_char *target) {
+static sc_bool lib_cmd_redo_text_last_common(sc_gameref_t game, const sc_char *target) {
const sc_memo_setref_t memento = gs_get_memento(game);
sc_bool is_do_last, is_contains;
sc_int length, matched_sequence;
@@ -1486,16 +1456,14 @@ lib_cmd_redo_text_last_common(sc_gameref_t game, const sc_char *target) {
return TRUE;
}
-sc_bool
-lib_cmd_redo_text(sc_gameref_t game) {
+sc_bool lib_cmd_redo_text(sc_gameref_t game) {
const sc_var_setref_t vars = gs_get_vars(game);
/* Call the common redo with the referenced text from %text%. */
return lib_cmd_redo_text_last_common(game, var_get_ref_text(vars));
}
-sc_bool
-lib_cmd_redo_last(sc_gameref_t game) {
+sc_bool lib_cmd_redo_last(sc_gameref_t game) {
/* Call the common redo with, literally, "!", forming "!!" . */
return lib_cmd_redo_text_last_common(game, "!");
}
@@ -1506,8 +1474,7 @@ lib_cmd_redo_last(sc_gameref_t game) {
*
* Called on "hints". Requests the interface to display any available hints.
*/
-sc_bool
-lib_cmd_hints(sc_gameref_t game) {
+sc_bool lib_cmd_hints(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int task;
sc_bool game_has_hints;
@@ -1550,15 +1517,13 @@ lib_cmd_hints(sc_gameref_t game) {
*
* Convenience helpers for printing licensing and game information.
*/
-static void
-lib_print_string_bold(const sc_char *string) {
+static void lib_print_string_bold(const sc_char *string) {
if_print_tag(SC_TAG_BOLD, "");
if_print_string(string);
if_print_tag(SC_TAG_ENDBOLD, "");
}
-static void
-lib_print_string_italics(const sc_char *string) {
+static void lib_print_string_italics(const sc_char *string) {
if_print_tag(SC_TAG_ITALICS, "");
if_print_string(string);
if_print_tag(SC_TAG_ENDITALICS, "");
@@ -1573,8 +1538,7 @@ lib_print_string_italics(const sc_char *string) {
* and the GPL licensing. Print directly rather than using the printfilter
* to avoid possible clashes with ALRs.
*/
-sc_bool
-lib_cmd_help(sc_gameref_t game) {
+sc_bool lib_cmd_help(sc_gameref_t game) {
if_print_string(
"These are some of the typical commands used in this adventure:\n\n");
@@ -1626,8 +1590,7 @@ lib_cmd_help(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_license(sc_gameref_t game) {
+sc_bool lib_cmd_license(sc_gameref_t game) {
lib_print_string_bold("SCARE");
if_print_string(" is ");
lib_print_string_italics(
@@ -1671,8 +1634,7 @@ lib_cmd_license(sc_gameref_t game) {
* in real Adrift. Prints directly rather than using the printfilter to
* avoid possible clashes with ALRs.
*/
-sc_bool
-lib_cmd_information(sc_gameref_t game) {
+sc_bool lib_cmd_information(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[2];
@@ -1718,8 +1680,7 @@ lib_cmd_information(sc_gameref_t game) {
*
* Clear the main game window (almost).
*/
-sc_bool
-lib_cmd_clear(sc_gameref_t game) {
+sc_bool lib_cmd_clear(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_tag(filter, SC_TAG_CLS);
@@ -1736,8 +1697,7 @@ lib_cmd_clear(sc_gameref_t game) {
* interpreter builds that can't offer a true status line. Prints directly
* rather than using the printfilter to avoid possible clashes with ALRs.
*/
-sc_bool
-lib_cmd_statusline(sc_gameref_t game) {
+sc_bool lib_cmd_statusline(sc_gameref_t game) {
const sc_char *name, *author, *room, *status;
sc_int score;
@@ -1782,8 +1742,7 @@ lib_cmd_statusline(sc_gameref_t game) {
* Display the "Runner version". Prints directly rather than using the
* printfilter to avoid possible clashes with ALRs.
*/
-sc_bool
-lib_cmd_version(sc_gameref_t game) {
+sc_bool lib_cmd_version(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key;
sc_char buffer[64];
@@ -1822,8 +1781,7 @@ lib_cmd_version(sc_gameref_t game) {
* the game's setting. The latter prints directly rather than using the
* printfilter to avoid possible clashes with ALRs.
*/
-sc_bool
-lib_cmd_wait(sc_gameref_t game) {
+sc_bool lib_cmd_wait(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
@@ -1850,8 +1808,7 @@ lib_cmd_wait(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_wait_number(sc_gameref_t game) {
+sc_bool lib_cmd_wait_number(sc_gameref_t game) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_int waitturns;
sc_char buffer[32];
@@ -1885,8 +1842,7 @@ lib_cmd_wait_number(sc_gameref_t game) {
* Set/clear game verbose flag. Print directly rather than using the
* printfilter to avoid possible clashes with ALRs.
*/
-sc_bool
-lib_cmd_verbose(sc_gameref_t game) {
+sc_bool lib_cmd_verbose(sc_gameref_t game) {
/* Set game verbose flag and return. */
game->verbose = TRUE;
if_print_string("The game is now in its ");
@@ -1900,8 +1856,7 @@ lib_cmd_verbose(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_brief(sc_gameref_t game) {
+sc_bool lib_cmd_brief(sc_gameref_t game) {
/* Clear game verbose flag and return. */
game->verbose = FALSE;
if_print_string("The game is now in its ");
@@ -1923,8 +1878,7 @@ lib_cmd_brief(sc_gameref_t game) {
* Set/clear/query game score change notification flag. Print directly
* rather than using the printfilter to avoid possible clashes with ALRs.
*/
-sc_bool
-lib_cmd_notify_on_off(sc_gameref_t game) {
+sc_bool lib_cmd_notify_on_off(sc_gameref_t game) {
const sc_var_setref_t vars = gs_get_vars(game);
const sc_char *control;
@@ -1957,8 +1911,7 @@ lib_cmd_notify_on_off(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_notify(sc_gameref_t game) {
+sc_bool lib_cmd_notify(sc_gameref_t game) {
/* Report the current state of notification. */
if_print_string("Game score change notification is ");
if_print_tag(SC_TAG_ITALICS, "");
@@ -1986,8 +1939,7 @@ lib_cmd_notify(sc_gameref_t game) {
* Runner responds here with the system time and date, but we'll do something
* different.
*/
-sc_bool
-lib_cmd_time(sc_gameref_t game) {
+sc_bool lib_cmd_time(sc_gameref_t game) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_uint timestamp;
sc_int hr, min, sec;
@@ -2012,8 +1964,7 @@ lib_cmd_time(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_date(sc_gameref_t game) {
+sc_bool lib_cmd_date(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "Maybe we should just be good friends.\n");
@@ -2038,8 +1989,7 @@ enum {
*
* Central movement command, called by all movement handlers.
*/
-static sc_bool
-lib_go(sc_gameref_t game, sc_int direction) {
+static sc_bool lib_go(sc_gameref_t game, sc_int direction) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5], vt_rvalue;
@@ -2164,63 +2114,51 @@ lib_go(sc_gameref_t game, sc_int direction) {
*
* Direction-specific movement commands.
*/
-sc_bool
-lib_cmd_go_north(sc_gameref_t game) {
+sc_bool lib_cmd_go_north(sc_gameref_t game) {
return lib_go(game, DIR_NORTH);
}
-sc_bool
-lib_cmd_go_east(sc_gameref_t game) {
+sc_bool lib_cmd_go_east(sc_gameref_t game) {
return lib_go(game, DIR_EAST);
}
-sc_bool
-lib_cmd_go_south(sc_gameref_t game) {
+sc_bool lib_cmd_go_south(sc_gameref_t game) {
return lib_go(game, DIR_SOUTH);
}
-sc_bool
-lib_cmd_go_west(sc_gameref_t game) {
+sc_bool lib_cmd_go_west(sc_gameref_t game) {
return lib_go(game, DIR_WEST);
}
-sc_bool
-lib_cmd_go_up(sc_gameref_t game) {
+sc_bool lib_cmd_go_up(sc_gameref_t game) {
return lib_go(game, DIR_UP);
}
-sc_bool
-lib_cmd_go_down(sc_gameref_t game) {
+sc_bool lib_cmd_go_down(sc_gameref_t game) {
return lib_go(game, DIR_DOWN);
}
-sc_bool
-lib_cmd_go_in(sc_gameref_t game) {
+sc_bool lib_cmd_go_in(sc_gameref_t game) {
return lib_go(game, DIR_IN);
}
-sc_bool
-lib_cmd_go_out(sc_gameref_t game) {
+sc_bool lib_cmd_go_out(sc_gameref_t game) {
return lib_go(game, DIR_OUT);
}
-sc_bool
-lib_cmd_go_northeast(sc_gameref_t game) {
+sc_bool lib_cmd_go_northeast(sc_gameref_t game) {
return lib_go(game, DIR_NORTHEAST);
}
-sc_bool
-lib_cmd_go_southeast(sc_gameref_t game) {
+sc_bool lib_cmd_go_southeast(sc_gameref_t game) {
return lib_go(game, DIR_SOUTHEAST);
}
-sc_bool
-lib_cmd_go_northwest(sc_gameref_t game) {
+sc_bool lib_cmd_go_northwest(sc_gameref_t game) {
return lib_go(game, DIR_NORTHWEST);
}
-sc_bool
-lib_cmd_go_southwest(sc_gameref_t game) {
+sc_bool lib_cmd_go_southwest(sc_gameref_t game) {
return lib_go(game, DIR_SOUTHWEST);
}
@@ -2232,8 +2170,7 @@ lib_cmd_go_southwest(sc_gameref_t game) {
* with the string passed in, and return TRUE if they match. The routine
* requires that string is filtered, stripped, trimmed and normalized.
*/
-static sc_bool
-lib_compare_rooms(sc_gameref_t game, sc_int room, const sc_char *string) {
+static sc_bool lib_compare_rooms(sc_gameref_t game, sc_int room, const sc_char *string) {
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_char *name, *compare_name;
@@ -2275,8 +2212,7 @@ lib_compare_rooms(sc_gameref_t game, sc_int room, const sc_char *string) {
* text comparisons, for example, two "Manor Grounds" at the start of Humbug,
* differentiated within the game with trailing "<some_tag>" components.
*/
-sc_bool
-lib_cmd_go_room(sc_gameref_t game) {
+sc_bool lib_cmd_go_room(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
@@ -2386,8 +2322,7 @@ lib_cmd_go_room(sc_gameref_t game) {
*
* Show the long description of a player.
*/
-sc_bool
-lib_cmd_examine_self(sc_gameref_t game) {
+sc_bool lib_cmd_examine_self(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
@@ -2501,9 +2436,7 @@ lib_cmd_examine_self(sc_gameref_t game) {
* -1 with *is_ambiguous FALSE if requested, otherwise print a message then
* return -1.
*/
-static sc_int
-lib_disambiguate_npc(sc_gameref_t game,
- const sc_char *verb, sc_bool *is_ambiguous) {
+static sc_int lib_disambiguate_npc(sc_gameref_t game, const sc_char *verb, sc_bool *is_ambiguous) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_int count, index_, npc, listed;
@@ -2590,12 +2523,9 @@ lib_disambiguate_npc(sc_gameref_t game,
* just one object. The resolver function can normally be the same as the
* function used to filter objects for multiple references.
*/
-static sc_int
-lib_disambiguate_object_common(sc_gameref_t game, const sc_char *verb,
- sc_bool(*resolver)
- (sc_gameref_t, sc_int, sc_int),
- sc_int resolver_arg,
- sc_bool *is_ambiguous) {
+static sc_int lib_disambiguate_object_common(sc_gameref_t game, const sc_char *verb,
+ sc_bool(*resolver)(sc_gameref_t, sc_int, sc_int),
+ sc_int resolver_arg, sc_bool *is_ambiguous) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_int count, index_, object, listed;
@@ -2712,18 +2642,12 @@ lib_disambiguate_object_common(sc_gameref_t game, const sc_char *verb,
return -1;
}
-static sc_int
-lib_disambiguate_object(sc_gameref_t game,
- const sc_char *verb, sc_bool *is_ambiguous) {
+static sc_int lib_disambiguate_object(sc_gameref_t game, const sc_char *verb, sc_bool *is_ambiguous) {
return lib_disambiguate_object_common(game, verb, NULL, -1, is_ambiguous);
}
-static sc_int
-lib_disambiguate_object_extended(sc_gameref_t game, const sc_char *verb,
- sc_bool(*resolver)
- (sc_gameref_t, sc_int, sc_int),
- sc_int resolver_arg,
- sc_bool *is_ambiguous) {
+static sc_int lib_disambiguate_object_extended(sc_gameref_t game, const sc_char *verb,
+ sc_bool(*resolver)(sc_gameref_t, sc_int, sc_int), sc_int resolver_arg, sc_bool *is_ambiguous) {
return lib_disambiguate_object_common(game, verb,
resolver, resolver_arg, is_ambiguous);
}
@@ -2734,8 +2658,7 @@ lib_disambiguate_object_extended(sc_gameref_t game, const sc_char *verb,
*
* List objects carried and worn by an NPC.
*/
-static sc_bool
-lib_list_npc_inventory(sc_gameref_t game, sc_int npc, sc_bool is_described) {
+static sc_bool lib_list_npc_inventory(sc_gameref_t game, sc_int npc, sc_bool is_described) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object, count, trail;
sc_bool wearing;
@@ -2831,8 +2754,7 @@ lib_list_npc_inventory(sc_gameref_t game, sc_int npc, sc_bool is_described) {
* Show the long description of the most recently referenced NPC, and a
* list of what they're wearing and carrying.
*/
-sc_bool
-lib_cmd_examine_npc(sc_gameref_t game) {
+sc_bool lib_cmd_examine_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
@@ -2888,9 +2810,7 @@ lib_cmd_examine_npc(sc_gameref_t game) {
*
* List the objects in a given container object, normal format listing.
*/
-static sc_bool
-lib_list_in_object_normal(sc_gameref_t game,
- sc_int container, sc_bool is_described) {
+static sc_bool lib_list_in_object_normal(sc_gameref_t game, sc_int container, sc_bool is_described) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object, count, trail;
@@ -2948,9 +2868,7 @@ lib_list_in_object_normal(sc_gameref_t game,
*
* List the objects in a given container object, alternate format listing.
*/
-static sc_bool
-lib_list_in_object_alternate(sc_gameref_t game,
- sc_int container, sc_bool is_described) {
+static sc_bool lib_list_in_object_alternate(sc_gameref_t game,sc_int container, sc_bool is_described) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object, count, trail;
@@ -3014,8 +2932,7 @@ lib_list_in_object_alternate(sc_gameref_t game,
* this, and in particular works with the ALR magic in "To Hell in a Hamper",
* but it's almost certainly wrong. Or, at minimum, incomplete.
*/
-static sc_bool
-lib_list_in_object(sc_gameref_t game, sc_int container, sc_bool is_described) {
+static sc_bool lib_list_in_object(sc_gameref_t game, sc_int container, sc_bool is_described) {
sc_bool use_alternate_format = FALSE;
/*
@@ -3057,8 +2974,7 @@ lib_list_in_object(sc_gameref_t game, sc_int container, sc_bool is_described) {
*
* List the objects on a given surface object.
*/
-static sc_bool
-lib_list_on_object(sc_gameref_t game, sc_int supporter, sc_bool is_described) {
+static sc_bool lib_list_on_object(sc_gameref_t game, sc_int supporter, sc_bool is_described) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object, count, trail;
@@ -3116,8 +3032,7 @@ lib_list_on_object(sc_gameref_t game, sc_int supporter, sc_bool is_described) {
*
* Describe the state of a stateful object.
*/
-static sc_bool
-lib_list_object_state(sc_gameref_t game, sc_int object, sc_bool is_described) {
+static sc_bool lib_list_object_state(sc_gameref_t game, sc_int object, sc_bool is_described) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -3161,8 +3076,7 @@ lib_list_object_state(sc_gameref_t game, sc_int object, sc_bool is_described) {
*
* Show the long description of the most recently referenced object.
*/
-sc_bool
-lib_cmd_examine_object(sc_gameref_t game) {
+sc_bool lib_cmd_examine_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -3294,8 +3208,7 @@ lib_cmd_examine_object(sc_gameref_t game) {
* references uses the buffer passed in if possible, otherwise allocates
* its own buffer; testing the return value shows which happened.
*/
-static sc_bool *
-lib_save_object_references(sc_gameref_t game, sc_bool buffer[], sc_int length) {
+static sc_bool *lib_save_object_references(sc_gameref_t game, sc_bool buffer[], sc_int length) {
sc_int required, available;
sc_bool *references;
@@ -3312,8 +3225,7 @@ lib_save_object_references(sc_gameref_t game, sc_bool buffer[], sc_int length) {
return references;
}
-static void
-lib_restore_object_references(sc_gameref_t game, const sc_bool references[]) {
+static void lib_restore_object_references(sc_gameref_t game, const sc_bool references[]) {
sc_int bytes;
/* Calculate the bytes in the references array, and copy back to the game. */
@@ -3332,13 +3244,9 @@ lib_restore_object_references(sc_gameref_t game, const sc_bool references[]) {
* to retry game commands using standard "get " and "drop " commands. This
* makes "take/pick up/put down" work with a game's overridden get/drop.
*/
-static sc_bool
-lib_try_game_command_common(sc_gameref_t game,
- const sc_char *verb, sc_int object,
- const sc_char *preposition,
- sc_int associate,
- sc_bool is_associate_object,
- sc_bool is_associate_npc) {
+static sc_bool lib_try_game_command_common(sc_gameref_t game, const sc_char *verb, sc_int object,
+ const sc_char *preposition, sc_int associate, sc_bool is_associate_object,
+ sc_bool is_associate_npc) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_char buffer[LIB_ALLOCATION_AVOIDANCE_SIZE];
@@ -3439,26 +3347,18 @@ lib_try_game_command_common(sc_gameref_t game,
return status;
}
-static sc_bool
-lib_try_game_command_short(sc_gameref_t game,
- const sc_char *verb, sc_int object) {
- return lib_try_game_command_common(game, verb, object,
- NULL, -1, FALSE, FALSE);
+static sc_bool lib_try_game_command_short(sc_gameref_t game, const sc_char *verb, sc_int object) {
+ return lib_try_game_command_common(game, verb, object, NULL, -1, FALSE, FALSE);
}
-static sc_bool
-lib_try_game_command_with_object(sc_gameref_t game,
- const sc_char *verb, sc_int object,
- const sc_char *preposition,
- sc_int other_object) {
+static sc_bool lib_try_game_command_with_object(sc_gameref_t game, const sc_char *verb,
+ sc_int object, const sc_char *preposition, sc_int other_object) {
return lib_try_game_command_common(game, verb, object,
preposition, other_object, TRUE, FALSE);
}
-static sc_bool
-lib_try_game_command_with_npc(sc_gameref_t game,
- const sc_char *verb, sc_int object,
- const sc_char *preposition, sc_int npc) {
+static sc_bool lib_try_game_command_with_npc(sc_gameref_t game, const sc_char *verb,
+ sc_int object, const sc_char *preposition, sc_int npc) {
return lib_try_game_command_common(game, verb, object,
preposition, npc, FALSE, TRUE);
}
@@ -3472,12 +3372,9 @@ lib_try_game_command_with_npc(sc_gameref_t game,
* using the verb supplied, and sets are_more_objects if we found an object
* but there appear to be more following it.
*/
-static sc_bool
-lib_parse_next_object(sc_gameref_t game, const sc_char *verb,
- sc_bool(*resolver)(sc_gameref_t, sc_int, sc_int),
- sc_int resolver_arg,
- sc_int *object,
- sc_bool *are_more_objects, sc_bool *is_ambiguous) {
+static sc_bool lib_parse_next_object(sc_gameref_t game, const sc_char *verb,
+ sc_bool(*resolver)(sc_gameref_t, sc_int, sc_int), sc_int resolver_arg,
+ sc_int *object, sc_bool *are_more_objects, sc_bool *is_ambiguous) {
const sc_var_setref_t vars = gs_get_vars(game);
const sc_char *list;
sc_bool is_matched;
@@ -3513,11 +3410,9 @@ lib_parse_next_object(sc_gameref_t game, const sc_char *verb,
* Parses object lists such as "object" and "object and object" and returns
* the multiple objects in the game's multiple_references.
*/
-static sc_bool
-lib_parse_multiple_objects(sc_gameref_t game, const sc_char *verb,
- sc_bool(*resolver)(sc_gameref_t, sc_int, sc_int),
- sc_int resolver_arg,
- sc_int *count) {
+static sc_bool lib_parse_multiple_objects(sc_gameref_t game, const sc_char *verb,
+ sc_bool(*resolver)(sc_gameref_t, sc_int, sc_int),
+ sc_int resolver_arg, sc_int *count) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int count_, object;
sc_bool are_more_objects, is_ambiguous;
@@ -3612,10 +3507,9 @@ lib_parse_multiple_objects(sc_gameref_t game, const sc_char *verb,
* references into standard object references, using the supplied filter.
* The first is inclusive, the second exclusive.
*/
-static sc_int
-lib_apply_multiple_filter(sc_gameref_t game,
- sc_bool(*filter)(sc_gameref_t, sc_int, sc_int),
- sc_int filter_arg, sc_int *references) {
+static sc_int lib_apply_multiple_filter(sc_gameref_t game,
+ sc_bool(*filter)(sc_gameref_t, sc_int, sc_int),
+ sc_int filter_arg, sc_int *references) {
sc_int count, object, references_;
/* Clear all object references initially. */
@@ -3645,10 +3539,9 @@ lib_apply_multiple_filter(sc_gameref_t game,
return count;
}
-static sc_int
-lib_apply_except_filter(sc_gameref_t game,
- sc_bool(*filter)(sc_gameref_t, sc_int, sc_int),
- sc_int filter_arg, sc_int *references) {
+static sc_int lib_apply_except_filter(sc_gameref_t game,
+ sc_bool(*filter)(sc_gameref_t, sc_int, sc_int),
+ sc_int filter_arg, sc_int *references) {
sc_int count, object, references_;
/* Clear all object references initially. */
@@ -3685,8 +3578,7 @@ lib_apply_except_filter(sc_gameref_t game,
*
* Display player weight and size limits and amounts currently carried.
*/
-sc_bool
-lib_cmd_count(sc_gameref_t game) {
+sc_bool lib_cmd_count(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int index_, size, weight;
sc_char buffer[32];
@@ -3734,8 +3626,7 @@ lib_cmd_count(sc_gameref_t game) {
*
* Return TRUE if the given object is too heavy for the player to carry.
*/
-static sc_bool
-lib_object_too_heavy(sc_gameref_t game, sc_int object, sc_bool *is_portable) {
+static sc_bool lib_object_too_heavy(sc_gameref_t game, sc_int object, sc_bool *is_portable) {
sc_int player_limit, index_, weight, object_weight;
/* Get the player limit and the given object weight. */
@@ -3764,8 +3655,7 @@ lib_object_too_heavy(sc_gameref_t game, sc_int object, sc_bool *is_portable) {
*
* Return TRUE if the given object is too large for the player to carry.
*/
-static sc_bool
-lib_object_too_large(sc_gameref_t game, sc_int object, sc_bool *is_portable) {
+static sc_bool lib_object_too_large(sc_gameref_t game, sc_int object, sc_bool *is_portable) {
sc_int player_limit, index_, size, object_size;
/* Get the player limit and the given object size. */
@@ -3794,8 +3684,7 @@ lib_object_too_large(sc_gameref_t game, sc_int object, sc_bool *is_portable) {
*
* Reject attempts to take an npc.
*/
-sc_bool
-lib_cmd_take_npc(sc_gameref_t game) {
+sc_bool lib_cmd_take_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int npc;
sc_bool is_ambiguous;
@@ -3823,9 +3712,8 @@ lib_cmd_take_npc(sc_gameref_t game) {
* Objects to action are flagged in object_references; objects requested but
* deemed not actionable are flagged in multiple_references.
*/
-static void
-lib_take_backend_common(sc_gameref_t game, sc_int associate,
- sc_bool is_associate_object, sc_bool is_associate_npc) {
+static void lib_take_backend_common(sc_gameref_t game, sc_int associate,
+ sc_bool is_associate_object, sc_bool is_associate_npc) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object_count, object, count, trail, total, npc;
sc_int too_heavy, too_large;
@@ -4374,18 +4262,15 @@ lib_take_backend_common(sc_gameref_t game, sc_int associate,
* Facets of lib_take_backend_common(). Provide backend handling for either
* the plain "take" handlers, or the "take from <something>" handlers.
*/
-static void
-lib_take_backend(sc_gameref_t game) {
+static void lib_take_backend(sc_gameref_t game) {
lib_take_backend_common(game, -1, FALSE, FALSE);
}
-static void
-lib_take_from_object_backend(sc_gameref_t game, sc_int associate) {
+static void lib_take_from_object_backend(sc_gameref_t game, sc_int associate) {
lib_take_backend_common(game, associate, TRUE, FALSE);
}
-static void
-lib_take_from_npc_backend(sc_gameref_t game, sc_int associate) {
+static void lib_take_from_npc_backend(sc_gameref_t game, sc_int associate) {
lib_take_backend_common(game, associate, FALSE, TRUE);
}
@@ -4397,8 +4282,7 @@ lib_take_from_npc_backend(sc_gameref_t game, sc_int associate) {
* Helper functions for deciding if an object may be acquired in this context.
* Returns TRUE if an object may be acquired, FALSE otherwise.
*/
-static sc_bool
-lib_take_filter(sc_gameref_t game, sc_int object, sc_int unused) {
+static sc_bool lib_take_filter(sc_gameref_t game, sc_int object, sc_int unused) {
assert(unused == -1);
/*
@@ -4413,9 +4297,7 @@ lib_take_filter(sc_gameref_t game, sc_int object, sc_int unused) {
|| gs_object_position(game, object) == OBJ_WORN_NPC);
}
-static sc_bool
-lib_take_not_associated_filter(sc_gameref_t game,
- sc_int object, sc_int unused) {
+static sc_bool lib_take_not_associated_filter(sc_gameref_t game, sc_int object, sc_int unused) {
assert(unused == -1);
/* In addition to other checks, the object may not be in or on an object. */
@@ -4430,8 +4312,7 @@ lib_take_not_associated_filter(sc_gameref_t game,
*
* Attempt to take all objects currently visible to the player.
*/
-sc_bool
-lib_cmd_take_all(sc_gameref_t game) {
+sc_bool lib_cmd_take_all(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects;
@@ -4457,8 +4338,7 @@ lib_cmd_take_all(sc_gameref_t game) {
* Take all objects currently available to the player, excepting those listed
* in %text%.
*/
-sc_bool
-lib_cmd_take_except_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_take_except_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects, references;
@@ -4493,8 +4373,7 @@ lib_cmd_take_except_multiple(sc_gameref_t game) {
*
* Take all objects currently available to the player and listed in %text%.
*/
-sc_bool
-lib_cmd_take_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_take_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects, references;
@@ -4526,8 +4405,7 @@ lib_cmd_take_multiple(sc_gameref_t game) {
* Helper function for deciding if an object may be acquired in this context.
* Returns TRUE if an object may be acquired, FALSE otherwise.
*/
-static sc_bool
-lib_take_from_filter(sc_gameref_t game, sc_int object, sc_int associate) {
+static sc_bool lib_take_from_filter(sc_gameref_t game, sc_int object, sc_int associate) {
/*
* To be take-able, an object must be either inside or on the specified
* object.
@@ -4545,8 +4423,7 @@ lib_take_from_filter(sc_gameref_t game, sc_int object, sc_int associate) {
* Common error handling for when nothing is taken from a container or
* supporter object.
*/
-static void
-lib_take_from_empty(sc_gameref_t game, sc_int associate, sc_bool is_except) {
+static void lib_take_from_empty(sc_gameref_t game, sc_int associate, sc_bool is_except) {
const sc_filterref_t filter = gs_get_filter(game);
if (obj_is_container(game, associate) && obj_is_surface(game, associate)) {
@@ -4605,8 +4482,7 @@ lib_take_from_empty(sc_gameref_t game, sc_int associate, sc_bool is_except) {
*
* Validate the supporter requested in "take from" commands.
*/
-static sc_bool
-lib_take_from_is_valid(sc_gameref_t game, sc_int associate) {
+static sc_bool lib_take_from_is_valid(sc_gameref_t game, sc_int associate) {
const sc_filterref_t filter = gs_get_filter(game);
/* Disallow emptying non-container/non-surface objects. */
@@ -4644,8 +4520,7 @@ lib_take_from_is_valid(sc_gameref_t game, sc_int associate) {
*
* Attempt to take all objects contained in or supported by a given object.
*/
-sc_bool
-lib_cmd_take_all_from(sc_gameref_t game) {
+sc_bool lib_cmd_take_all_from(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int associate, objects;
sc_bool is_ambiguous;
@@ -4681,8 +4556,7 @@ lib_cmd_take_all_from(sc_gameref_t game) {
* Take all objects contained in or supported by a given object, excepting
* those listed in %text%.
*/
-sc_bool
-lib_cmd_take_from_except_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_take_from_except_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int associate, objects, references;
sc_bool is_ambiguous;
@@ -4734,8 +4608,7 @@ lib_cmd_take_from_except_multiple(sc_gameref_t game) {
* function isn't mandatory -- plain "take <object>" works fine with contain-
* ers and surfaces, but it's a standard in Adrift so here it is.
*/
-sc_bool
-lib_cmd_take_from_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_take_from_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int associate, objects, references;
sc_bool is_ambiguous;
@@ -4777,8 +4650,7 @@ lib_cmd_take_from_multiple(sc_gameref_t game) {
* Helper function for deciding if an object may be acquired in this context.
* Returns TRUE if an object may be acquired, FALSE otherwise.
*/
-static sc_bool
-lib_take_from_npc_filter(sc_gameref_t game, sc_int object, sc_int associate) {
+static sc_bool lib_take_from_npc_filter(sc_gameref_t game, sc_int object, sc_int associate) {
/*
* To be take-able, an object must be either held or worn by the specified
* NPC.
@@ -4795,8 +4667,7 @@ lib_take_from_npc_filter(sc_gameref_t game, sc_int object, sc_int associate) {
*
* Attempt to take all objects held or worn by a given NPC.
*/
-sc_bool
-lib_cmd_take_all_from_npc(sc_gameref_t game) {
+sc_bool lib_cmd_take_all_from_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int associate, objects;
sc_bool is_ambiguous;
@@ -4831,8 +4702,7 @@ lib_cmd_take_all_from_npc(sc_gameref_t game) {
* Attempt to take all objects held or worn by a given NPC, excepting those
* listed in %text%.
*/
-sc_bool
-lib_cmd_take_from_npc_except_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_take_from_npc_except_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int associate, objects, references;
sc_bool is_ambiguous;
@@ -4873,8 +4743,7 @@ lib_cmd_take_from_npc_except_multiple(sc_gameref_t game) {
* Attempt to take the objects currently held or worn by an NPC and listed
* in %text%.
*/
-sc_bool
-lib_cmd_take_from_npc_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_take_from_npc_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int associate, objects, references;
sc_bool is_ambiguous;
@@ -4919,8 +4788,7 @@ lib_cmd_take_from_npc_multiple(sc_gameref_t game) {
* Objects to action are flagged in object_references; objects requested but
* deemed not actionable are flagged in multiple_references.
*/
-static void
-lib_drop_backend(sc_gameref_t game) {
+static void lib_drop_backend(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object_count, object, count, trail;
sc_bool has_printed;
@@ -5032,8 +4900,7 @@ lib_drop_backend(sc_gameref_t game) {
* Helper function for deciding if an object may be dropped in this context.
* Returns TRUE if an object may be dropped, FALSE otherwise.
*/
-static sc_bool
-lib_drop_filter(sc_gameref_t game, sc_int object, sc_int unused) {
+static sc_bool lib_drop_filter(sc_gameref_t game, sc_int object, sc_int unused) {
assert(unused == -1);
return !obj_is_static(game, object)
@@ -5046,8 +4913,7 @@ lib_drop_filter(sc_gameref_t game, sc_int object, sc_int unused) {
*
* Drop all objects currently held by the player.
*/
-sc_bool
-lib_cmd_drop_all(sc_gameref_t game) {
+sc_bool lib_cmd_drop_all(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects;
@@ -5078,8 +4944,7 @@ lib_cmd_drop_all(sc_gameref_t game) {
* Drop all objects currently held by the player, excepting those listed in
* %text%.
*/
-sc_bool
-lib_cmd_drop_except_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_drop_except_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects, references;
@@ -5118,8 +4983,7 @@ lib_cmd_drop_except_multiple(sc_gameref_t game) {
*
* Drop all objects currently held by the player and listed in %text%.
*/
-sc_bool
-lib_cmd_drop_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_drop_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects, references;
@@ -5156,8 +5020,7 @@ lib_cmd_drop_multiple(sc_gameref_t game) {
*
* Attempt to give an object to an NPC.
*/
-sc_bool
-lib_cmd_give_object_npc(sc_gameref_t game) {
+sc_bool lib_cmd_give_object_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object, npc;
sc_bool is_ambiguous;
@@ -5193,8 +5056,7 @@ lib_cmd_give_object_npc(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_give_object(sc_gameref_t game) {
+sc_bool lib_cmd_give_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -5233,8 +5095,7 @@ lib_cmd_give_object(sc_gameref_t game) {
* Objects to action are flagged in object_references; objects requested but
* deemed not actionable are flagged in multiple_references.
*/
-static void
-lib_wear_backend(sc_gameref_t game) {
+static void lib_wear_backend(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object_count, object, count, trail;
sc_bool has_printed;
@@ -5434,8 +5295,7 @@ lib_wear_backend(sc_gameref_t game) {
* Helper function for deciding if an object may be worn in this context.
* Returns TRUE if an object may be worn, FALSE otherwise.
*/
-static sc_bool
-lib_wear_filter(sc_gameref_t game, sc_int object, sc_int unused) {
+static sc_bool lib_wear_filter(sc_gameref_t game, sc_int object, sc_int unused) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
assert(unused == -1);
@@ -5464,8 +5324,7 @@ lib_wear_filter(sc_gameref_t game, sc_int object, sc_int unused) {
*
* Wear all wearable objects currently held by the player.
*/
-sc_bool
-lib_cmd_wear_all(sc_gameref_t game) {
+sc_bool lib_cmd_wear_all(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects;
@@ -5497,8 +5356,7 @@ lib_cmd_wear_all(sc_gameref_t game) {
* Wear all wearable objects currently held by the player, excepting those
* listed in %text%.
*/
-sc_bool
-lib_cmd_wear_except_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_wear_except_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects, references;
@@ -5538,8 +5396,7 @@ lib_cmd_wear_except_multiple(sc_gameref_t game) {
* Wear all objects currently held by the player, wearable, and listed
* in %text%.
*/
-sc_bool
-lib_cmd_wear_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_wear_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects, references;
@@ -5580,8 +5437,7 @@ lib_cmd_wear_multiple(sc_gameref_t game) {
* Objects to action are flagged in object_references; objects requested but
* deemed not actionable are flagged in multiple_references.
*/
-static void
-lib_remove_backend(sc_gameref_t game) {
+static void lib_remove_backend(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object_count, object, count, trail;
sc_bool has_printed;
@@ -5693,8 +5549,7 @@ lib_remove_backend(sc_gameref_t game) {
* Helper function for deciding if an object may be removed in this context.
* Returns TRUE if an object is currently being worn, FALSE otherwise.
*/
-static sc_bool
-lib_remove_filter(sc_gameref_t game, sc_int object, sc_int unused) {
+static sc_bool lib_remove_filter(sc_gameref_t game, sc_int object, sc_int unused) {
assert(unused == -1);
return !obj_is_static(game, object)
@@ -5707,8 +5562,7 @@ lib_remove_filter(sc_gameref_t game, sc_int object, sc_int unused) {
*
* Remove all objects currently held by the player.
*/
-sc_bool
-lib_cmd_remove_all(sc_gameref_t game) {
+sc_bool lib_cmd_remove_all(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects;
@@ -5740,8 +5594,7 @@ lib_cmd_remove_all(sc_gameref_t game) {
* Remove all objects currently worn by the player, excepting those listed
* in %text%.
*/
-sc_bool
-lib_cmd_remove_except_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_remove_except_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects, references;
@@ -5780,8 +5633,7 @@ lib_cmd_remove_except_multiple(sc_gameref_t game) {
*
* Remove all objects currently worn by the player, and listed in %text%.
*/
-sc_bool
-lib_cmd_remove_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_remove_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int objects, references;
@@ -5818,8 +5670,7 @@ lib_cmd_remove_multiple(sc_gameref_t game) {
*
* List objects carried and worn by the player.
*/
-sc_bool
-lib_cmd_inventory(sc_gameref_t game) {
+sc_bool lib_cmd_inventory(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object, count, trail;
sc_bool wearing;
@@ -5946,8 +5797,7 @@ lib_cmd_inventory(sc_gameref_t game) {
*
* Attempt to open the referenced object.
*/
-sc_bool
-lib_cmd_open_object(sc_gameref_t game) {
+sc_bool lib_cmd_open_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object, openness;
sc_bool is_ambiguous;
@@ -6017,8 +5867,7 @@ lib_cmd_open_object(sc_gameref_t game) {
*
* Attempt to close the referenced object.
*/
-sc_bool
-lib_cmd_close_object(sc_gameref_t game) {
+sc_bool lib_cmd_close_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object, openness;
sc_bool is_ambiguous;
@@ -6077,8 +5926,7 @@ lib_cmd_close_object(sc_gameref_t game) {
*
* Automatically get an object being used as a key, if possible.
*/
-static void
-lib_attempt_key_acquisition(sc_gameref_t game, sc_int object) {
+static void lib_attempt_key_acquisition(sc_gameref_t game, sc_int object) {
const sc_filterref_t filter = gs_get_filter(game);
/* Disallow getting static objects. */
@@ -6139,8 +5987,7 @@ lib_attempt_key_acquisition(sc_gameref_t game, sc_int object) {
*
* Attempt to unlock the referenced object.
*/
-sc_bool
-lib_cmd_unlock_object_with(sc_gameref_t game) {
+sc_bool lib_cmd_unlock_object_with(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
@@ -6246,8 +6093,7 @@ lib_cmd_unlock_object_with(sc_gameref_t game) {
*
* Attempt to unlock the referenced object, automatically selecting key.
*/
-sc_bool
-lib_cmd_unlock_object(sc_gameref_t game) {
+sc_bool lib_cmd_unlock_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, openness;
@@ -6330,8 +6176,7 @@ lib_cmd_unlock_object(sc_gameref_t game) {
*
* Attempt to lock the referenced object.
*/
-sc_bool
-lib_cmd_lock_object_with(sc_gameref_t game) {
+sc_bool lib_cmd_lock_object_with(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
@@ -6445,8 +6290,7 @@ lib_cmd_lock_object_with(sc_gameref_t game) {
*
* Attempt to lock the referenced object, automatically selecting key.
*/
-sc_bool
-lib_cmd_lock_object(sc_gameref_t game) {
+sc_bool lib_cmd_lock_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, openness;
@@ -6538,9 +6382,7 @@ lib_cmd_lock_object(sc_gameref_t game) {
*
* Compare a subject, comma or NUL terminated. Helper for ask.
*/
-static sc_bool
-lib_compare_subject(const sc_char *subject, sc_int posn,
- const sc_char *string) {
+static sc_bool lib_compare_subject(const sc_char *subject, sc_int posn, const sc_char *string) {
sc_int word_posn, string_posn;
/* Skip any leading subject spaces. */
@@ -6596,8 +6438,7 @@ lib_compare_subject(const sc_char *subject, sc_int posn,
*
* Reply for an NPC on a given topic. Helper for ask.
*/
-static sc_bool
-lib_npc_reply_to(sc_gameref_t game, sc_int npc, sc_int topic) {
+static sc_bool lib_npc_reply_to(sc_gameref_t game, sc_int npc, sc_int topic) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
@@ -6634,8 +6475,7 @@ lib_npc_reply_to(sc_gameref_t game, sc_int npc, sc_int topic) {
*
* Converse with NPC.
*/
-sc_bool
-lib_cmd_ask_npc_about(sc_gameref_t game) {
+sc_bool lib_cmd_ask_npc_about(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
@@ -6724,9 +6564,8 @@ lib_cmd_ask_npc_about(sc_gameref_t game) {
* Checks for infinite recursion when placing an object in an object. Returns
* TRUE if no recursion detected.
*/
-static sc_bool
-lib_check_put_in_recursion(sc_gameref_t game,
- sc_int object, sc_int container, sc_bool report) {
+static sc_bool lib_check_put_in_recursion(sc_gameref_t game, sc_int object,
+ sc_int container, sc_bool report) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int check;
@@ -6775,8 +6614,7 @@ lib_check_put_in_recursion(sc_gameref_t game,
* Objects to action are flagged in object_references; objects requested but
* deemed not actionable are flagged in multiple_references.
*/
-static void
-lib_put_in_backend(sc_gameref_t game, sc_int container) {
+static void lib_put_in_backend(sc_gameref_t game, sc_int container) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object_count, object, count, trail, capacity, maxsize;
sc_bool has_printed;
@@ -7013,17 +6851,14 @@ lib_put_in_backend(sc_gameref_t game, sc_int container) {
* Helper functions for deciding if an object may be put in another this
* context. Returns TRUE if an object may be manipulated, FALSE otherwise.
*/
-static sc_bool
-lib_put_in_filter(sc_gameref_t game, sc_int object, sc_int unused) {
+static sc_bool lib_put_in_filter(sc_gameref_t game, sc_int object, sc_int unused) {
assert(unused == -1);
return !obj_is_static(game, object)
&& gs_object_position(game, object) == OBJ_HELD_PLAYER;
}
-static sc_bool
-lib_put_in_not_container_filter(sc_gameref_t game,
- sc_int object, sc_int container) {
+static sc_bool lib_put_in_not_container_filter(sc_gameref_t game, sc_int object, sc_int container) {
return lib_put_in_filter(game, object, -1) && object != container;
}
@@ -7033,8 +6868,7 @@ lib_put_in_not_container_filter(sc_gameref_t game,
*
* Validate the container requested in "put in" commands.
*/
-static sc_bool
-lib_put_in_is_valid(sc_gameref_t game, sc_int container) {
+static sc_bool lib_put_in_is_valid(sc_gameref_t game, sc_int container) {
const sc_filterref_t filter = gs_get_filter(game);
/* Verify that the container object is a container. */
@@ -7072,8 +6906,7 @@ lib_put_in_is_valid(sc_gameref_t game, sc_int container) {
*
* Put all objects currently held by the player into a container.
*/
-sc_bool
-lib_cmd_put_all_in(sc_gameref_t game) {
+sc_bool lib_cmd_put_all_in(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int container, objects;
sc_bool is_ambiguous;
@@ -7117,8 +6950,7 @@ lib_cmd_put_all_in(sc_gameref_t game) {
* Put all objects currently held by the player into an object, excepting
* those listed in %text%.
*/
-sc_bool
-lib_cmd_put_in_except_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_put_in_except_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int container, objects, references;
sc_bool is_ambiguous;
@@ -7177,8 +7009,7 @@ lib_cmd_put_in_except_multiple(sc_gameref_t game) {
* Put all objects currently held by the player and listed in %text% into an
* object.
*/
-sc_bool
-lib_cmd_put_in_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_put_in_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int container, objects, references;
sc_bool is_ambiguous;
@@ -7225,9 +7056,8 @@ lib_cmd_put_in_multiple(sc_gameref_t game) {
* Checks for infinite recursion when placing an object on an object. Returns
* TRUE if no recursion detected.
*/
-static sc_bool
-lib_check_put_on_recursion(sc_gameref_t game,
- sc_int object, sc_int supporter, sc_bool report) {
+static sc_bool lib_check_put_on_recursion(sc_gameref_t game, sc_int object,
+ sc_int supporter, sc_bool report) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int check;
@@ -7276,8 +7106,7 @@ lib_check_put_on_recursion(sc_gameref_t game,
* Objects to action are flagged in object_references; objects requested but
* deemed not actionable are flagged in multiple_references.
*/
-static void
-lib_put_on_backend(sc_gameref_t game, sc_int supporter) {
+static void lib_put_on_backend(sc_gameref_t game, sc_int supporter) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object_count, object, count, trail;
sc_bool has_printed;
@@ -7401,8 +7230,7 @@ lib_put_on_backend(sc_gameref_t game, sc_int supporter) {
* Helper functions for deciding if an object may be put on another this
* context. Returns TRUE if an object may be manipulated, FALSE otherwise.
*/
-static sc_bool
-lib_put_on_filter(sc_gameref_t game, sc_int object, sc_int unused) {
+static sc_bool lib_put_on_filter(sc_gameref_t game, sc_int object, sc_int unused) {
assert(unused == -1);
return !obj_is_static(game, object)
@@ -7421,8 +7249,7 @@ lib_put_on_not_supporter_filter(sc_gameref_t game,
*
* Validate the supporter requested in "put on" commands.
*/
-static sc_bool
-lib_put_on_is_valid(sc_gameref_t game, sc_int supporter) {
+static sc_bool lib_put_on_is_valid(sc_gameref_t game, sc_int supporter) {
const sc_filterref_t filter = gs_get_filter(game);
/* Verify that the supporter object is a supporter. */
@@ -7447,8 +7274,7 @@ lib_put_on_is_valid(sc_gameref_t game, sc_int supporter) {
*
* Put all objects currently held by the player onto a supporter.
*/
-sc_bool
-lib_cmd_put_all_on(sc_gameref_t game) {
+sc_bool lib_cmd_put_all_on(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int supporter, objects;
sc_bool is_ambiguous;
@@ -7492,8 +7318,7 @@ lib_cmd_put_all_on(sc_gameref_t game) {
* Put all objects currently held by the player onto an object, excepting
* those listed in %text%.
*/
-sc_bool
-lib_cmd_put_on_except_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_put_on_except_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int supporter, objects, references;
sc_bool is_ambiguous;
@@ -7552,8 +7377,7 @@ lib_cmd_put_on_except_multiple(sc_gameref_t game) {
* Put all objects currently held by the player and listed in %text% onto an
* object.
*/
-sc_bool
-lib_cmd_put_on_multiple(sc_gameref_t game) {
+sc_bool lib_cmd_put_on_multiple(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int supporter, objects, references;
sc_bool is_ambiguous;
@@ -7600,8 +7424,7 @@ lib_cmd_put_on_multiple(sc_gameref_t game) {
*
* Attempt to read the referenced object, or something else.
*/
-sc_bool
-lib_cmd_read_object(sc_gameref_t game) {
+sc_bool lib_cmd_read_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -7663,8 +7486,7 @@ lib_cmd_read_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_read_other(sc_gameref_t game) {
+sc_bool lib_cmd_read_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
/* Reject the attempt. */
@@ -7683,8 +7505,7 @@ lib_cmd_read_other(sc_gameref_t game) {
*
* Attempt to attack an NPC, with and without weaponry.
*/
-sc_bool
-lib_cmd_attack_npc(sc_gameref_t game) {
+sc_bool lib_cmd_attack_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int npc;
sc_bool is_ambiguous;
@@ -7705,8 +7526,7 @@ lib_cmd_attack_npc(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_attack_npc_with(sc_gameref_t game) {
+sc_bool lib_cmd_attack_npc_with(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, npc;
@@ -7784,8 +7604,7 @@ lib_cmd_attack_npc_with(sc_gameref_t game) {
*
* Reject romantic advances in all cases.
*/
-sc_bool
-lib_cmd_kiss_npc(sc_gameref_t game) {
+sc_bool lib_cmd_kiss_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -7822,8 +7641,7 @@ lib_cmd_kiss_npc(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_kiss_object(sc_gameref_t game) {
+sc_bool lib_cmd_kiss_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -7840,8 +7658,7 @@ lib_cmd_kiss_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_kiss_other(sc_gameref_t game) {
+sc_bool lib_cmd_kiss_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
/* Reject this attempt. */
@@ -7856,8 +7673,7 @@ lib_cmd_kiss_other(sc_gameref_t game) {
*
* Standard responses to attempts to buy something.
*/
-sc_bool
-lib_cmd_buy_object(sc_gameref_t game) {
+sc_bool lib_cmd_buy_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -7876,8 +7692,7 @@ lib_cmd_buy_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_buy_other(sc_gameref_t game) {
+sc_bool lib_cmd_buy_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
/* Reject this attempt. */
@@ -7892,8 +7707,7 @@ lib_cmd_buy_other(sc_gameref_t game) {
*
* Standard responses to attempts to break something.
*/
-sc_bool
-lib_cmd_break_object(sc_gameref_t game) {
+sc_bool lib_cmd_break_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -7914,8 +7728,7 @@ lib_cmd_break_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_break_other(sc_gameref_t game) {
+sc_bool lib_cmd_break_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
/* Reject this attempt. */
@@ -7934,8 +7747,7 @@ lib_cmd_break_other(sc_gameref_t game) {
*
* Standard responses to attempts to smell something.
*/
-sc_bool
-lib_cmd_smell_object(sc_gameref_t game) {
+sc_bool lib_cmd_smell_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -7952,8 +7764,7 @@ lib_cmd_smell_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_smell_other(sc_gameref_t game) {
+sc_bool lib_cmd_smell_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
/* Reject this attempt. */
@@ -7968,8 +7779,7 @@ lib_cmd_smell_other(sc_gameref_t game) {
*
* Standard responses to attempts to sell something.
*/
-sc_bool
-lib_cmd_sell_object(sc_gameref_t game) {
+sc_bool lib_cmd_sell_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -7986,8 +7796,7 @@ lib_cmd_sell_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_sell_other(sc_gameref_t game) {
+sc_bool lib_cmd_sell_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "No-one is interested in buying that.\n");
@@ -8000,8 +7809,7 @@ lib_cmd_sell_other(sc_gameref_t game) {
*
* Consume edible objects.
*/
-sc_bool
-lib_cmd_eat_object(sc_gameref_t game) {
+sc_bool lib_cmd_eat_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -8081,8 +7889,7 @@ enum {
*
* Central handler for stand, sit, and lie commands.
*/
-static sc_bool
-lib_stand_sit_lie(sc_gameref_t game, sc_int movement) {
+static sc_bool lib_stand_sit_lie(sc_gameref_t game, sc_int movement) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, position;
@@ -8295,33 +8102,27 @@ lib_stand_sit_lie(sc_gameref_t game, sc_int movement) {
*
* Stand, sit, or lie on an object, or on the floor.
*/
-sc_bool
-lib_cmd_stand_on_object(sc_gameref_t game) {
+sc_bool lib_cmd_stand_on_object(sc_gameref_t game) {
return lib_stand_sit_lie(game, MOVE_STAND);
}
-sc_bool
-lib_cmd_stand_on_floor(sc_gameref_t game) {
+sc_bool lib_cmd_stand_on_floor(sc_gameref_t game) {
return lib_stand_sit_lie(game, MOVE_STAND_FLOOR);
}
-sc_bool
-lib_cmd_sit_on_object(sc_gameref_t game) {
+sc_bool lib_cmd_sit_on_object(sc_gameref_t game) {
return lib_stand_sit_lie(game, MOVE_SIT);
}
-sc_bool
-lib_cmd_sit_on_floor(sc_gameref_t game) {
+sc_bool lib_cmd_sit_on_floor(sc_gameref_t game) {
return lib_stand_sit_lie(game, MOVE_SIT_FLOOR);
}
-sc_bool
-lib_cmd_lie_on_object(sc_gameref_t game) {
+sc_bool lib_cmd_lie_on_object(sc_gameref_t game) {
return lib_stand_sit_lie(game, MOVE_LIE);
}
-sc_bool
-lib_cmd_lie_on_floor(sc_gameref_t game) {
+sc_bool lib_cmd_lie_on_floor(sc_gameref_t game) {
return lib_stand_sit_lie(game, MOVE_LIE_FLOOR);
}
@@ -8332,8 +8133,7 @@ lib_cmd_lie_on_floor(sc_gameref_t game) {
*
* Get off whatever supporter the player rests on.
*/
-sc_bool
-lib_cmd_get_off_object(sc_gameref_t game) {
+sc_bool lib_cmd_get_off_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -8369,8 +8169,7 @@ lib_cmd_get_off_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_get_off(sc_gameref_t game) {
+sc_bool lib_cmd_get_off(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
/* Reject the attempt if the player is not on anything. */
@@ -8404,8 +8203,7 @@ lib_cmd_get_off(sc_gameref_t game) {
*
* Save/restore a game.
*/
-sc_bool
-lib_cmd_save(sc_gameref_t game) {
+sc_bool lib_cmd_save(sc_gameref_t game) {
if (if_confirm(SC_CONF_SAVE)) {
if (ser_save_game_prompted(game))
if_print_string("Ok.\n");
@@ -8417,8 +8215,7 @@ lib_cmd_save(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_restore(sc_gameref_t game) {
+sc_bool lib_cmd_restore(sc_gameref_t game) {
if (if_confirm(SC_CONF_RESTORE)) {
if (ser_load_game_prompted(game)) {
if_print_string("Ok.\n");
@@ -8439,8 +8236,7 @@ lib_cmd_restore(sc_gameref_t game) {
*
* Display the location of a selected object, and selected NPC.
*/
-sc_bool
-lib_cmd_locate_object(sc_gameref_t game) {
+sc_bool lib_cmd_locate_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_int index_, count, object, room, position, parent;
@@ -8612,8 +8408,7 @@ lib_cmd_locate_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_locate_npc(sc_gameref_t game) {
+sc_bool lib_cmd_locate_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_int index_, count, npc, room;
@@ -8711,8 +8506,7 @@ lib_cmd_locate_npc(sc_gameref_t game) {
*
* Display turns taken and score so far.
*/
-sc_bool
-lib_cmd_turns(sc_gameref_t game) {
+sc_bool lib_cmd_turns(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_char buffer[32];
@@ -8728,8 +8522,7 @@ lib_cmd_turns(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_score(sc_gameref_t game) {
+sc_bool lib_cmd_score(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
@@ -8772,8 +8565,7 @@ lib_cmd_score(sc_gameref_t game) {
* Standard response commands. These are uninteresting catch-all cases,
* but it's good to make then right as game ALRs may look for them.
*/
-sc_bool
-lib_cmd_profanity(sc_gameref_t game) {
+sc_bool lib_cmd_profanity(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8782,16 +8574,14 @@ lib_cmd_profanity(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_examine_all(sc_gameref_t game) {
+sc_bool lib_cmd_examine_all(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "Please examine one object at a time.\n");
return TRUE;
}
-sc_bool
-lib_cmd_examine_other(sc_gameref_t game) {
+sc_bool lib_cmd_examine_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8802,8 +8592,7 @@ lib_cmd_examine_other(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_locate_other(sc_gameref_t game) {
+sc_bool lib_cmd_locate_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "I don't know where that is!\n");
@@ -8811,32 +8600,28 @@ lib_cmd_locate_other(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_unix_like(sc_gameref_t game) {
+sc_bool lib_cmd_unix_like(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "This isn't Unix you know!\n");
return TRUE;
}
-sc_bool
-lib_cmd_dos_like(sc_gameref_t game) {
+sc_bool lib_cmd_dos_like(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "This isn't Dos you know!\n");
return TRUE;
}
-sc_bool
-lib_cmd_cry(sc_gameref_t game) {
+sc_bool lib_cmd_cry(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "There's no need for that!\n");
return TRUE;
}
-sc_bool
-lib_cmd_dance(sc_gameref_t game) {
+sc_bool lib_cmd_dance(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8847,32 +8632,28 @@ lib_cmd_dance(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_eat_other(sc_gameref_t game) {
+sc_bool lib_cmd_eat_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "I don't understand what you are trying to eat.\n");
return TRUE;
}
-sc_bool
-lib_cmd_fight(sc_gameref_t game) {
+sc_bool lib_cmd_fight(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "There is nothing worth fighting here.\n");
return TRUE;
}
-sc_bool
-lib_cmd_feed(sc_gameref_t game) {
+sc_bool lib_cmd_feed(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "There is nothing worth feeding here.\n");
return TRUE;
}
-sc_bool
-lib_cmd_feel(sc_gameref_t game) {
+sc_bool lib_cmd_feel(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8883,8 +8664,7 @@ lib_cmd_feel(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_fly(sc_gameref_t game) {
+sc_bool lib_cmd_fly(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8895,8 +8675,7 @@ lib_cmd_fly(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_hint(sc_gameref_t game) {
+sc_bool lib_cmd_hint(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8905,8 +8684,7 @@ lib_cmd_hint(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_hum(sc_gameref_t game) {
+sc_bool lib_cmd_hum(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8917,16 +8695,14 @@ lib_cmd_hum(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_jump(sc_gameref_t game) {
+sc_bool lib_cmd_jump(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "Wheee-boinng.\n");
return TRUE;
}
-sc_bool
-lib_cmd_listen(sc_gameref_t game) {
+sc_bool lib_cmd_listen(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8937,8 +8713,7 @@ lib_cmd_listen(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_please(sc_gameref_t game) {
+sc_bool lib_cmd_please(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8949,16 +8724,14 @@ lib_cmd_please(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_punch(sc_gameref_t game) {
+sc_bool lib_cmd_punch(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "Who do you think you are, Mike Tyson?\n");
return TRUE;
}
-sc_bool
-lib_cmd_run(sc_gameref_t game) {
+sc_bool lib_cmd_run(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -8969,16 +8742,14 @@ lib_cmd_run(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_shout(sc_gameref_t game) {
+sc_bool lib_cmd_shout(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "Aaarrrrgggghhhhhh!\n");
return TRUE;
}
-sc_bool
-lib_cmd_say(sc_gameref_t game) {
+sc_bool lib_cmd_say(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_char *string = NULL;
@@ -9010,8 +8781,7 @@ lib_cmd_say(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_sing(sc_gameref_t game) {
+sc_bool lib_cmd_sing(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -9022,16 +8792,14 @@ lib_cmd_sing(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_sleep(sc_gameref_t game) {
+sc_bool lib_cmd_sleep(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "Zzzzz. Bored are you?\n");
return TRUE;
}
-sc_bool
-lib_cmd_talk(sc_gameref_t game) {
+sc_bool lib_cmd_talk(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -9042,16 +8810,14 @@ lib_cmd_talk(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_thank(sc_gameref_t game) {
+sc_bool lib_cmd_thank(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "You're welcome.\n");
return TRUE;
}
-sc_bool
-lib_cmd_whistle(sc_gameref_t game) {
+sc_bool lib_cmd_whistle(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -9062,8 +8828,7 @@ lib_cmd_whistle(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_interrogation(sc_gameref_t game) {
+sc_bool lib_cmd_interrogation(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_char *string = NULL;
@@ -9125,8 +8890,7 @@ lib_cmd_interrogation(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_xyzzy(sc_gameref_t game) {
+sc_bool lib_cmd_xyzzy(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -9135,8 +8899,7 @@ lib_cmd_xyzzy(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_egotistic(sc_gameref_t game) {
+sc_bool lib_cmd_egotistic(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
#if 0
@@ -9150,8 +8913,7 @@ lib_cmd_egotistic(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_yes_or_no(sc_gameref_t game) {
+sc_bool lib_cmd_yes_or_no(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter,
@@ -9167,8 +8929,7 @@ lib_cmd_yes_or_no(sc_gameref_t game) {
*
* Malformed and rhetorical question responses.
*/
-sc_bool
-lib_cmd_ask_npc(sc_gameref_t game) {
+sc_bool lib_cmd_ask_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int npc;
sc_bool is_ambiguous;
@@ -9185,8 +8946,7 @@ lib_cmd_ask_npc(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_ask_object(sc_gameref_t game) {
+sc_bool lib_cmd_ask_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -9207,8 +8967,7 @@ lib_cmd_ask_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_ask_other(sc_gameref_t game) {
+sc_bool lib_cmd_ask_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
/* Incomplete ask command, so offer help and return. */
@@ -9223,8 +8982,7 @@ lib_cmd_ask_other(sc_gameref_t game) {
*
* Uninteresting kill message when no weaponry is involved.
*/
-sc_bool
-lib_cmd_kill_other(sc_gameref_t game) {
+sc_bool lib_cmd_kill_other(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, "Now that isn't very nice.\n");
@@ -9240,11 +8998,8 @@ lib_cmd_kill_other(sc_gameref_t game) {
* Central handler for a range of nothing-happens messages. More
* uninteresting responses.
*/
-static sc_bool
-lib_nothing_happens_common(sc_gameref_t game,
- const sc_char *verb_general,
- const sc_char *verb_third_person,
- sc_bool is_object) {
+static sc_bool lib_nothing_happens_common(sc_gameref_t game, const sc_char *verb_general,
+ const sc_char *verb_third_person, sc_bool is_object) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
@@ -9298,18 +9053,14 @@ lib_nothing_happens_common(sc_gameref_t game,
return TRUE;
}
-static sc_bool
-lib_nothing_happens_object(sc_gameref_t game,
- const sc_char *verb_general,
- const sc_char *verb_third_person) {
+static sc_bool lib_nothing_happens_object(sc_gameref_t game,
+ const sc_char *verb_general, const sc_char *verb_third_person) {
return lib_nothing_happens_common(game,
verb_general, verb_third_person, TRUE);
}
-static sc_bool
-lib_nothing_happens_other(sc_gameref_t game,
- const sc_char *verb_general,
- const sc_char *verb_third_person) {
+static sc_bool lib_nothing_happens_other(sc_gameref_t game,
+ const sc_char *verb_general, const sc_char *verb_third_person) {
return lib_nothing_happens_common(game,
verb_general, verb_third_person, FALSE);
}
@@ -9320,63 +9071,51 @@ lib_nothing_happens_other(sc_gameref_t game,
*
* Shake, rattle and roll, and assorted nothing-happens handlers.
*/
-sc_bool
-lib_cmd_hit_object(sc_gameref_t game) {
+sc_bool lib_cmd_hit_object(sc_gameref_t game) {
return lib_nothing_happens_object(game, "hit", "hits");
}
-sc_bool
-lib_cmd_kick_object(sc_gameref_t game) {
+sc_bool lib_cmd_kick_object(sc_gameref_t game) {
return lib_nothing_happens_object(game, "kick", "kicks");
}
-sc_bool
-lib_cmd_press_object(sc_gameref_t game) {
+sc_bool lib_cmd_press_object(sc_gameref_t game) {
return lib_nothing_happens_object(game, "press", "presses");
}
-sc_bool
-lib_cmd_push_object(sc_gameref_t game) {
+sc_bool lib_cmd_push_object(sc_gameref_t game) {
return lib_nothing_happens_object(game, "push", "pushes");
}
-sc_bool
-lib_cmd_pull_object(sc_gameref_t game) {
+sc_bool lib_cmd_pull_object(sc_gameref_t game) {
return lib_nothing_happens_object(game, "pull", "pulls");
}
-sc_bool
-lib_cmd_shake_object(sc_gameref_t game) {
+sc_bool lib_cmd_shake_object(sc_gameref_t game) {
return lib_nothing_happens_object(game, "shake", "shakes");
}
-sc_bool
-lib_cmd_hit_other(sc_gameref_t game) {
+sc_bool lib_cmd_hit_other(sc_gameref_t game) {
return lib_nothing_happens_other(game, "hit", "hits");
}
-sc_bool
-lib_cmd_kick_other(sc_gameref_t game) {
+sc_bool lib_cmd_kick_other(sc_gameref_t game) {
return lib_nothing_happens_other(game, "kick", "kicks");
}
-sc_bool
-lib_cmd_press_other(sc_gameref_t game) {
+sc_bool lib_cmd_press_other(sc_gameref_t game) {
return lib_nothing_happens_other(game, "press", "presses");
}
-sc_bool
-lib_cmd_push_other(sc_gameref_t game) {
+sc_bool lib_cmd_push_other(sc_gameref_t game) {
return lib_nothing_happens_other(game, "push", "pushes");
}
-sc_bool
-lib_cmd_pull_other(sc_gameref_t game) {
+sc_bool lib_cmd_pull_other(sc_gameref_t game) {
return lib_nothing_happens_other(game, "pull", "pulls");
}
-sc_bool
-lib_cmd_shake_other(sc_gameref_t game) {
+sc_bool lib_cmd_shake_other(sc_gameref_t game) {
return lib_nothing_happens_other(game, "shake", "shakes");
}
@@ -9389,9 +9128,7 @@ lib_cmd_shake_other(sc_gameref_t game) {
* Central handler for a range of can't-do messages. Yet more uninterest-
* ing responses.
*/
-static sc_bool
-lib_cant_do_common(sc_gameref_t game,
- const sc_char *verb, sc_bool is_object) {
+static sc_bool lib_cant_do_common(sc_gameref_t game, const sc_char *verb, sc_bool is_object) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
sc_bool is_ambiguous;
@@ -9424,13 +9161,11 @@ lib_cant_do_common(sc_gameref_t game,
return TRUE;
}
-static sc_bool
-lib_cant_do_object(sc_gameref_t game, const sc_char *verb) {
+static sc_bool lib_cant_do_object(sc_gameref_t game, const sc_char *verb) {
return lib_cant_do_common(game, verb, TRUE);
}
-static sc_bool
-lib_cant_do_other(sc_gameref_t game, const sc_char *verb) {
+static sc_bool lib_cant_do_other(sc_gameref_t game, const sc_char *verb) {
return lib_cant_do_common(game, verb, FALSE);
}
@@ -9440,183 +9175,147 @@ lib_cant_do_other(sc_gameref_t game, const sc_char *verb) {
*
* Assorted can't-do messages.
*/
-sc_bool
-lib_cmd_block_object(sc_gameref_t game) {
+sc_bool lib_cmd_block_object(sc_gameref_t game) {
return lib_cant_do_object(game, "block");
}
-sc_bool
-lib_cmd_climb_object(sc_gameref_t game) {
+sc_bool lib_cmd_climb_object(sc_gameref_t game) {
return lib_cant_do_object(game, "climb");
}
-sc_bool
-lib_cmd_clean_object(sc_gameref_t game) {
+sc_bool lib_cmd_clean_object(sc_gameref_t game) {
return lib_cant_do_object(game, "clean");
}
-sc_bool
-lib_cmd_cut_object(sc_gameref_t game) {
+sc_bool lib_cmd_cut_object(sc_gameref_t game) {
return lib_cant_do_object(game, "cut");
}
-sc_bool
-lib_cmd_drink_object(sc_gameref_t game) {
+sc_bool lib_cmd_drink_object(sc_gameref_t game) {
return lib_cant_do_object(game, "drink");
}
-sc_bool
-lib_cmd_light_object(sc_gameref_t game) {
+sc_bool lib_cmd_light_object(sc_gameref_t game) {
return lib_cant_do_object(game, "light");
}
-sc_bool
-lib_cmd_lift_object(sc_gameref_t game) {
+sc_bool lib_cmd_lift_object(sc_gameref_t game) {
return lib_cant_do_object(game, "lift");
}
-sc_bool
-lib_cmd_move_object(sc_gameref_t game) {
+sc_bool lib_cmd_move_object(sc_gameref_t game) {
return lib_cant_do_object(game, "move");
}
-sc_bool
-lib_cmd_rub_object(sc_gameref_t game) {
+sc_bool lib_cmd_rub_object(sc_gameref_t game) {
return lib_cant_do_object(game, "rub");
}
-sc_bool
-lib_cmd_stop_object(sc_gameref_t game) {
+sc_bool lib_cmd_stop_object(sc_gameref_t game) {
return lib_cant_do_object(game, "stop");
}
-sc_bool
-lib_cmd_suck_object(sc_gameref_t game) {
+sc_bool lib_cmd_suck_object(sc_gameref_t game) {
return lib_cant_do_object(game, "suck");
}
-sc_bool
-lib_cmd_touch_object(sc_gameref_t game) {
+sc_bool lib_cmd_touch_object(sc_gameref_t game) {
return lib_cant_do_object(game, "touch");
}
-sc_bool
-lib_cmd_turn_object(sc_gameref_t game) {
+sc_bool lib_cmd_turn_object(sc_gameref_t game) {
return lib_cant_do_object(game, "turn");
}
-sc_bool
-lib_cmd_unblock_object(sc_gameref_t game) {
+sc_bool lib_cmd_unblock_object(sc_gameref_t game) {
return lib_cant_do_object(game, "unblock");
}
-sc_bool
-lib_cmd_wash_object(sc_gameref_t game) {
+sc_bool lib_cmd_wash_object(sc_gameref_t game) {
return lib_cant_do_object(game, "wash");
}
-sc_bool
-lib_cmd_block_other(sc_gameref_t game) {
+sc_bool lib_cmd_block_other(sc_gameref_t game) {
return lib_cant_do_other(game, "block");
}
-sc_bool
-lib_cmd_climb_other(sc_gameref_t game) {
+sc_bool lib_cmd_climb_other(sc_gameref_t game) {
return lib_cant_do_other(game, "climb");
}
-sc_bool
-lib_cmd_clean_other(sc_gameref_t game) {
+sc_bool lib_cmd_clean_other(sc_gameref_t game) {
return lib_cant_do_other(game, "clean");
}
-sc_bool
-lib_cmd_close_other(sc_gameref_t game) {
+sc_bool lib_cmd_close_other(sc_gameref_t game) {
return lib_cant_do_other(game, "close");
}
-sc_bool
-lib_cmd_lock_other(sc_gameref_t game) {
+sc_bool lib_cmd_lock_other(sc_gameref_t game) {
return lib_cant_do_other(game, "lock");
}
-sc_bool
-lib_cmd_unlock_other(sc_gameref_t game) {
+sc_bool lib_cmd_unlock_other(sc_gameref_t game) {
return lib_cant_do_other(game, "unlock");
}
-sc_bool
-lib_cmd_stand_other(sc_gameref_t game) {
+sc_bool lib_cmd_stand_other(sc_gameref_t game) {
return lib_cant_do_other(game, "stand on");
}
-sc_bool
-lib_cmd_sit_other(sc_gameref_t game) {
+sc_bool lib_cmd_sit_other(sc_gameref_t game) {
return lib_cant_do_other(game, "sit on");
}
-sc_bool
-lib_cmd_lie_other(sc_gameref_t game) {
+sc_bool lib_cmd_lie_other(sc_gameref_t game) {
return lib_cant_do_other(game, "lie on");
}
-sc_bool
-lib_cmd_cut_other(sc_gameref_t game) {
+sc_bool lib_cmd_cut_other(sc_gameref_t game) {
return lib_cant_do_other(game, "cut");
}
-sc_bool
-lib_cmd_drink_other(sc_gameref_t game) {
+sc_bool lib_cmd_drink_other(sc_gameref_t game) {
return lib_cant_do_other(game, "drink");
}
-sc_bool
-lib_cmd_lift_other(sc_gameref_t game) {
+sc_bool lib_cmd_lift_other(sc_gameref_t game) {
return lib_cant_do_other(game, "lift");
}
-sc_bool
-lib_cmd_light_other(sc_gameref_t game) {
+sc_bool lib_cmd_light_other(sc_gameref_t game) {
return lib_cant_do_other(game, "light");
}
-sc_bool
-lib_cmd_move_other(sc_gameref_t game) {
+sc_bool lib_cmd_move_other(sc_gameref_t game) {
return lib_cant_do_other(game, "move");
}
-sc_bool
-lib_cmd_stop_other(sc_gameref_t game) {
+sc_bool lib_cmd_stop_other(sc_gameref_t game) {
return lib_cant_do_other(game, "stop");
}
-sc_bool
-lib_cmd_rub_other(sc_gameref_t game) {
+sc_bool lib_cmd_rub_other(sc_gameref_t game) {
return lib_cant_do_other(game, "rub");
}
-sc_bool
-lib_cmd_suck_other(sc_gameref_t game) {
+sc_bool lib_cmd_suck_other(sc_gameref_t game) {
return lib_cant_do_other(game, "suck");
}
-sc_bool
-lib_cmd_turn_other(sc_gameref_t game) {
+sc_bool lib_cmd_turn_other(sc_gameref_t game) {
return lib_cant_do_other(game, "turn");
}
-sc_bool
-lib_cmd_touch_other(sc_gameref_t game) {
+sc_bool lib_cmd_touch_other(sc_gameref_t game) {
return lib_cant_do_other(game, "touch");
}
-sc_bool
-lib_cmd_unblock_other(sc_gameref_t game) {
+sc_bool lib_cmd_unblock_other(sc_gameref_t game) {
return lib_cant_do_other(game, "unblock");
}
-sc_bool
-lib_cmd_wash_other(sc_gameref_t game) {
+sc_bool lib_cmd_wash_other(sc_gameref_t game) {
return lib_cant_do_other(game, "wash");
}
@@ -9629,8 +9328,7 @@ lib_cmd_wash_other(sc_gameref_t game) {
* Central handler for a range of don't_think messages. Still more
* uninteresting responses.
*/
-static sc_bool
-lib_dont_think_common(sc_gameref_t game,
+static sc_bool lib_dont_think_common(sc_gameref_t game,
const sc_char *verb, sc_bool is_object) {
const sc_filterref_t filter = gs_get_filter(game);
sc_int object;
@@ -9662,13 +9360,11 @@ lib_dont_think_common(sc_gameref_t game,
return TRUE;
}
-static sc_bool
-lib_dont_think_object(sc_gameref_t game, const sc_char *verb) {
+static sc_bool lib_dont_think_object(sc_gameref_t game, const sc_char *verb) {
return lib_dont_think_common(game, verb, TRUE);
}
-static sc_bool
-lib_dont_think_other(sc_gameref_t game, const sc_char *verb) {
+static sc_bool lib_dont_think_other(sc_gameref_t game, const sc_char *verb) {
return lib_dont_think_common(game, verb, FALSE);
}
@@ -9678,33 +9374,27 @@ lib_dont_think_other(sc_gameref_t game, const sc_char *verb) {
*
* Assorted don't-think messages.
*/
-sc_bool
-lib_cmd_fix_object(sc_gameref_t game) {
+sc_bool lib_cmd_fix_object(sc_gameref_t game) {
return lib_dont_think_object(game, "fix");
}
-sc_bool
-lib_cmd_mend_object(sc_gameref_t game) {
+sc_bool lib_cmd_mend_object(sc_gameref_t game) {
return lib_dont_think_object(game, "mend");
}
-sc_bool
-lib_cmd_repair_object(sc_gameref_t game) {
+sc_bool lib_cmd_repair_object(sc_gameref_t game) {
return lib_dont_think_object(game, "repair");
}
-sc_bool
-lib_cmd_fix_other(sc_gameref_t game) {
+sc_bool lib_cmd_fix_other(sc_gameref_t game) {
return lib_dont_think_other(game, "fix");
}
-sc_bool
-lib_cmd_mend_other(sc_gameref_t game) {
+sc_bool lib_cmd_mend_other(sc_gameref_t game) {
return lib_dont_think_other(game, "mend");
}
-sc_bool
-lib_cmd_repair_other(sc_gameref_t game) {
+sc_bool lib_cmd_repair_other(sc_gameref_t game) {
return lib_dont_think_other(game, "repair");
}
@@ -9714,8 +9404,7 @@ lib_cmd_repair_other(sc_gameref_t game) {
*
* Central handler for doing something, but unsure to what.
*/
-static sc_bool
-lib_what(sc_gameref_t game, const sc_char *verb) {
+static sc_bool lib_what(sc_gameref_t game, const sc_char *verb) {
const sc_filterref_t filter = gs_get_filter(game);
pf_buffer_string(filter, verb);
@@ -9729,188 +9418,151 @@ lib_what(sc_gameref_t game, const sc_char *verb) {
*
* Assorted "what?" messages.
*/
-sc_bool
-lib_cmd_block_what(sc_gameref_t game) {
+sc_bool lib_cmd_block_what(sc_gameref_t game) {
return lib_what(game, "Block");
}
-sc_bool
-lib_cmd_break_what(sc_gameref_t game) {
+sc_bool lib_cmd_break_what(sc_gameref_t game) {
return lib_what(game, "Break");
}
-sc_bool
-lib_cmd_destroy_what(sc_gameref_t game) {
+sc_bool lib_cmd_destroy_what(sc_gameref_t game) {
return lib_what(game, "Destroy");
}
-sc_bool
-lib_cmd_smash_what(sc_gameref_t game) {
+sc_bool lib_cmd_smash_what(sc_gameref_t game) {
return lib_what(game, "Smash");
}
-sc_bool
-lib_cmd_buy_what(sc_gameref_t game) {
+sc_bool lib_cmd_buy_what(sc_gameref_t game) {
return lib_what(game, "Buy");
}
-sc_bool
-lib_cmd_clean_what(sc_gameref_t game) {
+sc_bool lib_cmd_clean_what(sc_gameref_t game) {
return lib_what(game, "Clean");
}
-sc_bool
-lib_cmd_climb_what(sc_gameref_t game) {
+sc_bool lib_cmd_climb_what(sc_gameref_t game) {
return lib_what(game, "Climb");
}
-sc_bool
-lib_cmd_cut_what(sc_gameref_t game) {
+sc_bool lib_cmd_cut_what(sc_gameref_t game) {
return lib_what(game, "Cut");
}
-sc_bool
-lib_cmd_drink_what(sc_gameref_t game) {
+sc_bool lib_cmd_drink_what(sc_gameref_t game) {
return lib_what(game, "Drink");
}
-sc_bool
-lib_cmd_fix_what(sc_gameref_t game) {
+sc_bool lib_cmd_fix_what(sc_gameref_t game) {
return lib_what(game, "Fix");
}
-sc_bool
-lib_cmd_hit_what(sc_gameref_t game) {
+sc_bool lib_cmd_hit_what(sc_gameref_t game) {
return lib_what(game, "Hit");
}
-sc_bool
-lib_cmd_kick_what(sc_gameref_t game) {
+sc_bool lib_cmd_kick_what(sc_gameref_t game) {
return lib_what(game, "Kick");
}
-sc_bool
-lib_cmd_light_what(sc_gameref_t game) {
+sc_bool lib_cmd_light_what(sc_gameref_t game) {
return lib_what(game, "Light");
}
-sc_bool
-lib_cmd_lift_what(sc_gameref_t game) {
+sc_bool lib_cmd_lift_what(sc_gameref_t game) {
return lib_what(game, "Lift");
}
-sc_bool
-lib_cmd_mend_what(sc_gameref_t game) {
+sc_bool lib_cmd_mend_what(sc_gameref_t game) {
return lib_what(game, "Mend");
}
-sc_bool
-lib_cmd_move_what(sc_gameref_t game) {
+sc_bool lib_cmd_move_what(sc_gameref_t game) {
return lib_what(game, "Move");
}
-sc_bool
-lib_cmd_press_what(sc_gameref_t game) {
+sc_bool lib_cmd_press_what(sc_gameref_t game) {
return lib_what(game, "Press");
}
-sc_bool
-lib_cmd_pull_what(sc_gameref_t game) {
+sc_bool lib_cmd_pull_what(sc_gameref_t game) {
return lib_what(game, "Pull");
}
-sc_bool
-lib_cmd_push_what(sc_gameref_t game) {
+sc_bool lib_cmd_push_what(sc_gameref_t game) {
return lib_what(game, "Push");
}
-sc_bool
-lib_cmd_repair_what(sc_gameref_t game) {
+sc_bool lib_cmd_repair_what(sc_gameref_t game) {
return lib_what(game, "Repair");
}
-sc_bool
-lib_cmd_sell_what(sc_gameref_t game) {
+sc_bool lib_cmd_sell_what(sc_gameref_t game) {
return lib_what(game, "Sell");
}
-sc_bool
-lib_cmd_shake_what(sc_gameref_t game) {
+sc_bool lib_cmd_shake_what(sc_gameref_t game) {
return lib_what(game, "Shake");
}
-sc_bool
-lib_cmd_rub_what(sc_gameref_t game) {
+sc_bool lib_cmd_rub_what(sc_gameref_t game) {
return lib_what(game, "Rub");
}
-sc_bool
-lib_cmd_stop_what(sc_gameref_t game) {
+sc_bool lib_cmd_stop_what(sc_gameref_t game) {
return lib_what(game, "Stop");
}
-sc_bool
-lib_cmd_suck_what(sc_gameref_t game) {
+sc_bool lib_cmd_suck_what(sc_gameref_t game) {
return lib_what(game, "Suck");
}
-sc_bool
-lib_cmd_touch_what(sc_gameref_t game) {
+sc_bool lib_cmd_touch_what(sc_gameref_t game) {
return lib_what(game, "Touch");
}
-sc_bool
-lib_cmd_turn_what(sc_gameref_t game) {
+sc_bool lib_cmd_turn_what(sc_gameref_t game) {
return lib_what(game, "Turn");
}
-sc_bool
-lib_cmd_unblock_what(sc_gameref_t game) {
+sc_bool lib_cmd_unblock_what(sc_gameref_t game) {
return lib_what(game, "Unblock");
}
-sc_bool
-lib_cmd_wash_what(sc_gameref_t game) {
+sc_bool lib_cmd_wash_what(sc_gameref_t game) {
return lib_what(game, "Wash");
}
-sc_bool
-lib_cmd_drop_what(sc_gameref_t game) {
+sc_bool lib_cmd_drop_what(sc_gameref_t game) {
return lib_what(game, "Drop");
}
-sc_bool
-lib_cmd_get_what(sc_gameref_t game) {
+sc_bool lib_cmd_get_what(sc_gameref_t game) {
return lib_what(game, "Take");
}
-sc_bool
-lib_cmd_give_what(sc_gameref_t game) {
+sc_bool lib_cmd_give_what(sc_gameref_t game) {
return lib_what(game, "Give");
}
-sc_bool
-lib_cmd_open_what(sc_gameref_t game) {
+sc_bool lib_cmd_open_what(sc_gameref_t game) {
return lib_what(game, "Open");
}
-sc_bool
-lib_cmd_remove_what(sc_gameref_t game) {
+sc_bool lib_cmd_remove_what(sc_gameref_t game) {
return lib_what(game, "Remove");
}
-sc_bool
-lib_cmd_wear_what(sc_gameref_t game) {
+sc_bool lib_cmd_wear_what(sc_gameref_t game) {
return lib_what(game, "Wear");
}
-sc_bool
-lib_cmd_lock_what(sc_gameref_t game) {
+sc_bool lib_cmd_lock_what(sc_gameref_t game) {
return lib_what(game, "Lock");
}
-sc_bool
-lib_cmd_unlock_what(sc_gameref_t game) {
+sc_bool lib_cmd_unlock_what(sc_gameref_t game) {
return lib_what(game, "Unlock");
}
@@ -9921,8 +9573,7 @@ lib_cmd_unlock_what(sc_gameref_t game) {
*
* Handlers for unrecognized verbs with known object/NPC.
*/
-sc_bool
-lib_cmd_verb_object(sc_gameref_t game) {
+sc_bool lib_cmd_verb_object(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_int count, object, index_;
@@ -9951,8 +9602,7 @@ lib_cmd_verb_object(sc_gameref_t game) {
return TRUE;
}
-sc_bool
-lib_cmd_verb_npc(sc_gameref_t game) {
+sc_bool lib_cmd_verb_npc(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_int count, npc, index_;
@@ -9987,8 +9637,7 @@ lib_cmd_verb_npc(sc_gameref_t game) {
*
* Set library tracing on/off.
*/
-void
-lib_debug_trace(sc_bool flag) {
+void lib_debug_trace(sc_bool flag) {
lib_trace = flag;
}
diff --git a/engines/glk/adrift/sclocale.cpp b/engines/glk/adrift/sclocale.cpp
index b201b7faa4..140e9c9be3 100644
--- a/engines/glk/adrift/sclocale.cpp
+++ b/engines/glk/adrift/sclocale.cpp
@@ -50,8 +50,7 @@ enum { TABLE_SIZE = 256 };
* Helpers for building ctype tables. Sets all elements from start to end
* inclusive to TRUE, and iterate this on a ranges array.
*/
-static void
-loc_setrange_bool(sc_int start, sc_int end, sc_bool table[]) {
+static void loc_setrange_bool(sc_int start, sc_int end, sc_bool table[]) {
sc_int index_;
for (index_ = start; index_ <= end; index_++) {
@@ -60,8 +59,7 @@ loc_setrange_bool(sc_int start, sc_int end, sc_bool table[]) {
}
}
-static void
-loc_setranges_bool(const sc_int ranges[], sc_bool table[]) {
+static void loc_setranges_bool(const sc_int ranges[], sc_bool table[]) {
sc_int index_;
for (index_ = 0; ranges[index_] > -1; index_ += 2) {
@@ -79,8 +77,7 @@ loc_setranges_bool(const sc_int ranges[], sc_bool table[]) {
* to end inclusive to their index value plus the given offset, and iterate
* this on a ranges array.
*/
-static void
-loc_setrange_char(sc_int start, sc_int end, sc_int offset, sc_char table[]) {
+static void loc_setrange_char(sc_int start, sc_int end, sc_int offset, sc_char table[]) {
sc_int index_;
for (index_ = start; index_ <= end; index_++) {
@@ -90,8 +87,7 @@ loc_setrange_char(sc_int start, sc_int end, sc_int offset, sc_char table[]) {
}
}
-static void
-loc_setranges_char(const sc_int ranges[], sc_char table[]) {
+static void loc_setranges_char(const sc_int ranges[], sc_char table[]) {
sc_int index_;
for (index_ = 0; ranges[index_] > -1; index_ += 3) {
@@ -109,7 +105,7 @@ loc_setranges_char(const sc_int ranges[], sc_char table[]) {
*/
enum { RANGES_LENGTH = 32 };
enum { SIGNATURE_COUNT = 24, SIGNATURE_LENGTH = 3 };
-typedef struct {
+struct sc_locale_t {
const sc_char *const name;
const sc_int isspace_ranges[RANGES_LENGTH];
const sc_int isdigit_ranges[RANGES_LENGTH];
@@ -117,7 +113,7 @@ typedef struct {
const sc_int toupper_ranges[RANGES_LENGTH];
const sc_int tolower_ranges[RANGES_LENGTH];
const sc_byte signature[SIGNATURE_COUNT][SIGNATURE_LENGTH];
-} sc_locale_t;
+};
/*
@@ -126,14 +122,14 @@ typedef struct {
* table, for synchronization with changed locales. This is the dynamic data
* portion of a locale.
*/
-typedef struct {
+struct sc_locale_table_t {
const sc_locale_t *locale;
sc_bool isspace[TABLE_SIZE];
sc_bool isdigit[TABLE_SIZE];
sc_bool isalpha[TABLE_SIZE];
sc_char toupper[TABLE_SIZE];
sc_char tolower[TABLE_SIZE];
-} sc_locale_table_t;
+};
/*
* Define a single static locale table set. This set re-initializes if it
@@ -149,8 +145,7 @@ static sc_locale_table_t loc_locale_tables = {NULL, {0}, {0}, {0}, {0}, {0}};
* Initialize tables for a locale. And compare the locale tables to a locale
* and if not for the same locale, (re-)initialize.
*/
-static void
-loc_synchronize_tables(const sc_locale_t *locale) {
+static void loc_synchronize_tables(const sc_locale_t *locale) {
/* Clear all tables and the locale pointer. */
memset(&loc_locale_tables, 0, sizeof(loc_locale_tables));
@@ -164,8 +159,7 @@ loc_synchronize_tables(const sc_locale_t *locale) {
loc_locale_tables.locale = locale;
}
-static void
-loc_check_tables_synchronized(const sc_locale_t *locale) {
+static void loc_check_tables_synchronized(const sc_locale_t *locale) {
if (locale != loc_locale_tables.locale)
loc_synchronize_tables(locale);
}
@@ -250,8 +244,7 @@ static sc_bool loc_is_autodetect_enabled = TRUE;
* "dd [Mm]mm yyyy". Returns the address of the month part of the string, or
* NULL if it doesn't match the expected format.
*/
-static const sc_char *
-loc_locate_signature_in_date(const sc_char *date) {
+static const sc_char *loc_locate_signature_in_date(const sc_char *date) {
sc_int day, year, converted;
sc_char signature[SIGNATURE_LENGTH + 1];
@@ -275,8 +268,7 @@ loc_locate_signature_in_date(const sc_char *date) {
* any strcasecmp() variant because the signatures are in the locale's
* codepage, but the locale is not yet (by definition) set.
*/
-static sc_bool
-loc_compare_locale_signatures(const char *signature, const sc_locale_t *locale) {
+static sc_bool loc_compare_locale_signatures(const char *signature, const sc_locale_t *locale) {
sc_int index_;
sc_bool is_matched;
@@ -302,9 +294,8 @@ loc_compare_locale_signatures(const char *signature, const sc_locale_t *locale)
* Generator was run. Match this with locale signatures, and return the
* first locale that matches, or NULL if none match.
*/
-static const sc_locale_t *
-loc_find_matching_locale(const sc_char *date,
- const sc_locale_t *const *locales) {
+static const sc_locale_t *loc_find_matching_locale(const sc_char *date,
+ const sc_locale_t *const *locales) {
const sc_char *signature;
const sc_locale_t *matched = NULL;
@@ -333,8 +324,7 @@ loc_find_matching_locale(const sc_char *date,
* Set an autodetected value for the locale based on looking at a game's
* compilation date.
*/
-void
-loc_detect_game_locale(sc_prop_setref_t bundle) {
+void loc_detect_game_locale(sc_prop_setref_t bundle) {
assert(bundle);
/* If an explicit locale has already been set, ignore the call. */
@@ -367,13 +357,11 @@ loc_detect_game_locale(sc_prop_setref_t bundle) {
* be in ascii anyway, it's slightly safer to just use an ascii-only version
* of this function.
*/
-static sc_char
-loc_ascii_tolower(sc_char ch) {
+static sc_char loc_ascii_tolower(sc_char ch) {
return (ch >= 'A' && ch <= 'Z') ? ch - 'A' + 'a' : ch;
}
-static sc_int
-loc_ascii_strncasecmp(const sc_char *s1, const sc_char *s2, sc_int n) {
+static sc_int loc_ascii_strncasecmp(const sc_char *s1, const sc_char *s2, sc_int n) {
sc_int index_;
for (index_ = 0; index_ < n; index_++) {
@@ -396,8 +384,7 @@ loc_ascii_strncasecmp(const sc_char *s1, const sc_char *s2, sc_int n) {
* matched the name. Get the current locale, which may be the default locale
* if none yet set.
*/
-sc_bool
-loc_set_locale(const sc_char *name) {
+sc_bool loc_set_locale(const sc_char *name) {
const sc_locale_t *matched = NULL;
const sc_locale_t *const *iterator;
assert(name);
@@ -424,8 +411,7 @@ loc_set_locale(const sc_char *name) {
return matched ? TRUE : FALSE;
}
-const sc_char *
-loc_get_locale(void) {
+const sc_char *loc_get_locale(void) {
return loc_locale->name;
}
@@ -438,14 +424,11 @@ loc_get_locale(void) {
*
* Print out locale tables.
*/
-static int
-loc_debug_dump_new_line(sc_int index_, sc_int count) {
+static int loc_debug_dump_new_line(sc_int index_, sc_int count) {
return index_ < TABLE_SIZE - 1 && index_ % count == count - 1;
}
-static void
-loc_debug_dump_bool_table(const sc_char *label,
- sc_int count, const sc_bool table[]) {
+static void loc_debug_dump_bool_table(const sc_char *label, sc_int count, const sc_bool table[]) {
sc_int index_;
sc_trace("loc_locale_tables.%s = {\n ", label);
@@ -456,9 +439,7 @@ loc_debug_dump_bool_table(const sc_char *label,
sc_trace("\n}\n");
}
-static void
-loc_debug_dump_char_table(const sc_char *label,
- sc_int count, const sc_char table[]) {
+static void loc_debug_dump_char_table(const sc_char *label, sc_int count, const sc_char table[]) {
sc_int index_;
sc_trace("loc_locale_tables.%s = {\n ", label);
@@ -469,8 +450,7 @@ loc_debug_dump_char_table(const sc_char *label,
sc_trace("\n}\n");
}
-void
-loc_debug_dump(void) {
+void loc_debug_dump(void) {
sc_trace("Locale: debug dump follows...\n");
loc_check_tables_synchronized(loc_locale);
@@ -492,14 +472,12 @@ loc_debug_dump(void) {
* "Template" functions for locale variant ctype functions. Synchronize
* tables to the currently set locale, and return the value from the table.
*/
-static sc_bool
-loc_bool_template(sc_char character, const sc_bool table[]) {
+static sc_bool loc_bool_template(sc_char character, const sc_bool table[]) {
loc_check_tables_synchronized(loc_locale);
return table[(sc_byte) character];
}
-static sc_char
-loc_char_template(sc_char character, const sc_char table[]) {
+static sc_char loc_char_template(sc_char character, const sc_char table[]) {
loc_check_tables_synchronized(loc_locale);
return table[(sc_byte) character];
}
@@ -514,28 +492,23 @@ loc_char_template(sc_char character, const sc_char table[]) {
*
* Public entry points into locale variant ctype functions.
*/
-sc_bool
-sc_isspace(sc_char character) {
+sc_bool sc_isspace(sc_char character) {
return loc_bool_template(character, loc_locale_tables.isspace);
}
-sc_bool
-sc_isalpha(sc_char character) {
+sc_bool sc_isalpha(sc_char character) {
return loc_bool_template(character, loc_locale_tables.isalpha);
}
-sc_bool
-sc_isdigit(sc_char character) {
+sc_bool sc_isdigit(sc_char character) {
return loc_bool_template(character, loc_locale_tables.isdigit);
}
-sc_char
-sc_toupper(sc_char character) {
+sc_char sc_toupper(sc_char character) {
return loc_char_template(character, loc_locale_tables.toupper);
}
-sc_char
-sc_tolower(sc_char character) {
+sc_char sc_tolower(sc_char character) {
return loc_char_template(character, loc_locale_tables.tolower);
}
diff --git a/engines/glk/adrift/scmemos.cpp b/engines/glk/adrift/scmemos.cpp
index 9179783baa..88720f28bf 100644
--- a/engines/glk/adrift/scmemos.cpp
+++ b/engines/glk/adrift/scmemos.cpp
@@ -34,25 +34,27 @@ enum { MEMO_ALLOCATION_BLOCK = 32 };
* Game memo structure, saves a serialized game. Allocation is preserved so
* that structures can be reused without requiring reallocation.
*/
-typedef struct sc_memo_s {
+struct sc_memo_s {
sc_byte *serialized_game;
sc_int allocation;
sc_int length;
-} sc_memo_t;
+};
+typedef sc_memo_s sc_memo_t;
typedef sc_memo_t *sc_memoref_t;
/*
* Game command history structure, similar to a memo. Saves a player input
* command to create a history, reusing allocation where possible.
*/
-typedef struct sc_history_s {
+struct sc_history_s {
sc_char *command;
sc_int sequence;
sc_int timestamp;
sc_int turns;
sc_int allocation;
sc_int length;
-} sc_history_t;
+};
+typedef sc_history_s sc_history_t;
typedef sc_history_t *sc_historyref_t;
/*
@@ -64,7 +66,7 @@ typedef sc_history_t *sc_historyref_t;
* also a ring with limited capacity.
*/
enum { MEMO_UNDO_TABLE_SIZE = 16, MEMO_HISTORY_TABLE_SIZE = 64 };
-typedef struct sc_memo_set_s {
+struct sc_memo_set_s {
sc_uint magic;
sc_memo_t memo[MEMO_UNDO_TABLE_SIZE];
sc_int memo_cursor;
@@ -73,7 +75,8 @@ typedef struct sc_memo_set_s {
sc_int history_count;
sc_int current_history;
sc_bool is_at_start;
-} sc_memo_set_t;
+};
+typedef sc_memo_set_s sc_memo_set_t;
/*
@@ -81,8 +84,7 @@ typedef struct sc_memo_set_s {
*
* Return TRUE if pointer is a valid memo set, FALSE otherwise.
*/
-static sc_bool
-memo_is_valid(sc_memo_setref_t memento) {
+static sc_bool memo_is_valid(sc_memo_setref_t memento) {
return memento && memento->magic == MEMENTO_MAGIC;
}
@@ -92,8 +94,7 @@ memo_is_valid(sc_memo_setref_t memento) {
*
* Round up an allocation in bytes to the next allocation block.
*/
-static sc_int
-memo_round_up(sc_int allocation) {
+static sc_int memo_round_up(sc_int allocation) {
sc_int extended;
extended = allocation + MEMO_ALLOCATION_BLOCK - 1;
@@ -106,8 +107,7 @@ memo_round_up(sc_int allocation) {
*
* Create and return a new set of memos.
*/
-sc_memo_setref_t
-memo_create(void) {
+sc_memo_setref_t memo_create(void) {
sc_memo_setref_t memento;
/* Create and initialize a clean set of memos. */
@@ -131,8 +131,7 @@ memo_create(void) {
*
* Destroy a memo set, and free its heap memory.
*/
-void
-memo_destroy(sc_memo_setref_t memento) {
+void memo_destroy(sc_memo_setref_t memento) {
sc_int index_;
assert(memo_is_valid(memento));
@@ -162,8 +161,7 @@ memo_destroy(sc_memo_setref_t memento) {
* Callback function for game serialization. Appends the data passed in to
* that already stored in the memo.
*/
-static void
-memo_save_game_callback(void *opaque, const sc_byte *buffer, sc_int length) {
+static void memo_save_game_callback(void *opaque, const sc_byte *buffer, sc_int length) {
sc_memoref_t memo = (sc_memoref_t)opaque;
sc_int required;
assert(opaque && buffer && length > 0);
@@ -191,8 +189,7 @@ memo_save_game_callback(void *opaque, const sc_byte *buffer, sc_int length) {
*
* Store a game in the next memo slot.
*/
-void
-memo_save_game(sc_memo_setref_t memento, sc_gameref_t game) {
+void memo_save_game(sc_memo_setref_t memento, sc_gameref_t game) {
sc_memoref_t memo;
assert(memo_is_valid(memento));
@@ -224,8 +221,7 @@ memo_save_game(sc_memo_setref_t memento, sc_gameref_t game) {
* Callback function for game deserialization. Returns data from the memo
* until it's drained.
*/
-static sc_int
-memo_load_game_callback(void *opaque, sc_byte *buffer, sc_int length) {
+static sc_int memo_load_game_callback(void *opaque, sc_byte *buffer, sc_int length) {
sc_memoref_t memo = (sc_memoref_t)opaque;
sc_int bytes;
assert(opaque && buffer && length > 0);
@@ -249,8 +245,7 @@ memo_load_game_callback(void *opaque, sc_byte *buffer, sc_int length) {
*
* Restore a game from the last memo slot used, if possible.
*/
-sc_bool
-memo_load_game(sc_memo_setref_t memento, sc_gameref_t game) {
+sc_bool memo_load_game(sc_memo_setref_t memento, sc_gameref_t game) {
sc_int cursor;
sc_memoref_t memo;
assert(memo_is_valid(memento));
@@ -298,8 +293,7 @@ memo_load_game(sc_memo_setref_t memento, sc_gameref_t game) {
* Returns TRUE if a memo restore is likely to succeed if called, FALSE
* otherwise.
*/
-sc_bool
-memo_is_load_available(sc_memo_setref_t memento) {
+sc_bool memo_is_load_available(sc_memo_setref_t memento) {
sc_int cursor;
sc_memoref_t memo;
assert(memo_is_valid(memento));
@@ -320,8 +314,7 @@ memo_is_load_available(sc_memo_setref_t memento) {
*
* Forget the memos of saved games.
*/
-void
-memo_clear_games(sc_memo_setref_t memento) {
+void memo_clear_games(sc_memo_setref_t memento) {
sc_int index_;
assert(memo_is_valid(memento));
@@ -345,9 +338,7 @@ memo_clear_games(sc_memo_setref_t memento) {
* Store a player command in the command history, evicting any least recently
* used item if necessary.
*/
-void
-memo_save_command(sc_memo_setref_t memento,
- const sc_char *command, sc_int timestamp, sc_int turns) {
+void memo_save_command(sc_memo_setref_t memento, const sc_char *command, sc_int timestamp, sc_int turns) {
sc_historyref_t history;
sc_int length;
assert(memo_is_valid(memento));
@@ -390,8 +381,7 @@ memo_save_command(sc_memo_setref_t memento,
* to "invent" a history item at the end of the list before listing, then
* remove it again as the main runner loop will add the real thing.
*/
-void
-memo_unsave_command(sc_memo_setref_t memento) {
+void memo_unsave_command(sc_memo_setref_t memento) {
assert(memo_is_valid(memento));
/* Do nothing if for some reason there's no history to unsave. */
@@ -415,8 +405,7 @@ memo_unsave_command(sc_memo_setref_t memento) {
*
* Return a count of available saved commands.
*/
-sc_int
-memo_get_command_count(sc_memo_setref_t memento) {
+sc_int memo_get_command_count(sc_memo_setref_t memento) {
assert(memo_is_valid(memento));
/* Return the lesser of the history count and the history table size. */
@@ -432,8 +421,7 @@ memo_get_command_count(sc_memo_setref_t memento) {
*
* Iterator rewind function, reset current location to the first command.
*/
-void
-memo_first_command(sc_memo_setref_t memento) {
+void memo_first_command(sc_memo_setref_t memento) {
sc_int cursor;
sc_historyref_t history;
assert(memo_is_valid(memento));
@@ -458,10 +446,8 @@ memo_first_command(sc_memo_setref_t memento) {
* Iterator function, return the next saved command and its sequence id
* starting at 1, and the timestamp and turns when the command was saved.
*/
-void
-memo_next_command(sc_memo_setref_t memento,
- const sc_char **command, sc_int *sequence,
- sc_int *timestamp, sc_int *turns) {
+void memo_next_command(sc_memo_setref_t memento, const sc_char **command,
+ sc_int *sequence, sc_int *timestamp, sc_int *turns) {
assert(memo_is_valid(memento));
/* If valid, return the current command and advance. */
@@ -494,8 +480,7 @@ memo_next_command(sc_memo_setref_t memento,
*
* Iterator end function, returns TRUE if more commands are readable.
*/
-sc_bool
-memo_more_commands(sc_memo_setref_t memento) {
+sc_bool memo_more_commands(sc_memo_setref_t memento) {
sc_int cursor;
sc_historyref_t history;
assert(memo_is_valid(memento));
@@ -522,8 +507,7 @@ memo_more_commands(sc_memo_setref_t memento) {
* Find and return the command string for the given sequence number (-ve
* indicates an offset from the last defined), or NULL if not found.
*/
-const sc_char *
-memo_find_command(sc_memo_setref_t memento, sc_int sequence) {
+const sc_char *memo_find_command(sc_memo_setref_t memento, sc_int sequence) {
sc_int target, index_;
sc_historyref_t matched;
assert(memo_is_valid(memento));
@@ -561,8 +545,7 @@ memo_find_command(sc_memo_setref_t memento, sc_int sequence) {
*
* Forget all saved commands.
*/
-void
-memo_clear_commands(sc_memo_setref_t memento) {
+void memo_clear_commands(sc_memo_setref_t memento) {
sc_int index_;
assert(memo_is_valid(memento));
diff --git a/engines/glk/adrift/scnpcs.cpp b/engines/glk/adrift/scnpcs.cpp
index b9b60d5259..d3567f6c8f 100644
--- a/engines/glk/adrift/scnpcs.cpp
+++ b/engines/glk/adrift/scnpcs.cpp
@@ -36,8 +36,7 @@ static sc_bool npc_trace = FALSE;
*
* Return TRUE if a given NPC is currently in a given room.
*/
-sc_bool
-npc_in_room(sc_gameref_t game, sc_int npc, sc_int room) {
+sc_bool npc_in_room(sc_gameref_t game, sc_int npc, sc_int room) {
if (npc_trace) {
sc_trace("NPC: checking NPC %ld in room %ld (NPC is in %ld)\n",
npc, room, gs_npc_location(game, npc));
@@ -52,8 +51,7 @@ npc_in_room(sc_gameref_t game, sc_int npc, sc_int room) {
*
* Return the count of characters in the room, including the player.
*/
-sc_int
-npc_count_in_room(sc_gameref_t game, sc_int room) {
+sc_int npc_count_in_room(sc_gameref_t game, sc_int room) {
sc_int count, npc;
/* Start with the player. */
@@ -73,8 +71,7 @@ npc_count_in_room(sc_gameref_t game, sc_int room) {
*
* Start the given walk for the given NPC.
*/
-void
-npc_start_npc_walk(sc_gameref_t game, sc_int npc, sc_int walk) {
+void npc_start_npc_walk(sc_gameref_t game, sc_int npc, sc_int walk) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[6];
sc_int movetime;
@@ -99,8 +96,7 @@ npc_start_npc_walk(sc_gameref_t game, sc_int npc, sc_int walk) {
*
* Set initial values for NPC states, and update on turns.
*/
-void
-npc_turn_update(sc_gameref_t game) {
+void npc_turn_update(sc_gameref_t game) {
sc_int index_;
/* Set current values for NPC seen states. */
@@ -111,8 +107,7 @@ npc_turn_update(sc_gameref_t game) {
}
}
-void
-npc_setup_initial(sc_gameref_t game) {
+void npc_setup_initial(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int index_;
@@ -149,8 +144,7 @@ npc_setup_initial(sc_gameref_t game) {
*
* Return TRUE if a given room is in a given group.
*/
-static sc_bool
-npc_room_in_roomgroup(sc_gameref_t game, sc_int room, sc_int group) {
+static sc_bool npc_room_in_roomgroup(sc_gameref_t game, sc_int room, sc_int group) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
sc_int member;
@@ -183,9 +177,7 @@ static const sc_char *const DIRNAMES_8[] = {
*
* Return a random member of group adjacent to given room.
*/
-static sc_int
-npc_random_adjacent_roomgroup_member(sc_gameref_t game,
- sc_int room, sc_int group) {
+static sc_int npc_random_adjacent_roomgroup_member(sc_gameref_t game, sc_int room, sc_int group) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_bool eightpointcompass;
@@ -232,9 +224,7 @@ npc_random_adjacent_roomgroup_member(sc_gameref_t game,
*
* Helper for npc_tick_npc().
*/
-static void
-npc_announce(sc_gameref_t game, sc_int npc,
- sc_int room, sc_bool is_exit, sc_int npc_room) {
+static void npc_announce(sc_gameref_t game, sc_int npc, sc_int room, sc_bool is_exit, sc_int npc_room) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5], vt_rvalue;
@@ -312,8 +302,7 @@ npc_announce(sc_gameref_t game, sc_int npc,
*
* Helper for npc_tick_npc().
*/
-static void
-npc_tick_npc_walk(sc_gameref_t game, sc_int npc, sc_int walk) {
+static void npc_tick_npc_walk(sc_gameref_t game, sc_int npc, sc_int walk) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[6];
sc_int roomgroups, movetimes, walkstep, start, dest, destnum;
@@ -428,8 +417,7 @@ npc_tick_npc_walk(sc_gameref_t game, sc_int npc, sc_int walk) {
*
* Move an NPC one step along current walk.
*/
-static void
-npc_tick_npc(sc_gameref_t game, sc_int npc) {
+static void npc_tick_npc(sc_gameref_t game, sc_int npc) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[6];
sc_int walk;
@@ -522,8 +510,7 @@ npc_tick_npc(sc_gameref_t game, sc_int npc) {
*
* Move each NPC one step along current walk.
*/
-void
-npc_tick_npcs(sc_gameref_t game) {
+void npc_tick_npcs(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_gameref_t undo = game->undo;
sc_int npc;
@@ -587,8 +574,7 @@ npc_tick_npcs(sc_gameref_t game) {
*
* Set NPC tracing on/off.
*/
-void
-npc_debug_trace(sc_bool flag) {
+void npc_debug_trace(sc_bool flag) {
npc_trace = flag;
}
diff --git a/engines/glk/adrift/scobjcts.cpp b/engines/glk/adrift/scobjcts.cpp
index 28a89abed3..50abfa1326 100644
--- a/engines/glk/adrift/scobjcts.cpp
+++ b/engines/glk/adrift/scobjcts.cpp
@@ -41,8 +41,7 @@ static sc_bool obj_trace = FALSE;
*
* Convenience functions to return TRUE for given object attributes.
*/
-sc_bool
-obj_is_static(sc_gameref_t game, sc_int object) {
+sc_bool obj_is_static(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_bool bstatic;
@@ -54,8 +53,7 @@ obj_is_static(sc_gameref_t game, sc_int object) {
return bstatic;
}
-sc_bool
-obj_is_container(sc_gameref_t game, sc_int object) {
+sc_bool obj_is_container(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_bool is_container;
@@ -67,8 +65,7 @@ obj_is_container(sc_gameref_t game, sc_int object) {
return is_container;
}
-sc_bool
-obj_is_surface(sc_gameref_t game, sc_int object) {
+sc_bool obj_is_surface(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_bool is_surface;
@@ -86,8 +83,7 @@ obj_is_surface(sc_gameref_t game, sc_int object) {
*
* Return the index of the n'th container object found.
*/
-sc_int
-obj_container_object(sc_gameref_t game, sc_int n) {
+sc_int obj_container_object(sc_gameref_t game, sc_int n) {
sc_int object, count;
/* Progress through objects until n containers found. */
@@ -105,8 +101,7 @@ obj_container_object(sc_gameref_t game, sc_int n) {
*
* Return index such that obj_container_object(index) == objnum.
*/
-sc_int
-obj_container_index(sc_gameref_t game, sc_int objnum) {
+sc_int obj_container_index(sc_gameref_t game, sc_int objnum) {
sc_int object, count;
/* Progress through objects up to objnum. */
@@ -124,8 +119,7 @@ obj_container_index(sc_gameref_t game, sc_int objnum) {
*
* Return the index of the n'th surface object found.
*/
-sc_int
-obj_surface_object(sc_gameref_t game, sc_int n) {
+sc_int obj_surface_object(sc_gameref_t game, sc_int n) {
sc_int object, count;
/* Progress through objects until n surfaces found. */
@@ -143,8 +137,7 @@ obj_surface_object(sc_gameref_t game, sc_int n) {
*
* Return index such that obj_surface_object(index) == objnum.
*/
-sc_int
-obj_surface_index(sc_gameref_t game, sc_int objnum) {
+sc_int obj_surface_index(sc_gameref_t game, sc_int objnum) {
sc_int object, count;
/* Progress through objects up to objnum. */
@@ -162,8 +155,7 @@ obj_surface_index(sc_gameref_t game, sc_int objnum) {
*
* Return the index of the n'th openable or statussed object found.
*/
-sc_int
-obj_stateful_object(sc_gameref_t game, sc_int n) {
+sc_int obj_stateful_object(sc_gameref_t game, sc_int n) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, count;
@@ -191,8 +183,7 @@ obj_stateful_object(sc_gameref_t game, sc_int n) {
*
* Return index such that obj_stateful_object(index) == objnum.
*/
-sc_int
-obj_stateful_index(sc_gameref_t game, sc_int objnum) {
+sc_int obj_stateful_index(sc_gameref_t game, sc_int objnum) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, count;
@@ -222,8 +213,7 @@ obj_stateful_index(sc_gameref_t game, sc_int objnum) {
* string is malloc'ed, and needs to be freed by the caller. Returns NULL
* if no valid state string found.
*/
-sc_char *
-obj_state_name(sc_gameref_t game, sc_int objnum) {
+sc_char *obj_state_name(sc_gameref_t game, sc_int objnum) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
const sc_char *states;
@@ -266,8 +256,7 @@ obj_state_name(sc_gameref_t game, sc_int objnum) {
*
* Return the index of the n'th non-static object found.
*/
-sc_int
-obj_dynamic_object(sc_gameref_t game, sc_int n) {
+sc_int obj_dynamic_object(sc_gameref_t game, sc_int n) {
sc_int object, count;
/* Progress through objects until n matches found. */
@@ -285,8 +274,7 @@ obj_dynamic_object(sc_gameref_t game, sc_int n) {
*
* Return the index of the n'th wearable object found.
*/
-sc_int
-obj_wearable_object(sc_gameref_t game, sc_int n) {
+sc_int obj_wearable_object(sc_gameref_t game, sc_int n) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, count;
@@ -329,8 +317,7 @@ enum {
* TODO It's possible to have static objects in the player inventory, moved
* by events -- how should these be handled, as they have no SizeWeight?
*/
-sc_int
-obj_get_size(sc_gameref_t game, sc_int object) {
+sc_int obj_get_size(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int size, count;
@@ -362,8 +349,7 @@ obj_get_size(sc_gameref_t game, sc_int object) {
return size;
}
-sc_int
-obj_get_weight(sc_gameref_t game, sc_int object) {
+sc_int obj_get_weight(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int weight, count;
@@ -413,8 +399,7 @@ obj_get_weight(sc_gameref_t game, sc_int object) {
* Return the limits set on the sizes and weights a player can handle. Not
* really object-related except that they deal with sizing multiples.
*/
-static sc_int
-obj_convert_player_limit(sc_int value) {
+static sc_int obj_convert_player_limit(sc_int value) {
sc_int retval, index_;
/* 'Tens' of value multiplied by 3 to the power 'units' of value. */
@@ -425,8 +410,7 @@ obj_convert_player_limit(sc_int value) {
return retval;
}
-sc_int
-obj_get_player_size_limit(sc_gameref_t game) {
+sc_int obj_get_player_size_limit(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
sc_int max_size;
@@ -438,8 +422,7 @@ obj_get_player_size_limit(sc_gameref_t game) {
return obj_convert_player_limit(max_size);
}
-sc_int
-obj_get_player_weight_limit(sc_gameref_t game) {
+sc_int obj_get_player_weight_limit(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
sc_int max_weight;
@@ -459,8 +442,7 @@ obj_get_player_weight_limit(sc_gameref_t game) {
* Return the maximum size of an object that can be placed in a container,
* and the number that will fit.
*/
-sc_int
-obj_get_container_maxsize(sc_gameref_t game, sc_int object) {
+sc_int obj_get_container_maxsize(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int maxsize, count;
@@ -482,8 +464,7 @@ obj_get_container_maxsize(sc_gameref_t game, sc_int object) {
return maxsize;
}
-sc_int
-obj_get_container_capacity(sc_gameref_t game, sc_int object) {
+sc_int obj_get_container_capacity(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int capacity;
@@ -513,8 +494,7 @@ enum {
*
* Return the index of the n'th standable object found.
*/
-sc_int
-obj_standable_object(sc_gameref_t game, sc_int n) {
+sc_int obj_standable_object(sc_gameref_t game, sc_int n) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, count;
@@ -540,8 +520,7 @@ obj_standable_object(sc_gameref_t game, sc_int n) {
*
* Return the index of the n'th lieable object found.
*/
-sc_int
-obj_lieable_object(sc_gameref_t game, sc_int n) {
+sc_int obj_lieable_object(sc_gameref_t game, sc_int n) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int object, count;
@@ -571,8 +550,7 @@ obj_lieable_object(sc_gameref_t game, sc_int n) {
* or ""; plural if prefix is "the" or "some" and short name ends with 's'
* that is not preceded by 'u'.
*/
-sc_bool
-obj_appears_plural(sc_gameref_t game, sc_int object) {
+sc_bool obj_appears_plural(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
const sc_char *prefix, *name;
@@ -610,8 +588,7 @@ obj_appears_plural(sc_gameref_t game, sc_int object) {
*
* Return TRUE if a given object is currently on the floor of a given room.
*/
-static sc_bool
-obj_directly_in_room_internal(sc_gameref_t game, sc_int object, sc_int room) {
+static sc_bool obj_directly_in_room_internal(sc_gameref_t game, sc_int object, sc_int room) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
/* See if the object is static or dynamic. */
@@ -658,8 +635,7 @@ obj_directly_in_room_internal(sc_gameref_t game, sc_int object, sc_int room) {
return gs_object_position(game, object) == room + 1;
}
-sc_bool
-obj_directly_in_room(sc_gameref_t game, sc_int object, sc_int room) {
+sc_bool obj_directly_in_room(sc_gameref_t game, sc_int object, sc_int room) {
sc_bool result;
/* Check, trace result, and return. */
@@ -682,8 +658,7 @@ obj_directly_in_room(sc_gameref_t game, sc_int object, sc_int room) {
* directly, on an object indirectly, in an open object indirectly, or
* carried by an NPC in the room.
*/
-static sc_bool
-obj_indirectly_in_room_internal(sc_gameref_t game, sc_int object, sc_int room) {
+static sc_bool obj_indirectly_in_room_internal(sc_gameref_t game, sc_int object, sc_int room) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
/* See if the object is static or dynamic. */
@@ -782,9 +757,7 @@ obj_indirectly_in_room_internal(sc_gameref_t game, sc_int object, sc_int room) {
}
}
-sc_bool
-obj_indirectly_in_room(sc_gameref_t game,
- sc_int object, sc_int room) {
+sc_bool obj_indirectly_in_room(sc_gameref_t game, sc_int object, sc_int room) {
sc_bool result;
/* Check, trace result, and return. */
@@ -806,9 +779,7 @@ obj_indirectly_in_room(sc_gameref_t game,
* Return TRUE if a given object is currently held by the player, either
* directly, on an object indirectly, or in an open object indirectly.
*/
-static sc_bool
-obj_indirectly_held_by_player_internal(sc_gameref_t game,
- sc_int object) {
+static sc_bool obj_indirectly_held_by_player_internal(sc_gameref_t game, sc_int object) {
/* See if the object is static or dynamic. */
if (obj_is_static(game, object)) {
/* Static object moved to player or room by event? */
@@ -863,8 +834,7 @@ obj_indirectly_held_by_player_internal(sc_gameref_t game,
}
}
-sc_bool
-obj_indirectly_held_by_player(sc_gameref_t game, sc_int object) {
+sc_bool obj_indirectly_held_by_player(sc_gameref_t game, sc_int object) {
sc_bool result;
/* Check, trace result, and return. */
@@ -884,8 +854,7 @@ obj_indirectly_held_by_player(sc_gameref_t game, sc_int object) {
*
* Return TRUE if this object should be listed as room content.
*/
-sc_bool
-obj_shows_initial_description(sc_gameref_t game, sc_int object) {
+sc_bool obj_shows_initial_description(sc_gameref_t game, sc_int object) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int onlywhennotmoved;
@@ -927,8 +896,7 @@ obj_shows_initial_description(sc_gameref_t game, sc_int object) {
*
* Set initial values for object states, and update after a turn.
*/
-void
-obj_turn_update(sc_gameref_t game) {
+void obj_turn_update(sc_gameref_t game) {
sc_int index_;
/* Update object seen flag to current state. */
@@ -939,8 +907,7 @@ obj_turn_update(sc_gameref_t game) {
}
}
-void
-obj_setup_initial(sc_gameref_t game) {
+void obj_setup_initial(sc_gameref_t game) {
/* Set initial seen states for objects. */
obj_turn_update(game);
}
@@ -951,8 +918,7 @@ obj_setup_initial(sc_gameref_t game) {
*
* Set object tracing on/off.
*/
-void
-obj_debug_trace(sc_bool flag) {
+void obj_debug_trace(sc_bool flag) {
obj_trace = flag;
}
diff --git a/engines/glk/adrift/scparser.cpp b/engines/glk/adrift/scparser.cpp
index 9372b5e39e..7b496939ef 100644
--- a/engines/glk/adrift/scparser.cpp
+++ b/engines/glk/adrift/scparser.cpp
@@ -48,24 +48,24 @@ static const sc_char *const WHITESPACE = "\t\n\v\f\r ";
static sc_bool uip_trace = FALSE;
/* Enumeration of tokens. TOK_NONE represents a non-occurring token. */
-typedef enum {
+enum sc_uip_tok_t {
TOK_NONE = 0,
TOK_CHOICE, TOK_CHOICE_END, TOK_OPTIONAL, TOK_OPTIONAL_END,
TOK_ALTERNATES_SEPARATOR,
TOK_WILDCARD, TOK_WHITESPACE, TOK_WORD, TOK_VARIABLE,
TOK_CHARACTER_REFERENCE, TOK_OBJECT_REFERENCE, TOK_NUMBER_REFERENCE,
TOK_TEXT_REFERENCE, TOK_EOS
-} sc_uip_tok_t;
+};
/*
* Small table tying token strings to tokens. Anything not whitespace and
* not caught by the table is a plain TOK_WORD.
*/
-typedef struct {
+struct sc_uip_token_entry_t {
const sc_char *const name;
const sc_int length;
const sc_uip_tok_t token;
-} sc_uip_token_entry_t;
+};
static const sc_uip_token_entry_t UIP_TOKENS[] = {
{"[", 1, TOK_CHOICE}, {"]", 1, TOK_CHOICE_END},
@@ -98,8 +98,7 @@ static sc_char *uip_temporary = NULL;
*
* Start and wrap up pattern string tokenization.
*/
-static void
-uip_tokenize_start(const sc_char *pattern) {
+static void uip_tokenize_start(const sc_char *pattern) {
static sc_bool initialized = FALSE;
sc_int required;
@@ -129,8 +128,7 @@ uip_tokenize_start(const sc_char *pattern) {
? (sc_char *)sc_malloc(required) : uip_static_temporary;
}
-static void
-uip_tokenize_end(void) {
+static void uip_tokenize_end(void) {
/* Deallocate temporary if required, and clear pattern and index. */
if (uip_temporary != uip_static_temporary)
sc_free(uip_temporary);
@@ -145,8 +143,7 @@ uip_tokenize_end(void) {
*
* Return the next token from the current pattern.
*/
-static sc_uip_tok_t
-uip_next_token(void) {
+static sc_uip_tok_t uip_next_token(void) {
const sc_uip_token_entry_t *entry;
sc_char close;
assert(uip_pattern);
@@ -211,8 +208,7 @@ uip_next_token(void) {
* Return the token value of the current token. It is an error to call
* here if the current token is not a TOK_WORD or TOK_VARIABLE.
*/
-static const sc_char *
-uip_current_token_value(void) {
+static const sc_char *uip_current_token_value(void) {
/* If the token value is NULL, the current token isn't a word. */
if (!uip_token_value) {
sc_fatal("uip_current_token_value:"
@@ -230,20 +226,21 @@ uip_current_token_value(void) {
* NODE_UNUSED must be zero to ensure that the statically allocated array that
* forms the node pool appears initially as containing only unused nodes.
*/
-typedef enum {
+enum sc_pttype_t {
NODE_UNUSED = 0,
NODE_CHOICE, NODE_OPTIONAL, NODE_WILDCARD, NODE_WHITESPACE,
NODE_CHARACTER_REFERENCE, NODE_OBJECT_REFERENCE, NODE_TEXT_REFERENCE,
NODE_NUMBER_REFERENCE, NODE_WORD, NODE_VARIABLE, NODE_LIST, NODE_EOS
-} sc_pttype_t;
-typedef struct sc_ptnode_s {
+};
+struct sc_ptnode_s {
struct sc_ptnode_s *left_child;
struct sc_ptnode_s *right_sibling;
sc_pttype_t type;
sc_char *word;
sc_bool is_allocated;
-} sc_ptnode_t;
+};
+typedef sc_ptnode_s sc_ptnode_t;
typedef sc_ptnode_t *sc_ptnoderef_t;
/* Predictive parser lookahead token. */
@@ -273,10 +270,10 @@ static sc_int uip_node_pool_available = UIP_NODE_POOL_SIZE;
* first, then by straight malloc() should the pool empty.
*/
enum { UIP_WORD_POOL_SIZE = 64, UIP_SHORT_WORD_SIZE = 16 };
-typedef struct {
+struct sc_ptshortword_t {
sc_bool is_in_use;
sc_char word[UIP_SHORT_WORD_SIZE];
-} sc_ptshortword_t;
+};
typedef sc_ptshortword_t *sc_ptshortwordref_t;
static sc_ptshortword_t uip_word_pool[UIP_WORD_POOL_SIZE];
static sc_int uip_word_pool_cursor = 0;
@@ -287,8 +284,7 @@ static sc_int uip_word_pool_available = UIP_WORD_POOL_SIZE;
*
* Match a token to the lookahead, then advance lookahead.
*/
-static void
-uip_parse_match(sc_uip_tok_t token) {
+static void uip_parse_match(sc_uip_tok_t token) {
if (uip_parse_lookahead == token)
uip_parse_lookahead = uip_next_token();
else {
@@ -307,8 +303,7 @@ uip_parse_match(sc_uip_tok_t token) {
* allocate initially from static storage, for performance. If this is
* exhausted, backs off to standard allocation.
*/
-static sc_char *
-uip_new_word(const sc_char *word) {
+static sc_char *uip_new_word(const sc_char *word) {
sc_int required;
/*
@@ -357,8 +352,7 @@ uip_new_word(const sc_char *word) {
* If the word was allocated, free its memory; if not, find its short word
* pool entry and return it to the pool.
*/
-static void
-uip_free_word(sc_char *word) {
+static void uip_free_word(sc_char *word) {
const sc_char *first_in_pool, *last_in_pool;
/* Obtain the range of valid addresses for words from the word pool. */
@@ -392,8 +386,7 @@ uip_free_word(sc_char *word) {
* to allocate initially from static storage, for performance. If this is
* exhausted, backs off to standard allocation.
*/
-static sc_ptnoderef_t
-uip_new_node(sc_pttype_t type) {
+static sc_ptnoderef_t uip_new_node(sc_pttype_t type) {
sc_ptnoderef_t node;
/*
@@ -441,8 +434,7 @@ uip_new_node(sc_pttype_t type) {
* Destroy a node, and any allocated word memory. If the node was allocated,
* free its memory; if not, return it to the pool.
*/
-static void
-uip_destroy_node(sc_ptnoderef_t node) {
+static void uip_destroy_node(sc_ptnoderef_t node) {
/* Free any word contained at this node. */
if (node->word)
uip_free_word(node->word);
@@ -469,8 +461,7 @@ uip_destroy_node(sc_ptnoderef_t node) {
* Parse a set of .../.../... alternatives for choices and optionals. The
* first function is a helper, returning a newly constructed parsed list.
*/
-static sc_ptnoderef_t
-uip_parse_new_list(void) {
+static sc_ptnoderef_t uip_parse_new_list(void) {
sc_ptnoderef_t list;
/* Create a new list node, parse into it, and return it. */
@@ -479,8 +470,7 @@ uip_parse_new_list(void) {
return list;
}
-static void
-uip_parse_alternatives(sc_ptnoderef_t node) {
+static void uip_parse_alternatives(sc_ptnoderef_t node) {
sc_ptnoderef_t child;
/* Parse initial alternative, then add other listed alternatives. */
@@ -499,8 +489,7 @@ uip_parse_alternatives(sc_ptnoderef_t node) {
*
* Parse a single pattern element.
*/
-static sc_ptnoderef_t
-uip_parse_element(void) {
+static sc_ptnoderef_t uip_parse_element(void) {
sc_ptnoderef_t node = NULL;
sc_uip_tok_t token;
@@ -604,8 +593,7 @@ uip_parse_element(void) {
*
* Parse a list of pattern elements.
*/
-static void
-uip_parse_list(sc_ptnoderef_t list) {
+static void uip_parse_list(sc_ptnoderef_t list) {
sc_ptnoderef_t child, node;
/* Add elements until a list terminator token is encountered. */
@@ -663,8 +651,7 @@ uip_parse_list(sc_ptnoderef_t list) {
*
* Free and destroy a parsed pattern tree.
*/
-static void
-uip_destroy_tree(sc_ptnoderef_t node) {
+static void uip_destroy_tree(sc_ptnoderef_t node) {
if (node) {
/* Recursively destroy siblings, then left child. */
uip_destroy_tree(node->right_sibling);
@@ -682,8 +669,7 @@ uip_destroy_tree(sc_ptnoderef_t node) {
*
* Print out a pattern match tree.
*/
-static void
-uip_debug_dump_node(sc_ptnoderef_t node, sc_int depth) {
+static void uip_debug_dump_node(sc_ptnoderef_t node, sc_int depth) {
/* End recursion on null node. */
if (node) {
sc_int index_;
@@ -746,8 +732,7 @@ uip_debug_dump_node(sc_ptnoderef_t node, sc_int depth) {
}
}
-static void
-uip_debug_dump(void) {
+static void uip_debug_dump(void) {
sc_trace("UIParser: debug dump follows...\n");
if (uip_parse_tree) {
sc_trace("uip_parse_tree = {\n");
@@ -769,8 +754,7 @@ static sc_gameref_t uip_game = NULL;
*
* Set up a string for matching to a pattern tree, and wrap up matching.
*/
-static void
-uip_match_start(const sc_char *string, sc_gameref_t game) {
+static void uip_match_start(const sc_char *string, sc_gameref_t game) {
/* Save string, and restart index. */
uip_string = string;
uip_posn = 0;
@@ -779,8 +763,7 @@ uip_match_start(const sc_char *string, sc_gameref_t game) {
uip_game = game;
}
-static void
-uip_match_end(void) {
+static void uip_match_end(void) {
/* Clear match target string, and variable set. */
uip_string = NULL;
uip_posn = 0;
@@ -794,8 +777,7 @@ uip_match_end(void) {
* Safety wrapper to ensure module code sees a valid game when it requires
* one.
*/
-static sc_gameref_t
-uip_get_game(void) {
+static sc_gameref_t uip_get_game(void) {
assert(gs_is_game_valid(uip_game));
return uip_game;
}
@@ -819,14 +801,12 @@ static sc_bool uip_match_node(sc_ptnoderef_t node);
* advance position if necessary, on match, FALSE on no match, with position
* unchanged.
*/
-static sc_bool
-uip_match_eos(void) {
+static sc_bool uip_match_eos(void) {
/* Check that we hit the string's end. */
return uip_string[uip_posn] == NUL;
}
-static sc_bool
-uip_match_word(sc_ptnoderef_t node) {
+static sc_bool uip_match_word(sc_ptnoderef_t node) {
sc_int length;
const sc_char *word;
@@ -846,8 +826,7 @@ uip_match_word(sc_ptnoderef_t node) {
return FALSE;
}
-static sc_bool
-uip_match_variable(sc_ptnoderef_t node) {
+static sc_bool uip_match_variable(sc_ptnoderef_t node) {
const sc_gameref_t game = uip_get_game();
const sc_var_setref_t vars = gs_get_vars(game);
sc_int type;
@@ -898,8 +877,7 @@ uip_match_variable(sc_ptnoderef_t node) {
return FALSE;
}
-static sc_bool
-uip_match_whitespace(void) {
+static sc_bool uip_match_whitespace(void) {
/* If next character is space, read whitespace and return. */
if (sc_isspace(uip_string[uip_posn])) {
/* Space match, advance position and return. */
@@ -934,8 +912,7 @@ uip_match_whitespace(void) {
return FALSE;
}
-static sc_bool
-uip_match_list(sc_ptnoderef_t node) {
+static sc_bool uip_match_list(sc_ptnoderef_t node) {
sc_ptnoderef_t child;
/*
@@ -958,8 +935,7 @@ uip_match_list(sc_ptnoderef_t node) {
return TRUE;
}
-static sc_bool
-uip_match_alternatives(sc_ptnoderef_t node) {
+static sc_bool uip_match_alternatives(sc_ptnoderef_t node) {
sc_ptnoderef_t child;
sc_int start_posn, extent;
sc_bool matched;
@@ -990,8 +966,7 @@ uip_match_alternatives(sc_ptnoderef_t node) {
return matched;
}
-static sc_bool
-uip_match_choice(sc_ptnoderef_t node) {
+static sc_bool uip_match_choice(sc_ptnoderef_t node) {
/*
* Return the result of matching alternatives. The choice will therefore
* fail if none of the alternatives match.
@@ -999,8 +974,7 @@ uip_match_choice(sc_ptnoderef_t node) {
return uip_match_alternatives(node);
}
-static sc_bool
-uip_match_optional(sc_ptnoderef_t node) {
+static sc_bool uip_match_optional(sc_ptnoderef_t node) {
sc_int start_posn;
sc_ptnoderef_t list;
sc_bool matched;
@@ -1036,8 +1010,7 @@ uip_match_optional(sc_ptnoderef_t node) {
return TRUE;
}
-static sc_bool
-uip_match_wildcard(sc_ptnoderef_t node) {
+static sc_bool uip_match_wildcard(sc_ptnoderef_t node) {
sc_int start_posn, limit, index_;
sc_bool matched;
sc_ptnoderef_t list;
@@ -1099,8 +1072,7 @@ uip_match_wildcard(sc_ptnoderef_t node) {
*
* Attempt to match a number, or a word, from the string.
*/
-static sc_bool
-uip_match_number(void) {
+static sc_bool uip_match_number(void) {
const sc_gameref_t game = uip_get_game();
const sc_var_setref_t vars = gs_get_vars(game);
sc_int number;
@@ -1122,8 +1094,7 @@ uip_match_number(void) {
return FALSE;
}
-static sc_bool
-uip_match_text(sc_ptnoderef_t node) {
+static sc_bool uip_match_text(sc_ptnoderef_t node) {
const sc_gameref_t game = uip_get_game();
const sc_var_setref_t vars = gs_get_vars(game);
sc_int start_posn, limit, index_;
@@ -1195,8 +1166,7 @@ uip_match_text(sc_ptnoderef_t node) {
* Skip over any "a"/"an"/"the"/"some" at the head of a string. Helper for
* %character% and %object% matchers. Returns the revised string position.
*/
-static sc_int
-uip_skip_article(const sc_char *string, sc_int start) {
+static sc_int uip_skip_article(const sc_char *string, sc_int start) {
sc_int posn;
/* Skip over articles. */
@@ -1225,8 +1195,7 @@ uip_skip_article(const sc_char *string, sc_int start) {
* didn't match, otherwise the length of the current position that matched
* the words passed in (the new value of uip_posn on match).
*/
-static sc_int
-uip_compare_reference(const sc_char *words) {
+static sc_int uip_compare_reference(const sc_char *words) {
sc_int wpos, posn;
/* Skip articles and lead in space on words and string. */
@@ -1279,8 +1248,7 @@ uip_compare_reference(const sc_char *words) {
* match against both the prefixed name, and if that fails, the plain name.
* Returns the extent of the match, or zero if no match.
*/
-static sc_int
-uip_compare_prefixed_name(const sc_char *prefix, const sc_char *name) {
+static sc_int uip_compare_prefixed_name(const sc_char *prefix, const sc_char *name) {
sc_char buffer[UIP_SHORT_WORD_SIZE + UIP_SHORT_WORD_SIZE + 1];
sc_char *string;
sc_int required, extent;
@@ -1311,8 +1279,7 @@ uip_compare_prefixed_name(const sc_char *prefix, const sc_char *name) {
* of a pattern, to resolve the difference between, say, "table leg" and
* "table".
*/
-static sc_bool
-uip_match_remainder(sc_ptnoderef_t node, sc_int extent) {
+static sc_bool uip_match_remainder(sc_ptnoderef_t node, sc_int extent) {
sc_ptnoderef_t list;
sc_int start_posn;
sc_bool matched;
@@ -1347,8 +1314,7 @@ uip_match_remainder(sc_ptnoderef_t node, sc_int extent) {
* aliases for possible matches, and sets the game npc_references flag
* for any that match. The final one to match is also stored in variables.
*/
-static sc_bool
-uip_match_character(sc_ptnoderef_t node) {
+static sc_bool uip_match_character(sc_ptnoderef_t node) {
const sc_gameref_t game = uip_get_game();
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
@@ -1446,8 +1412,7 @@ uip_match_character(sc_ptnoderef_t node) {
* aliases for possible matches, and sets the game object_references flag
* for any that match. The final one to match is also stored in variables.
*/
-static sc_bool
-uip_match_object(sc_ptnoderef_t node) {
+static sc_bool uip_match_object(sc_ptnoderef_t node) {
const sc_gameref_t game = uip_get_game();
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
@@ -1545,8 +1510,7 @@ uip_match_object(sc_ptnoderef_t node) {
* Return TRUE, with position advanced, on match, FALSE on fail with the
* position unchanged.
*/
-static sc_bool
-uip_match_node(sc_ptnoderef_t node) {
+static sc_bool uip_match_node(sc_ptnoderef_t node) {
sc_bool match = FALSE;
/* Match depending on node type. */
@@ -1605,8 +1569,7 @@ uip_match_node(sc_ptnoderef_t node) {
* allocation if it happens (detectable by comparing the return value to the
* buffer passed in), or call uip_free_cleansed_string.
*/
-static sc_char *
-uip_cleanse_string(const sc_char *original, sc_char *buffer, sc_int length) {
+static sc_char *uip_cleanse_string(const sc_char *original, sc_char *buffer, sc_int length) {
sc_int required;
sc_char *string;
@@ -1623,8 +1586,7 @@ uip_cleanse_string(const sc_char *original, sc_char *buffer, sc_int length) {
return string;
}
-static sc_char *
-uip_free_cleansed_string(sc_char *string, const sc_char *buffer) {
+static sc_char *uip_free_cleansed_string(sc_char *string, const sc_char *buffer) {
/* Free if the string was allocated by the function above. */
if (string != buffer)
sc_free(string);
@@ -1639,8 +1601,7 @@ uip_free_cleansed_string(sc_char *string, const sc_char *buffer) {
*
* Set pattern match tracing on/off.
*/
-void
-uip_debug_trace(sc_bool flag) {
+void uip_debug_trace(sc_bool flag) {
uip_trace = flag;
}
@@ -1652,8 +1613,7 @@ uip_debug_trace(sc_bool flag) {
* For performance, this function uses a local buffer to try to avoid the
* need to copy each of the pattern and match strings passed in.
*/
-sc_bool
-uip_match(const sc_char *pattern, const sc_char *string, sc_gameref_t game) {
+sc_bool uip_match(const sc_char *pattern, const sc_char *string, sc_gameref_t game) {
static sc_char *cleansed; /* For setjmp safety. */
sc_char buffer[UIP_ALLOCATION_AVOIDANCE_SIZE];
sc_bool match;
@@ -1713,8 +1673,7 @@ uip_match(const sc_char *pattern, const sc_char *string, sc_gameref_t game) {
* resulting string to the caller, or NULL if no pronouns were replaced. The
* return string is malloc'ed, so the caller needs to remember to free it.
*/
-sc_char *
-uip_replace_pronouns(sc_gameref_t game, const sc_char *string) {
+sc_char *uip_replace_pronouns(sc_gameref_t game, const sc_char *string) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_int buffer_allocation;
sc_char *buffer;
@@ -1856,8 +1815,7 @@ uip_replace_pronouns(sc_gameref_t game, const sc_char *string) {
* pronouns for objects or NPC names as found. Later ones will overwrite
* earlier ones if there is more than one in the string.
*/
-void
-uip_assign_pronouns(sc_gameref_t game, const sc_char *string) {
+void uip_assign_pronouns(sc_gameref_t game, const sc_char *string) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
const sc_char *current;
diff --git a/engines/glk/adrift/scprintf.cpp b/engines/glk/adrift/scprintf.cpp
index 1ea93e880a..90c41305ce 100644
--- a/engines/glk/adrift/scprintf.cpp
+++ b/engines/glk/adrift/scprintf.cpp
@@ -65,11 +65,11 @@ static sc_bool pf_trace = FALSE;
* come before shorter ones. The <br> tag is missing because this is
* handled separately, as a simple put of '\n'.
*/
-typedef struct {
+struct sc_html_tags_t {
const sc_char *const name;
const sc_int length;
const sc_int tag;
-} sc_html_tags_t;
+};
static const sc_html_tags_t HTML_TAGS_TABLE[] = {
{"bgcolour", 8, SC_TAG_BGCOLOR}, {"bgcolor", 7, SC_TAG_BGCOLOR},
@@ -91,7 +91,7 @@ static const sc_html_tags_t HTML_TAGS_TABLE[] = {
* associated size and length, a note of any conversion to apply to the next
* buffered character, and a flag to let the filter ignore incoming text.
*/
-typedef struct sc_filter_s {
+struct sc_filter_s {
sc_uint magic;
sc_int buffer_length;
sc_int buffer_allocation;
@@ -99,7 +99,8 @@ typedef struct sc_filter_s {
sc_bool new_sentence;
sc_bool is_muted;
sc_bool needs_filtering;
-} sc_filter_t;
+};
+typedef sc_filter_s sc_filter_t;
/*
@@ -107,8 +108,7 @@ typedef struct sc_filter_s {
*
* Return TRUE if pointer is a valid printfilter, FALSE otherwise.
*/
-static sc_bool
-pf_is_valid(sc_filterref_t filter) {
+static sc_bool pf_is_valid(sc_filterref_t filter) {
return filter && filter->magic == PRINTFILTER_MAGIC;
}
@@ -118,8 +118,7 @@ pf_is_valid(sc_filterref_t filter) {
*
* Create and return a new printfilter.
*/
-sc_filterref_t
-pf_create(void) {
+sc_filterref_t pf_create(void) {
static sc_bool initialized = FALSE;
sc_filterref_t filter;
@@ -159,8 +158,7 @@ pf_create(void) {
*
* Destroy a printfilter and free its allocated memory.
*/
-void
-pf_destroy(sc_filterref_t filter) {
+void pf_destroy(sc_filterref_t filter) {
assert(pf_is_valid(filter));
/* Free buffer space, and poison and free the printfilter. */
@@ -183,8 +181,7 @@ pf_destroy(sc_filterref_t filter) {
* characters, and since some games have strings with this character in them,
* this is probably all that can be done.
*/
-static sc_char *
-pf_interpolate_vars(const sc_char *string, sc_var_setref_t vars) {
+static sc_char *pf_interpolate_vars(const sc_char *string, sc_var_setref_t vars) {
sc_char *buffer, *name;
const sc_char *cursor;
const sc_char *marker;
@@ -291,9 +288,7 @@ pf_interpolate_vars(const sc_char *string, sc_var_setref_t vars) {
* its equivalent, updating the buffer at the address passed in, including
* reallocating if necessary. Return TRUE if the buffer was changed.
*/
-static sc_bool
-pf_replace_alr(const sc_char *string,
- sc_char **buffer, sc_int alr, sc_prop_setref_t bundle) {
+static sc_bool pf_replace_alr(const sc_char *string, sc_char **buffer, sc_int alr, sc_prop_setref_t bundle) {
sc_vartype_t vt_key[3];
const sc_char *marker, *cursor, *original, *replacement;
sc_char *buffer_ = *buffer;
@@ -358,9 +353,8 @@ pf_replace_alr(const sc_char *string,
* ALRs were replaced, returns an allocated string with replacements done,
* otherwise returns NULL.
*/
-static sc_char *
-pf_replace_alrs(const sc_char *string, sc_prop_setref_t bundle,
- sc_bool alr_applied[], sc_int alr_count) {
+static sc_char *pf_replace_alrs(const sc_char *string, sc_prop_setref_t bundle,
+ sc_bool alr_applied[], sc_int alr_count) {
sc_int index_;
sc_char *buffer1, *buffer2, **buffer;
const sc_char *marker;
@@ -437,8 +431,7 @@ pf_replace_alrs(const sc_char *string, sc_prop_setref_t bundle,
* Edit the tag-stripped text element passed in, substituting &lt; &gt;
* +percent+ with < > %, then send to the OS-specific output functions.
*/
-static void
-pf_output_text(const sc_char *string) {
+static void pf_output_text(const sc_char *string) {
sc_int index_, b_index;
sc_char *buffer;
@@ -487,8 +480,7 @@ pf_output_text(const sc_char *string) {
*
* Output an HTML-like tag element to the OS-specific tag handling function.
*/
-static void
-pf_output_tag(const sc_char *contents) {
+static void pf_output_tag(const sc_char *contents) {
const sc_html_tags_t *entry;
const sc_char *argument;
@@ -539,8 +531,7 @@ pf_output_tag(const sc_char *contents) {
* Break apart HTML-like string into normal text elements, and HTML-like
* tags.
*/
-static void
-pf_output_untagged(const sc_char *string) {
+static void pf_output_untagged(const sc_char *string) {
sc_char *temporary, *untagged, *contents;
const sc_char *cursor;
const sc_char *marker;
@@ -636,9 +627,7 @@ pf_output_untagged(const sc_char *string) {
* until no more changes in the current string
*
*/
-static sc_char *
-pf_filter_internal(const sc_char *string,
- sc_var_setref_t vars, sc_prop_setref_t bundle) {
+static sc_char *pf_filter_internal(const sc_char *string, sc_var_setref_t vars, sc_prop_setref_t bundle) {
sc_int alr_count, iteration;
sc_char *current;
sc_bool *alr_applied;
@@ -743,9 +732,7 @@ pf_filter_internal(const sc_char *string,
* variables and replacing ALR's. Returns an allocated string that the caller
* needs to free.
*/
-sc_char *
-pf_filter(const sc_char *string,
- sc_var_setref_t vars, sc_prop_setref_t bundle) {
+sc_char *pf_filter(const sc_char *string, sc_var_setref_t vars, sc_prop_setref_t bundle) {
sc_char *current;
/* Filter this string, including ALRs replacements. */
@@ -769,8 +756,7 @@ pf_filter(const sc_char *string,
* Used on informational strings such as the game title and author. Returns
* an allocated string that the caller needs to free.
*/
-sc_char *
-pf_filter_for_info(const sc_char *string, sc_var_setref_t vars) {
+sc_char *pf_filter_for_info(const sc_char *string, sc_var_setref_t vars) {
sc_char *current;
/* Filter this string, excluding ALRs replacements. */
@@ -792,9 +778,7 @@ pf_filter_for_info(const sc_char *string, sc_var_setref_t vars) {
* Filter buffered data, interpolating variables and replacing ALR's, and
* send the resulting string to the output channel.
*/
-void
-pf_flush(sc_filterref_t filter,
- sc_var_setref_t vars, sc_prop_setref_t bundle) {
+void pf_flush(sc_filterref_t filter, sc_var_setref_t vars, sc_prop_setref_t bundle) {
assert(pf_is_valid(filter));
assert(vars && bundle);
@@ -834,8 +818,7 @@ pf_flush(sc_filterref_t filter,
*
* Append a string to the filter buffer.
*/
-static void
-pf_append_string(sc_filterref_t filter, const sc_char *string) {
+static void pf_append_string(sc_filterref_t filter, const sc_char *string) {
sc_int length, required;
/*
@@ -876,9 +859,7 @@ pf_append_string(sc_filterref_t filter, const sc_char *string) {
* polated in between main flushes; used to update buffered text with variable
* values before those values are updated by task actions.
*/
-void
-pf_checkpoint(sc_filterref_t filter,
- sc_var_setref_t vars, sc_prop_setref_t bundle) {
+void pf_checkpoint(sc_filterref_t filter, sc_var_setref_t vars, sc_prop_setref_t bundle) {
assert(pf_is_valid(filter));
assert(vars && bundle);
@@ -918,8 +899,7 @@ pf_checkpoint(sc_filterref_t filter,
* The second function is an optimization to avoid allocations and copying
* in client code.
*/
-const sc_char *
-pf_get_buffer(sc_filterref_t filter) {
+const sc_char *pf_get_buffer(sc_filterref_t filter) {
assert(pf_is_valid(filter));
/*
@@ -933,8 +913,7 @@ pf_get_buffer(sc_filterref_t filter) {
return NULL;
}
-sc_char *
-pf_transfer_buffer(sc_filterref_t filter) {
+sc_char *pf_transfer_buffer(sc_filterref_t filter) {
assert(pf_is_valid(filter));
/*
@@ -969,8 +948,7 @@ pf_transfer_buffer(sc_filterref_t filter) {
*
* Empty any text currently buffered in the filter.
*/
-void
-pf_empty(sc_filterref_t filter) {
+void pf_empty(sc_filterref_t filter) {
assert(pf_is_valid(filter));
/* Free any allocation, and return the filter to initialization state. */
@@ -991,8 +969,7 @@ pf_empty(sc_filterref_t filter) {
* Add a string, and a single character, to the printfilter buffer. If muted,
* these functions do nothing.
*/
-void
-pf_buffer_string(sc_filterref_t filter, const sc_char *string) {
+void pf_buffer_string(sc_filterref_t filter, const sc_char *string) {
assert(pf_is_valid(filter));
assert(string);
@@ -1014,8 +991,7 @@ pf_buffer_string(sc_filterref_t filter, const sc_char *string) {
}
}
-void
-pf_buffer_character(sc_filterref_t filter, sc_char character) {
+void pf_buffer_character(sc_filterref_t filter, sc_char character) {
sc_char buffer[2];
assert(pf_is_valid(filter));
@@ -1033,8 +1009,7 @@ pf_buffer_character(sc_filterref_t filter, sc_char character) {
* running code, which needs to run task actions and then prepend the task's
* completion text. If muted, this function does nothing.
*/
-void
-pf_prepend_string(sc_filterref_t filter, const sc_char *string) {
+void pf_prepend_string(sc_filterref_t filter, const sc_char *string) {
assert(pf_is_valid(filter));
assert(string);
@@ -1080,8 +1055,7 @@ pf_prepend_string(sc_filterref_t filter, const sc_char *string) {
* Tells the printfilter to force the next non-space character to uppercase.
* Ignored if the printfilter is muted.
*/
-void
-pf_new_sentence(sc_filterref_t filter) {
+void pf_new_sentence(sc_filterref_t filter) {
assert(pf_is_valid(filter));
if (!filter->is_muted)
@@ -1095,15 +1069,13 @@ pf_new_sentence(sc_filterref_t filter) {
*
* A muted printfilter ignores all new text additions.
*/
-void
-pf_mute(sc_filterref_t filter) {
+void pf_mute(sc_filterref_t filter) {
assert(pf_is_valid(filter));
filter->is_muted = TRUE;
}
-void
-pf_clear_mute(sc_filterref_t filter) {
+void pf_clear_mute(sc_filterref_t filter) {
assert(pf_is_valid(filter));
filter->is_muted = FALSE;
@@ -1116,8 +1088,7 @@ pf_clear_mute(sc_filterref_t filter) {
* Insert an HTML-like tag into the buffered output data. The call is ignored
* if the printfilter is muted.
*/
-void
-pf_buffer_tag(sc_filterref_t filter, sc_int tag) {
+void pf_buffer_tag(sc_filterref_t filter, sc_int tag) {
const sc_html_tags_t *entry;
assert(pf_is_valid(filter));
@@ -1145,8 +1116,7 @@ pf_buffer_tag(sc_filterref_t filter, sc_int tag) {
* status lines. It ignores all tags except <br>, which it replaces with
* a newline if requested by allow_newlines.
*/
-static void
-pf_strip_tags_common(sc_char *string, sc_bool allow_newlines) {
+static void pf_strip_tags_common(sc_char *string, sc_bool allow_newlines) {
sc_char *marker, *cursor;
/* Run through the string looking for <...> tags. */
@@ -1181,13 +1151,11 @@ pf_strip_tags_common(sc_char *string, sc_bool allow_newlines) {
* Public interfaces to pf_strip_tags_common(). The hints version will
* allow <br> tags to map into newlines in hints strings.
*/
-void
-pf_strip_tags(sc_char *string) {
+void pf_strip_tags(sc_char *string) {
pf_strip_tags_common(string, FALSE);
}
-void
-pf_strip_tags_for_hints(sc_char *string) {
+void pf_strip_tags_for_hints(sc_char *string) {
pf_strip_tags_common(string, TRUE);
}
@@ -1202,8 +1170,7 @@ pf_strip_tags_for_hints(sc_char *string) {
* the character itself followed by a space. The return string is malloc'ed,
* so the caller needs to remember to free it.
*/
-sc_char *
-pf_escape(const sc_char *string) {
+sc_char *pf_escape(const sc_char *string) {
const sc_char *marker, *cursor;
sc_char *buffer;
@@ -1277,8 +1244,7 @@ pf_escape(const sc_char *string) {
* Matches multiple words from words in string. Returns the extent of
* the match if the string matched, 0 otherwise.
*/
-static sc_int
-pf_compare_words(const sc_char *string, const sc_char *words) {
+static sc_int pf_compare_words(const sc_char *string, const sc_char *words) {
sc_int word_posn, posn;
/* None expected, but skip leading space. */
@@ -1332,8 +1298,7 @@ pf_compare_words(const sc_char *string, const sc_char *words) {
* string to the caller, or NULL if no synonym changes were needed. The
* return string is malloc'ed, so the caller needs to remember to free it.
*/
-sc_char *
-pf_filter_input(const sc_char *string, sc_prop_setref_t bundle) {
+sc_char *pf_filter_input(const sc_char *string, sc_prop_setref_t bundle) {
sc_vartype_t vt_key[3];
sc_int synonym_count, buffer_allocation;
sc_char *buffer;
@@ -1448,8 +1413,7 @@ pf_filter_input(const sc_char *string, sc_prop_setref_t bundle) {
*
* Set filter tracing on/off.
*/
-void
-pf_debug_trace(sc_bool flag) {
+void pf_debug_trace(sc_bool flag) {
pf_trace = flag;
}
diff --git a/engines/glk/adrift/scprops.cpp b/engines/glk/adrift/scprops.cpp
index aeb0d24db0..0888173ed2 100644
--- a/engines/glk/adrift/scprops.cpp
+++ b/engines/glk/adrift/scprops.cpp
@@ -80,8 +80,7 @@ typedef sc_prop_set_s sc_prop_set_t;
*
* Return TRUE if pointer is a valid properties set, FALSE otherwise.
*/
-static sc_bool
-prop_is_valid(sc_prop_setref_t bundle) {
+static sc_bool prop_is_valid(sc_prop_setref_t bundle) {
return bundle && bundle->magic == PROP_MAGIC;
}
@@ -91,8 +90,7 @@ prop_is_valid(sc_prop_setref_t bundle) {
*
* Round up a count of elements to the next block of grow increments.
*/
-static sc_int
-prop_round_up(sc_int elements) {
+static sc_int prop_round_up(sc_int elements) {
sc_int extended;
extended = elements + PROP_GROW_INCREMENT - 1;
@@ -111,9 +109,7 @@ prop_round_up(sc_int elements) {
* realloc() in blocks of elements, and thus need to realloc() much less
* frequently.
*/
-static void *
-prop_ensure_capacity(void *array,
- sc_int old_size, sc_int new_size, sc_int element_size) {
+static void *prop_ensure_capacity(void *array, sc_int old_size, sc_int new_size, sc_int element_size) {
sc_int current, required;
/*
@@ -145,8 +141,7 @@ prop_ensure_capacity(void *array,
* "unblock" the allocations of prop_ensure_capacity(). Once trimmed,
* the array cannot ever be grown safely again.
*/
-static void *
-prop_trim_capacity(void *array, sc_int size, sc_int element_size) {
+static void *prop_trim_capacity(void *array, sc_int size, sc_int element_size) {
if (prop_round_up(size) > size)
return sc_realloc(array, size * element_size);
else
@@ -161,8 +156,7 @@ prop_trim_capacity(void *array, sc_int size, sc_int element_size) {
* The function has return type "int" to match the libc implementations of
* bsearch() and qsort().
*/
-static int
-prop_compare(const void *string1, const void *string2) {
+static int prop_compare(const void *string1, const void *string2) {
return strcmp(*(sc_char * const *) string1, *(sc_char * const *) string2);
}
@@ -175,8 +169,7 @@ prop_compare(const void *string1, const void *string2) {
* either added or already present. Any new dictionary entry will
* contain a malloced copy of the string passed in.
*/
-static const sc_char *
-prop_dictionary_lookup(sc_prop_setref_t bundle, const sc_char *string) {
+static const sc_char *prop_dictionary_lookup(sc_prop_setref_t bundle, const sc_char *string) {
sc_char *dict_string;
/*
@@ -223,8 +216,7 @@ prop_dictionary_lookup(sc_prop_setref_t bundle, const sc_char *string) {
* for even a small game is large, and preallocating pools avoids excessive
* malloc's of small individual nodes.
*/
-static sc_prop_noderef_t
-prop_new_node(sc_prop_setref_t bundle) {
+static sc_prop_noderef_t prop_new_node(sc_prop_setref_t bundle) {
sc_int node_index;
sc_prop_noderef_t node;
@@ -260,8 +252,7 @@ prop_new_node(sc_prop_setref_t bundle) {
*
* Find a child node of the given parent whose name matches that passed in.
*/
-static sc_prop_noderef_t
-prop_find_child(sc_prop_noderef_t parent, sc_int type, sc_vartype_t name) {
+static sc_prop_noderef_t prop_find_child(sc_prop_noderef_t parent, sc_int type, sc_vartype_t name) {
/* See if this node has any children. */
if (parent->child_list) {
sc_int index_;
@@ -330,9 +321,8 @@ prop_find_child(sc_prop_noderef_t parent, sc_int type, sc_vartype_t name) {
* Add a new child node to the given parent. Return its reference. Set
* needs to be passed so that string names can be added to the dictionary.
*/
-static sc_prop_noderef_t
-prop_add_child(sc_prop_noderef_t parent,
- sc_int type, sc_vartype_t name, sc_prop_setref_t bundle) {
+static sc_prop_noderef_t prop_add_child(sc_prop_noderef_t parent, sc_int type,
+ sc_vartype_t name, sc_prop_setref_t bundle) {
sc_prop_noderef_t child;
/* Not possible if growable allocations have been trimmed. */
@@ -422,9 +412,8 @@ prop_add_child(sc_prop_noderef_t parent,
* "I->sssis", stores an integer, with a key composed of three strings, an
* integer, and another string.
*/
-void
-prop_put(sc_prop_setref_t bundle, const sc_char *format,
- sc_vartype_t vt_value, const sc_vartype_t vt_key[]) {
+void prop_put(sc_prop_setref_t bundle, const sc_char *format,
+ sc_vartype_t vt_value, const sc_vartype_t vt_key[]) {
sc_prop_noderef_t node;
sc_int index_;
assert(prop_is_valid(bundle));
@@ -523,9 +512,8 @@ prop_put(sc_prop_setref_t bundle, const sc_char *format,
* Retrieve a property from a properties set. Format stuff as above, except
* with "->" replaced with "<-". Returns FALSE if no such property exists.
*/
-sc_bool
-prop_get(sc_prop_setref_t bundle, const sc_char *format,
- sc_vartype_t *vt_rvalue, const sc_vartype_t vt_key[]) {
+sc_bool prop_get(sc_prop_setref_t bundle, const sc_char *format, sc_vartype_t *vt_rvalue,
+ const sc_vartype_t vt_key[]) {
sc_prop_noderef_t node;
sc_int index_;
assert(prop_is_valid(bundle));
@@ -633,8 +621,7 @@ prop_get(sc_prop_setref_t bundle, const sc_char *format,
* Trim excess allocation from growable arrays, and fix the properties set
* so that no further property insertions are allowed.
*/
-static void
-prop_trim_node(sc_prop_noderef_t node) {
+static void prop_trim_node(sc_prop_noderef_t node) {
/* End recursion on null or childless node. */
if (node && node->child_list) {
sc_int index_;
@@ -650,8 +637,7 @@ prop_trim_node(sc_prop_noderef_t node) {
}
}
-void
-prop_solidify(sc_prop_setref_t bundle) {
+void prop_solidify(sc_prop_setref_t bundle) {
assert(prop_is_valid(bundle));
/*
@@ -685,9 +671,7 @@ prop_solidify(sc_prop_setref_t bundle) {
* Convenience functions to retrieve a property of a known type directly.
* It is an error for the property not to exist on retrieval.
*/
-sc_int
-prop_get_integer(sc_prop_setref_t bundle,
- const sc_char *format, const sc_vartype_t vt_key[]) {
+sc_int prop_get_integer(sc_prop_setref_t bundle, const sc_char *format, const sc_vartype_t vt_key[]) {
sc_vartype_t vt_rvalue;
assert(format[0] == PROP_INTEGER);
@@ -697,9 +681,7 @@ prop_get_integer(sc_prop_setref_t bundle,
return vt_rvalue.integer;
}
-sc_bool
-prop_get_boolean(sc_prop_setref_t bundle,
- const sc_char *format, const sc_vartype_t vt_key[]) {
+sc_bool prop_get_boolean(sc_prop_setref_t bundle, const sc_char *format, const sc_vartype_t vt_key[]) {
sc_vartype_t vt_rvalue;
assert(format[0] == PROP_BOOLEAN);
@@ -709,9 +691,7 @@ prop_get_boolean(sc_prop_setref_t bundle,
return vt_rvalue.boolean;
}
-const sc_char *
-prop_get_string(sc_prop_setref_t bundle,
- const sc_char *format, const sc_vartype_t vt_key[]) {
+const sc_char *prop_get_string(sc_prop_setref_t bundle, const sc_char *format, const sc_vartype_t vt_key[]) {
sc_vartype_t vt_rvalue;
assert(format[0] == PROP_STRING);
@@ -728,9 +708,7 @@ prop_get_string(sc_prop_setref_t bundle,
* Convenience function to retrieve a count of child properties available
* for a given property. Returns zero if the property does not exist.
*/
-sc_int
-prop_get_child_count(sc_prop_setref_t bundle,
- const sc_char *format, const sc_vartype_t vt_key[]) {
+sc_int prop_get_child_count(sc_prop_setref_t bundle, const sc_char *format, const sc_vartype_t vt_key[]) {
sc_vartype_t vt_rvalue;
assert(format[0] == PROP_INTEGER);
@@ -747,8 +725,7 @@ prop_get_child_count(sc_prop_setref_t bundle,
*
* Create a new, empty properties set, and return it.
*/
-static sc_prop_setref_t
-prop_create_empty() {
+static sc_prop_setref_t prop_create_empty() {
sc_prop_setref_t bundle;
/* Create a new, empty set. */
@@ -793,8 +770,7 @@ prop_create_empty() {
*
* Free set memory, and destroy a properties set structure.
*/
-static void
-prop_destroy_child_list(sc_prop_noderef_t node) {
+static void prop_destroy_child_list(sc_prop_noderef_t node) {
/* End recursion on null or childless node. */
if (node && node->child_list) {
sc_int index_;
@@ -808,8 +784,7 @@ prop_destroy_child_list(sc_prop_noderef_t node) {
}
}
-void
-prop_destroy(sc_prop_setref_t bundle) {
+void prop_destroy(sc_prop_setref_t bundle) {
sc_int index_;
assert(prop_is_valid(bundle));
@@ -853,8 +828,7 @@ prop_destroy(sc_prop_setref_t bundle) {
*
* Create a new properties set based on a taf, and return it.
*/
-sc_prop_setref_t
-prop_create(const sc_tafref_t taf) {
+sc_prop_setref_t prop_create(const sc_tafref_t taf) {
sc_prop_setref_t bundle;
/* Create a new, empty set. */
@@ -877,8 +851,7 @@ prop_create(const sc_tafref_t taf) {
*
* Adopt a memory address for free'ing on destroy.
*/
-void
-prop_adopt(sc_prop_setref_t bundle, void *addr) {
+void prop_adopt(sc_prop_setref_t bundle, void *addr) {
assert(prop_is_valid(bundle));
/* Extend the orphans array if necessary. */
@@ -899,8 +872,7 @@ prop_adopt(sc_prop_setref_t bundle, void *addr) {
*
* Print out a complete properties set.
*/
-static sc_bool
-prop_debug_is_dictionary_string(sc_prop_setref_t bundle, const void *pointer) {
+static sc_bool prop_debug_is_dictionary_string(sc_prop_setref_t bundle, const void *pointer) {
const sc_char *const pointer_ = (const sc_char * const)pointer;
sc_int index_;
@@ -913,9 +885,8 @@ prop_debug_is_dictionary_string(sc_prop_setref_t bundle, const void *pointer) {
return FALSE;
}
-static void
-prop_debug_dump_node(sc_prop_setref_t bundle,
- sc_int depth, sc_int child_index, sc_prop_noderef_t node) {
+static void prop_debug_dump_node(sc_prop_setref_t bundle, sc_int depth,
+ sc_int child_index, sc_prop_noderef_t node) {
sc_int index_;
/* Write node preamble, indented two spaces for each depth count. */
@@ -953,8 +924,7 @@ prop_debug_dump_node(sc_prop_setref_t bundle,
sc_trace("\n");
}
-void
-prop_debug_dump(sc_prop_setref_t bundle) {
+void prop_debug_dump(sc_prop_setref_t bundle) {
sc_int index_;
assert(prop_is_valid(bundle));
@@ -988,8 +958,7 @@ prop_debug_dump(sc_prop_setref_t bundle) {
*
* Set property tracing on/off.
*/
-void
-prop_debug_trace(sc_bool flag) {
+void prop_debug_trace(sc_bool flag) {
prop_trace = flag;
}
diff --git a/engines/glk/adrift/scprotos.h b/engines/glk/adrift/scprotos.h
index 24103b93f8..9601f0618d 100644
--- a/engines/glk/adrift/scprotos.h
+++ b/engines/glk/adrift/scprotos.h
@@ -779,18 +779,13 @@ extern void if_read_line(sc_char *buffer, sc_int length);
extern void if_read_debug(sc_char *buffer, sc_int length);
extern sc_bool if_confirm(sc_int type);
extern void *if_open_saved_game(sc_bool is_save);
-extern void if_write_saved_game(void *opaque,
- const sc_byte *buffer, sc_int length);
-extern sc_int if_read_saved_game(void *opaque,
- sc_byte *buffer, sc_int length);
+extern void if_write_saved_game(void *opaque, const sc_byte *buffer, sc_int length);
+extern sc_int if_read_saved_game(void *opaque, sc_byte *buffer, sc_int length);
extern void if_close_saved_game(void *opaque);
extern void if_display_hints(sc_gameref_t game);
-extern void if_update_sound(const sc_char *filepath,
- sc_int sound_offset,
- sc_int sound_length, sc_bool is_looping);
-extern void if_update_graphic(const sc_char *filepath,
- sc_int graphic_offset,
- sc_int graphic_length);
+extern void if_update_sound(const sc_char *filepath, sc_int sound_offset,
+ sc_int sound_length, sc_bool is_looping);
+extern void if_update_graphic(const sc_char *filepath, sc_int graphic_offset, sc_int graphic_length);
#endif
diff --git a/engines/glk/adrift/scresour.cpp b/engines/glk/adrift/scresour.cpp
index 739c3d73f6..c09a5c82ab 100644
--- a/engines/glk/adrift/scresour.cpp
+++ b/engines/glk/adrift/scresour.cpp
@@ -37,8 +37,7 @@ static const sc_char NUL = '\0';
*
* Return TRUE if the game uses sound or graphics.
*/
-sc_bool
-res_has_sound(sc_gameref_t game) {
+sc_bool res_has_sound(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
sc_bool has_sound;
@@ -50,8 +49,7 @@ res_has_sound(sc_gameref_t game) {
return has_sound;
}
-sc_bool
-res_has_graphics(sc_gameref_t game) {
+sc_bool res_has_graphics(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
sc_bool has_graphics;
@@ -71,21 +69,18 @@ res_has_graphics(sc_gameref_t game) {
*
* Convenience functions to set, clear, and compare resource fields.
*/
-static void
-res_set_resource(sc_resourceref_t resource, const sc_char *name,
+static void res_set_resource(sc_resourceref_t resource, const sc_char *name,
sc_int offset, sc_int length) {
resource->name = name;
resource->offset = offset;
resource->length = length;
}
-void
-res_clear_resource(sc_resourceref_t resource) {
+void res_clear_resource(sc_resourceref_t resource) {
res_set_resource(resource, "", 0, 0);
}
-sc_bool
-res_compare_resource(sc_resourceref_t from, sc_resourceref_t with) {
+sc_bool res_compare_resource(sc_resourceref_t from, sc_resourceref_t with) {
return strcmp(from->name, with->name) == 0
&& from->offset == with->offset && from->length == with->length;
}
@@ -103,10 +98,8 @@ res_compare_resource(sc_resourceref_t from, sc_resourceref_t with) {
* in prop_get), and the partial key is guaranteed to contain at least
* strlen(partial_format) elements.
*/
-void
-res_handle_resource(sc_gameref_t game,
- const sc_char *partial_format,
- const sc_vartype_t vt_partial[]) {
+void res_handle_resource(sc_gameref_t game, const sc_char *partial_format,
+ const sc_vartype_t vt_partial[]) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2], *vt_full;
sc_int partial_length, resource_start_offset;
@@ -250,8 +243,7 @@ res_handle_resource(sc_gameref_t game,
* Bring resources into line with the game; called on undo, restart,
* restore, and so on.
*/
-void
-res_sync_resources(sc_gameref_t game) {
+void res_sync_resources(sc_gameref_t game) {
assert(gs_is_game_valid(game));
/* Deal with any latched sound stop first. */
@@ -307,8 +299,7 @@ res_sync_resources(sc_gameref_t game) {
* Turn off sound and graphics, and reset the game's tracking of resources in
* use to match. Called on game restart or restore.
*/
-void
-res_cancel_resources(sc_gameref_t game) {
+void res_cancel_resources(sc_gameref_t game) {
assert(gs_is_game_valid(game));
/* Request that everything stops and clears. */
diff --git a/engines/glk/adrift/screstrs.cpp b/engines/glk/adrift/screstrs.cpp
index 3f1db887f4..c808129415 100644
--- a/engines/glk/adrift/screstrs.cpp
+++ b/engines/glk/adrift/screstrs.cpp
@@ -40,8 +40,7 @@ static sc_bool restr_trace = FALSE;
*
* Return the index of the n'th integer found.
*/
-static sc_int
-restr_integer_variable(sc_gameref_t game, sc_int n) {
+static sc_int restr_integer_variable(sc_gameref_t game, sc_int n) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int var_count, var, count;
@@ -70,9 +69,7 @@ restr_integer_variable(sc_gameref_t game, sc_int n) {
*
* Is object in a certain place, state, or condition.
*/
-static sc_bool
-restr_object_in_place(sc_gameref_t game,
- sc_int object, sc_int var2, sc_int var3) {
+static sc_bool restr_object_in_place(sc_gameref_t game, sc_int object, sc_int var2, sc_int var3) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_int npc;
@@ -157,9 +154,8 @@ restr_object_in_place(sc_gameref_t game,
*
* Evaluate restrictions relating to object location.
*/
-static sc_bool
-restr_pass_task_object_location(sc_gameref_t game,
- sc_int var1, sc_int var2, sc_int var3) {
+static sc_bool restr_pass_task_object_location(sc_gameref_t game,
+ sc_int var1, sc_int var2, sc_int var3) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_bool should_be;
sc_int object;
@@ -231,8 +227,7 @@ restr_pass_task_object_location(sc_gameref_t game,
* Evaluate restrictions relating to object states. This function is called
* from the library by lib_pass_alt_room(), so cannot be static.
*/
-sc_bool
-restr_pass_task_object_state(sc_gameref_t game, sc_int var1, sc_int var2) {
+sc_bool restr_pass_task_object_state(sc_gameref_t game, sc_int var1, sc_int var2) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[3];
@@ -279,8 +274,7 @@ restr_pass_task_object_state(sc_gameref_t game, sc_int var1, sc_int var2) {
*
* Evaluate restrictions relating to task states.
*/
-static sc_bool
-restr_pass_task_task_state(sc_gameref_t game, sc_int var1, sc_int var2) {
+static sc_bool restr_pass_task_task_state(sc_gameref_t game, sc_int var1, sc_int var2) {
sc_bool should_be;
if (restr_trace)
@@ -318,8 +312,7 @@ restr_pass_task_task_state(sc_gameref_t game, sc_int var1, sc_int var2) {
*
* Evaluate restrictions relating to player and NPCs.
*/
-static sc_bool
-restr_pass_task_char(sc_gameref_t game, sc_int var1, sc_int var2, sc_int var3) {
+static sc_bool restr_pass_task_char(sc_gameref_t game, sc_int var1, sc_int var2, sc_int var3) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_int npc1, npc2;
@@ -437,9 +430,7 @@ restr_pass_task_char(sc_gameref_t game, sc_int var1, sc_int var2, sc_int var3) {
*
* Helper for restr_pass_task_var(), handles integer variable restrictions.
*/
-static sc_bool
-restr_pass_task_int_var(sc_gameref_t game,
- sc_int var2, sc_int var3, sc_int value) {
+static sc_bool restr_pass_task_int_var(sc_gameref_t game, sc_int var2, sc_int var3, sc_int value) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[3];
@@ -522,9 +513,7 @@ restr_pass_task_int_var(sc_gameref_t game,
*
* Helper for restr_pass_task_var(), handles string variable restrictions.
*/
-static sc_bool
-restr_pass_task_string_var(sc_int var2,
- const sc_char *var4, const sc_char *value) {
+static sc_bool restr_pass_task_string_var(sc_int var2, const sc_char *var4, const sc_char *value) {
if (restr_trace) {
sc_trace("Restr: running string"
" var restriction, %ld, \"%s\", \"%s\"\n", var2, var4, value);
@@ -550,10 +539,8 @@ restr_pass_task_string_var(sc_int var2,
*
* Evaluate restrictions relating to variables.
*/
-static sc_bool
-restr_pass_task_var(sc_gameref_t game,
- sc_int var1, sc_int var2, sc_int var3,
- const sc_char *var4) {
+static sc_bool restr_pass_task_var(sc_gameref_t game, sc_int var1, sc_int var2, sc_int var3,
+ const sc_char *var4) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[3];
@@ -607,8 +594,7 @@ restr_pass_task_var(sc_gameref_t game,
*
* Demultiplexer for task restrictions.
*/
-static sc_bool
-restr_pass_task_restriction(sc_gameref_t game, sc_int task, sc_int restriction) {
+static sc_bool restr_pass_task_restriction(sc_gameref_t game, sc_int task, sc_int restriction) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int type, var1, var2, var3;
@@ -712,15 +698,13 @@ static sc_int restr_index = 0;
*
* Start and wrap up restrictions combinations string tokenization.
*/
-static void
-restr_tokenize_start(const sc_char *expression) {
+static void restr_tokenize_start(const sc_char *expression) {
/* Save expression, and restart index. */
restr_expression = expression;
restr_index = 0;
}
-static void
-restr_tokenize_end(void) {
+static void restr_tokenize_end(void) {
restr_expression = NULL;
restr_index = 0;
}
@@ -731,8 +715,7 @@ restr_tokenize_end(void) {
*
* Simple tokenizer for restrictions combination expressions.
*/
-static sc_char
-restr_next_token(void) {
+static sc_char restr_next_token(void) {
assert(restr_expression);
/* Find the next non-space, and return it. */
@@ -775,8 +758,7 @@ static sc_int restr_lowest_fail = -1;
* Reset the evaluation stack to an empty state, and note the things we have
* to note for when we need to evaluate a restriction.
*/
-static void
-restr_eval_start(sc_gameref_t game, sc_int task) {
+static void restr_eval_start(sc_gameref_t game, sc_int task) {
/* Clear stack. */
restr_eval_stack = 0;
restr_eval_restriction = 0;
@@ -795,8 +777,7 @@ restr_eval_start(sc_gameref_t game, sc_int task) {
*
* Push a value onto the values stack.
*/
-static void
-restr_eval_push(sc_bool value) {
+static void restr_eval_push(sc_bool value) {
if (restr_eval_stack >= MAX_NESTING_DEPTH)
sc_fatal("restr_eval_push: stack overflow\n");
@@ -809,8 +790,7 @@ restr_eval_push(sc_bool value) {
*
* Evaluate the effect of an and/or into the values stack.
*/
-static void
-restr_eval_action(sc_char token) {
+static void restr_eval_action(sc_char token) {
/* Select action based on parsed token. */
switch (token) {
/* Handle evaluating and pushing a restriction result. */
@@ -875,8 +855,7 @@ restr_eval_action(sc_char token) {
*
* Return the top of the values stack as the evaluation result.
*/
-static sc_int
-restr_eval_result(sc_int *lowest_fail) {
+static sc_int restr_eval_result(sc_int *lowest_fail) {
if (restr_eval_stack != 1)
sc_fatal("restr_eval_result: values stack not completed\n");
@@ -896,8 +875,7 @@ static sc_char restr_lookahead = '\0';
*
* Match a token with an expectation.
*/
-static void
-restr_match(sc_char c) {
+static void restr_match(sc_char c) {
if (restr_lookahead == c)
restr_lookahead = restr_next_token();
else {
@@ -918,8 +896,7 @@ static void restr_bexpr(void);
*
* Expression parsers. Here we go again...
*/
-static void
-restr_andexpr(void) {
+static void restr_andexpr(void) {
restr_bexpr();
while (restr_lookahead == TOK_AND) {
restr_match(TOK_AND);
@@ -928,8 +905,7 @@ restr_andexpr(void) {
}
}
-static void
-restr_orexpr(void) {
+static void restr_orexpr(void) {
restr_andexpr();
while (restr_lookahead == TOK_OR) {
restr_match(TOK_OR);
@@ -938,8 +914,7 @@ restr_orexpr(void) {
}
}
-static void
-restr_bexpr(void) {
+static void restr_bexpr(void) {
switch (restr_lookahead) {
case TOK_RESTRICTION:
restr_match(TOK_RESTRICTION);
@@ -964,8 +939,7 @@ restr_bexpr(void) {
*
* Get the FailMessage for the given task restriction; NULL if none.
*/
-static const sc_char *
-restr_get_fail_message(sc_gameref_t game, sc_int task, sc_int restriction) {
+static const sc_char *restr_get_fail_message(sc_gameref_t game, sc_int task, sc_int restriction) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
const sc_char *message;
@@ -988,8 +962,7 @@ restr_get_fail_message(sc_gameref_t game, sc_int task, sc_int restriction) {
*
* Set restrictions tracing on/off.
*/
-void
-restr_debug_trace(sc_bool flag) {
+void restr_debug_trace(sc_bool flag) {
restr_trace = flag;
}
@@ -1004,10 +977,8 @@ restr_debug_trace(sc_bool flag) {
* if no failing restriction has a FailMessage. The function's main return
* value is TRUE if restrictions parsed successfully, FALSE otherwise.
*/
-sc_bool
-restr_eval_task_restrictions(sc_gameref_t game,
- sc_int task, sc_bool *pass,
- const sc_char **fail_message) {
+sc_bool restr_eval_task_restrictions(sc_gameref_t game, sc_int task, sc_bool *pass,
+ const sc_char **fail_message) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int restr_count, lowest_fail;
diff --git a/engines/glk/adrift/scrunner.cpp b/engines/glk/adrift/scrunner.cpp
index 9e979d1193..95c8f1906a 100644
--- a/engines/glk/adrift/scrunner.cpp
+++ b/engines/glk/adrift/scrunner.cpp
@@ -44,8 +44,7 @@ static const sc_char *const SEPARATORS = ".,";
* present, only getdynfromroom() exists. Returns TRUE if function found
* and handled.
*/
-static sc_bool
-run_is_task_function(const sc_char *pattern, sc_gameref_t game) {
+static sc_bool run_is_task_function(const sc_char *pattern, sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[3];
@@ -107,10 +106,11 @@ run_is_task_function(const sc_char *pattern, sc_gameref_t game) {
/* Structure used to associate a pattern with a handler function. */
-typedef struct sc_commands_s {
+struct sc_commands_s {
const sc_char *const command;
sc_bool(*const handler)(sc_gameref_t game);
-} sc_commands_t;
+};
+typedef sc_commands_s sc_commands_t;
typedef sc_commands_t *sc_commandsref_t;
/* Movement commands for the four point compass. */
@@ -487,8 +487,7 @@ static sc_commands_t STANDARD_COMMANDS[] = {
* For now, I can't find any better way to try to handle it than to make
* object acquisition take precedence over game commands.
*/
-static sc_bool
-run_priority_commands(sc_gameref_t game, const sc_char *string) {
+static sc_bool run_priority_commands(sc_gameref_t game, const sc_char *string) {
sc_commandsref_t command;
for (command = PRIORITY_COMMANDS; command->command; command++) {
@@ -502,8 +501,7 @@ run_priority_commands(sc_gameref_t game, const sc_char *string) {
return FALSE;
}
-static sc_bool
-run_standard_commands(sc_gameref_t game, const sc_char *string) {
+static sc_bool run_standard_commands(sc_gameref_t game, const sc_char *string) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[2];
sc_bool eightpointcompass;
@@ -543,8 +541,7 @@ run_standard_commands(sc_gameref_t game, const sc_char *string) {
*
* Update the game's current room and status line strings.
*/
-static void
-run_update_status(sc_gameref_t game) {
+static void run_update_status(sc_gameref_t game) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[2];
@@ -589,8 +586,7 @@ run_update_status(sc_gameref_t game) {
* directly for printing, rather than the filter, so that it can place its
* output ahead of buffered printfilter text.
*/
-static void
-run_notify_score_change(sc_gameref_t game) {
+static void run_notify_score_change(sc_gameref_t game) {
const sc_gameref_t undo = game->undo;
sc_char buffer[32];
assert(gs_is_game_valid(undo));
@@ -630,10 +626,8 @@ run_notify_score_change(sc_gameref_t game) {
* if a task command matches, FALSE otherwise. Ordinary or reverse commands
* are selected by 'forwards'.
*/
-static sc_bool
-run_match_task_common(sc_gameref_t game,
- sc_int task, const sc_char *string, sc_bool forwards,
- sc_bool is_library, sc_bool is_normal) {
+static sc_bool run_match_task_common(sc_gameref_t game, sc_int task, const sc_char *string,
+ sc_bool forwards, sc_bool is_library, sc_bool is_normal) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
sc_int command_count, command;
@@ -682,10 +676,8 @@ run_match_task_common(sc_gameref_t game,
return is_matched;
}
-static sc_bool
-run_match_task_commands(sc_gameref_t game,
- sc_int task, const sc_char *string,
- sc_bool forwards, sc_bool is_library) {
+static sc_bool run_match_task_commands(sc_gameref_t game, sc_int task,
+ const sc_char *string, sc_bool forwards, sc_bool is_library) {
/*
* Match tasks using the normal pattern matcher, with or without any note
* about whether the call is from the library.
@@ -693,9 +685,8 @@ run_match_task_commands(sc_gameref_t game,
return run_match_task_common(game, task, string, forwards, is_library, TRUE);
}
-static sc_bool
-run_match_task_functions(sc_gameref_t game,
- sc_int task, const sc_char *string, sc_bool forwards) {
+static sc_bool run_match_task_functions(sc_gameref_t game, sc_int task,
+ const sc_char *string, sc_bool forwards) {
/* Match tasks against "task command functions". */
return run_match_task_common(game, task, string, forwards, FALSE, FALSE);
}
@@ -713,8 +704,7 @@ run_match_task_functions(sc_gameref_t game,
* indicates why it fails; such tasks, if run, produce their failure message
* and don't change state.
*/
-static sc_bool
-run_task_is_unrestricted(sc_gameref_t game, sc_int task) {
+static sc_bool run_task_is_unrestricted(sc_gameref_t game, sc_int task) {
sc_bool restrictions_passed;
const sc_char *fail_message;
@@ -732,8 +722,7 @@ run_task_is_unrestricted(sc_gameref_t game, sc_int task) {
return restrictions_passed;
}
-static sc_bool
-run_task_is_loudly_restricted(sc_gameref_t game, sc_int task) {
+static sc_bool run_task_is_loudly_restricted(sc_gameref_t game, sc_int task) {
sc_bool restrictions_passed;
const sc_char *fail_message;
@@ -788,9 +777,8 @@ run_task_is_loudly_restricted(sc_gameref_t game, sc_int task) {
* library to try to run "get " and "drop " game commands for standard get/drop
* handlers and get_all/drop_all handlers. No pressure, then.
*/
-static sc_bool
-run_game_commands_common(sc_gameref_t game, const sc_char *string,
- sc_bool include_restrictions, sc_bool is_library) {
+static sc_bool run_game_commands_common(sc_gameref_t game, const sc_char *string,
+ sc_bool include_restrictions, sc_bool is_library) {
sc_bool is_matched = FALSE, is_handled = FALSE;
sc_bool *is_matching;
sc_int task_count, task, direction;
@@ -883,9 +871,8 @@ run_game_commands_common(sc_gameref_t game, const sc_char *string,
return is_handled;
}
-static sc_bool
-run_game_commands_in_parser_context(sc_gameref_t game, const sc_char *string,
- sc_bool include_restrictions) {
+static sc_bool run_game_commands_in_parser_context(sc_gameref_t game,
+ const sc_char *string, sc_bool include_restrictions) {
/*
* Try game commands, either with or without restrictions, and all full and
* complete parse matching (no special case for game commands that begin
@@ -894,8 +881,7 @@ run_game_commands_in_parser_context(sc_gameref_t game, const sc_char *string,
return run_game_commands_common(game, string, include_restrictions, FALSE);
}
-static sc_bool
-run_game_commands_in_library_context(sc_gameref_t game, const sc_char *string) {
+static sc_bool run_game_commands_in_library_context(sc_gameref_t game, const sc_char *string) {
/*
* Try game commands, including restrictions, and noting that this is a
* library call so that the parse matcher can exclude game commands that
@@ -912,8 +898,7 @@ run_game_commands_in_library_context(sc_gameref_t game, const sc_char *string) {
* "task command functions". These seem to happen in addition to any regular
* command matches, so we try them as a separate action.
*/
-static void
-run_game_functions(sc_gameref_t game, const sc_char *string) {
+static void run_game_functions(sc_gameref_t game, const sc_char *string) {
sc_int task_count, task, direction;
/* Iterate over every task, ignoring those not runnable. */
@@ -947,8 +932,7 @@ run_game_functions(sc_gameref_t game, const sc_char *string) {
* main user input handling loop; the latter by the library when looking for
* game commands that override standard actions.
*/
-static sc_bool
-run_all_commands(sc_gameref_t game, const sc_char *string) {
+static sc_bool run_all_commands(sc_gameref_t game, const sc_char *string) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_bool status;
@@ -1009,8 +993,7 @@ run_all_commands(sc_gameref_t game, const sc_char *string) {
return status;
}
-sc_bool
-run_game_task_commands(sc_gameref_t game, const sc_char *string) {
+sc_bool run_game_task_commands(sc_gameref_t game, const sc_char *string) {
return run_game_commands_in_library_context(game, string);
}
@@ -1032,8 +1015,7 @@ run_game_task_commands(sc_gameref_t game, const sc_char *string) {
* this is a signal to reset all noted line input to initial conditions, and
* just return. Sorry about the ugliness.
*/
-static sc_bool
-run_player_input(sc_gameref_t game) {
+static sc_bool run_player_input(sc_gameref_t game) {
static sc_char line_buffer[LINE_BUFFER_SIZE];
static sc_char prior_element[LINE_BUFFER_SIZE];
static sc_char line_element[LINE_BUFFER_SIZE];
@@ -1254,8 +1236,7 @@ run_player_input(sc_gameref_t game) {
*
* Main interpreter loop.
*/
-static void
-run_main_loop(sc_gameref_t game) {
+static void run_main_loop(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
@@ -1436,8 +1417,7 @@ run_main_loop(sc_gameref_t game) {
*
* Create a game context from a callback.
*/
-sc_gameref_t
-run_create(sc_read_callbackref_t callback, void *opaque) {
+sc_gameref_t run_create(sc_read_callbackref_t callback, void *opaque) {
sc_tafref_t taf;
sc_prop_setref_t bundle;
sc_var_setref_t vars, temporary_vars, undo_vars;
@@ -1502,8 +1482,7 @@ run_create(sc_read_callbackref_t callback, void *opaque) {
*
* Return a game context to initial states to restart a game.
*/
-static void
-run_restart_handler(sc_gameref_t game) {
+static void run_restart_handler(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_gameref_t new_game;
@@ -1548,8 +1527,7 @@ run_restart_handler(sc_gameref_t game) {
*
* Adjust a game context for continuation after restoring a game.
*/
-static void
-run_restore_handler(sc_gameref_t game) {
+static void run_restore_handler(sc_gameref_t game) {
/* Invalidate the undo buffer. */
game->undo_available = FALSE;
@@ -1570,8 +1548,7 @@ run_restore_handler(sc_gameref_t game) {
*
* Tidy up printfilter and input statics on game quit.
*/
-static void
-run_quit_handler(sc_gameref_t game) {
+static void run_quit_handler(sc_gameref_t game) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
@@ -1597,8 +1574,7 @@ run_quit_handler(sc_gameref_t game) {
*
* Intepret the game in a game context.
*/
-void
-run_interpret(sc_gameref_t game) {
+void run_interpret(sc_gameref_t game) {
assert(gs_is_game_valid(game));
/* Verify the game is not already running, and is runnable. */
@@ -1652,8 +1628,7 @@ run_interpret(sc_gameref_t game) {
*
* Destroy a game context, and free all resources.
*/
-void
-run_destroy(sc_gameref_t game) {
+void run_destroy(sc_gameref_t game) {
assert(gs_is_game_valid(game));
/* Can't destroy the context of a running game. */
@@ -1706,8 +1681,7 @@ run_destroy(sc_gameref_t game) {
* Quits a running game. This function calls a longjump to act as if
* run_main_loop() returned, and so never returns to its caller.
*/
-void
-run_quit(sc_gameref_t game) {
+void run_quit(sc_gameref_t game) {
assert(gs_is_game_valid(game));
/* Disallow quitting a non-running game. */
@@ -1730,8 +1704,7 @@ run_quit(sc_gameref_t game) {
* function calls a longjump to act as if run_main_loop() returned, and so
* never returns to its caller. For stopped games, it returns.
*/
-void
-run_restart(sc_gameref_t game) {
+void run_restart(sc_gameref_t game) {
assert(gs_is_game_valid(game));
/*
@@ -1757,16 +1730,14 @@ run_restart(sc_gameref_t game) {
*
* Saves either a running or a stopped game.
*/
-void
-run_save(sc_gameref_t game, sc_write_callbackref_t callback, void *opaque) {
+void run_save(sc_gameref_t game, sc_write_callbackref_t callback, void *opaque) {
assert(gs_is_game_valid(game));
assert(callback);
ser_save_game(game, callback, opaque);
}
-sc_bool
-run_save_prompted(sc_gameref_t game) {
+sc_bool run_save_prompted(sc_gameref_t game) {
assert(gs_is_game_valid(game));
return ser_save_game_prompted(game);
@@ -1784,9 +1755,7 @@ run_save_prompted(sc_gameref_t game) {
* restore, and for stopped games, they will return, with TRUE if successful,
* FALSE if restore failed.
*/
-static sc_bool
-run_restore_common(sc_gameref_t game,
- sc_read_callbackref_t callback, void *opaque) {
+static sc_bool run_restore_common(sc_gameref_t game, sc_read_callbackref_t callback, void *opaque) {
sc_bool is_running, status;
/*
@@ -1817,16 +1786,14 @@ run_restore_common(sc_gameref_t game,
return status;
}
-sc_bool
-run_restore(sc_gameref_t game, sc_read_callbackref_t callback, void *opaque) {
+sc_bool run_restore(sc_gameref_t game, sc_read_callbackref_t callback, void *opaque) {
assert(gs_is_game_valid(game));
assert(callback);
return run_restore_common(game, callback, opaque);
}
-sc_bool
-run_restore_prompted(sc_gameref_t game) {
+sc_bool run_restore_prompted(sc_gameref_t game) {
assert(gs_is_game_valid(game));
return run_restore_common(game, NULL, NULL);
@@ -1839,8 +1806,7 @@ run_restore_prompted(sc_gameref_t game) {
* Undo a turn in either a running or a stopped game. Returns TRUE on
* successful undo, FALSE if no undo buffer is available.
*/
-sc_bool
-run_undo(sc_gameref_t game) {
+sc_bool run_undo(sc_gameref_t game) {
const sc_memo_setref_t memento = gs_get_memento(game);
sc_bool is_running;
assert(gs_is_game_valid(game));
@@ -1896,8 +1862,7 @@ run_undo(sc_gameref_t game) {
*
* Query the game running state.
*/
-sc_bool
-run_is_running(sc_gameref_t game) {
+sc_bool run_is_running(sc_gameref_t game) {
assert(gs_is_game_valid(game));
return game->is_running;
@@ -1910,8 +1875,7 @@ run_is_running(sc_gameref_t game) {
* Query the game completion state. Completed games cannot be resumed,
* since they've run the exit task and thus have nowhere to go.
*/
-sc_bool
-run_has_completed(sc_gameref_t game) {
+sc_bool run_has_completed(sc_gameref_t game) {
assert(gs_is_game_valid(game));
return game->has_completed;
@@ -1923,8 +1887,7 @@ run_has_completed(sc_gameref_t game) {
*
* Query the game turn undo buffer and memo availability.
*/
-sc_bool
-run_is_undo_available(sc_gameref_t game) {
+sc_bool run_is_undo_available(sc_gameref_t game) {
const sc_memo_setref_t memento = gs_get_memento(game);
assert(gs_is_game_valid(game));
@@ -1938,15 +1901,10 @@ run_is_undo_available(sc_gameref_t game) {
*
* Get and set selected game attributes.
*/
-void
-run_get_attributes(sc_gameref_t game,
- const sc_char **game_name, const sc_char **game_author,
- const sc_char **game_compile_date,
- sc_int *turns, sc_int *score, sc_int *max_score,
- const sc_char **current_room_name,
- const sc_char **status_line, const sc_char **preferred_font,
- sc_bool *bold_room_names, sc_bool *verbose,
- sc_bool *notify_score_change) {
+void run_get_attributes(sc_gameref_t game, const sc_char **game_name, const sc_char **game_author,
+ const sc_char **game_compile_date, sc_int *turns, sc_int *score, sc_int *max_score,
+ const sc_char **current_room_name, const sc_char **status_line, const sc_char **preferred_font,
+ sc_bool *bold_room_names, sc_bool *verbose, sc_bool *notify_score_change) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_vartype_t vt_key[2];
@@ -2022,10 +1980,8 @@ run_get_attributes(sc_gameref_t game,
*notify_score_change = game->notify_score_change;
}
-void
-run_set_attributes(sc_gameref_t game,
- sc_bool bold_room_names, sc_bool verbose,
- sc_bool notify_score_change) {
+void run_set_attributes(sc_gameref_t game, sc_bool bold_room_names, sc_bool verbose,
+ sc_bool notify_score_change) {
assert(gs_is_game_valid(game));
/* Set game options. */
@@ -2044,8 +2000,7 @@ run_set_attributes(sc_gameref_t game,
* the token passed in and out is a pointer, and readily made opaque to
* the client as a void*.
*/
-sc_hintref_t
-run_hint_iterate(sc_gameref_t game, sc_hintref_t hint) {
+sc_hintref_t run_hint_iterate(sc_gameref_t game, sc_hintref_t hint) {
sc_int task;
assert(gs_is_game_valid(game));
@@ -2091,9 +2046,8 @@ run_hint_iterate(sc_gameref_t game, sc_hintref_t hint) {
*
* Hint strings are NULL if empty (not defined by the game).
*/
-static const sc_char *
-run_get_hint_common(sc_gameref_t game, sc_hintref_t hint,
- const sc_char * (*handler)(sc_gameref_t, sc_int)) {
+static const sc_char *run_get_hint_common(sc_gameref_t game, sc_hintref_t hint,
+ const sc_char * (*handler)(sc_gameref_t, sc_int)) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
sc_int task;
@@ -2129,18 +2083,15 @@ run_get_hint_common(sc_gameref_t game, sc_hintref_t hint,
return game->hint_text;
}
-const sc_char *
-run_get_hint_question(sc_gameref_t game, sc_hintref_t hint) {
+const sc_char *run_get_hint_question(sc_gameref_t game, sc_hintref_t hint) {
return run_get_hint_common(game, hint, task_get_hint_question);
}
-const sc_char *
-run_get_subtle_hint(sc_gameref_t game, sc_hintref_t hint) {
+const sc_char *run_get_subtle_hint(sc_gameref_t game, sc_hintref_t hint) {
return run_get_hint_common(game, hint, task_get_hint_subtle);
}
-const sc_char *
-run_get_unsubtle_hint(sc_gameref_t game, sc_hintref_t hint) {
+const sc_char *run_get_unsubtle_hint(sc_gameref_t game, sc_hintref_t hint) {
return run_get_hint_common(game, hint, task_get_hint_unsubtle);
}
diff --git a/engines/glk/adrift/scserial.cpp b/engines/glk/adrift/scserial.cpp
index 9c41db25b4..f0693477d1 100644
--- a/engines/glk/adrift/scserial.cpp
+++ b/engines/glk/adrift/scserial.cpp
@@ -177,8 +177,7 @@ static void ser_flush(sc_bool is_final) {
#endif
}
-static void
-ser_buffer_character(sc_char character) {
+static void ser_buffer_character(sc_char character) {
/* Allocate the buffer if not yet done. */
if (!ser_buffer) {
assert(ser_buffer_length == 0);
@@ -202,8 +201,7 @@ ser_buffer_character(sc_char character) {
*
* Buffer a buffer, a string, an unsigned and signed integer, and a boolean.
*/
-static void
-ser_buffer_buffer(const sc_char *buffer, sc_int length) {
+static void ser_buffer_buffer(const sc_char *buffer, sc_int length) {
sc_int index_;
/* Add each character to the buffer. */
@@ -211,16 +209,14 @@ ser_buffer_buffer(const sc_char *buffer, sc_int length) {
ser_buffer_character(buffer[index_]);
}
-static void
-ser_buffer_string(const sc_char *string) {
+static void ser_buffer_string(const sc_char *string) {
/* Buffer string, followed by DOS style end-of-line. */
ser_buffer_buffer(string, strlen(string));
ser_buffer_character(CARRIAGE_RETURN);
ser_buffer_character(NEWLINE);
}
-static void
-ser_buffer_int(sc_int value) {
+static void ser_buffer_int(sc_int value) {
sc_char buffer[32];
/* Convert to a string and buffer that. */
@@ -228,8 +224,7 @@ ser_buffer_int(sc_int value) {
ser_buffer_string(buffer);
}
-static void
-ser_buffer_int_special(sc_int value) {
+static void ser_buffer_int_special(sc_int value) {
sc_char buffer[32];
/* Weirdo formatting for compatibility. */
@@ -237,8 +232,7 @@ ser_buffer_int_special(sc_int value) {
ser_buffer_string(buffer);
}
-static void
-ser_buffer_uint(sc_uint value) {
+static void ser_buffer_uint(sc_uint value) {
sc_char buffer[32];
/* Convert to a string and buffer that. */
@@ -246,8 +240,7 @@ ser_buffer_uint(sc_uint value) {
ser_buffer_string(buffer);
}
-static void
-ser_buffer_boolean(sc_bool boolean) {
+static void ser_buffer_boolean(sc_bool boolean) {
/* Write a 1 for TRUE, 0 for FALSE. */
ser_buffer_string(boolean ? "1" : "0");
}
@@ -258,9 +251,7 @@ ser_buffer_boolean(sc_bool boolean) {
*
* Serialize a game and save its state using the given callback and opaque.
*/
-void
-ser_save_game(sc_gameref_t game,
- sc_write_callbackref_t callback, void *opaque) {
+void ser_save_game(sc_gameref_t game, sc_write_callbackref_t callback, void *opaque) {
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -418,8 +409,7 @@ ser_save_game(sc_gameref_t game,
* Serialize a game and save its state, requesting a save stream from
* the user.
*/
-sc_bool
-ser_save_game_prompted(sc_gameref_t game) {
+sc_bool ser_save_game_prompted(sc_gameref_t game) {
void *opaque;
/*
@@ -453,8 +443,7 @@ static jmp_buf ser_tas_error;
* Wrapper round obtaining the next TAS file line, with variants to convert
* the line content into an appropriate type.
*/
-static const sc_char *
-ser_get_string(void) {
+static const sc_char *ser_get_string(void) {
const sc_char *string;
/* Get the next line, and complain if absent. */
@@ -468,8 +457,7 @@ ser_get_string(void) {
return string;
}
-static sc_int
-ser_get_int(void) {
+static sc_int ser_get_int(void) {
const sc_char *string;
sc_int value;
@@ -484,8 +472,7 @@ ser_get_int(void) {
return value;
}
-static sc_uint
-ser_get_uint(void) {
+static sc_uint ser_get_uint(void) {
const sc_char *string;
sc_uint value;
@@ -500,8 +487,7 @@ ser_get_uint(void) {
return value;
}
-static sc_bool
-ser_get_boolean(void) {
+static sc_bool ser_get_boolean(void) {
const sc_char *string;
sc_uint value;
@@ -530,9 +516,7 @@ ser_get_boolean(void) {
* Load a serialized game into the given game by repeated calls to the
* callback() function.
*/
-sc_bool
-ser_load_game(sc_gameref_t game,
- sc_read_callbackref_t callback, void *opaque) {
+sc_bool ser_load_game(sc_gameref_t game, sc_read_callbackref_t callback, void *opaque) {
static sc_var_setref_t new_vars; /* For setjmp safety */
static sc_gameref_t new_game; /* For setjmp safety */
@@ -753,8 +737,7 @@ ser_load_game(sc_gameref_t game,
* Load a serialized game into the given game, requesting a restore
* stream from the user.
*/
-sc_bool
-ser_load_game_prompted(sc_gameref_t game) {
+sc_bool ser_load_game_prompted(sc_gameref_t game) {
void *opaque;
/*
diff --git a/engines/glk/adrift/sctaffil.cpp b/engines/glk/adrift/sctaffil.cpp
index f365a7fa46..4bee7694d0 100644
--- a/engines/glk/adrift/sctaffil.cpp
+++ b/engines/glk/adrift/sctaffil.cpp
@@ -94,7 +94,7 @@ struct sc_slabdesc_t {
sc_int size;
};
typedef sc_slabdesc_t *sc_slabdescref_t;
-typedef struct sc_taf_s {
+struct sc_taf_s {
sc_uint magic;
sc_byte header[VERSION_HEADER_SIZE + V400_HEADER_EXTRA];
sc_int version;
@@ -105,7 +105,8 @@ typedef struct sc_taf_s {
sc_bool is_unterminated;
sc_int current_slab;
sc_int current_offset;
-} sc_taf_t;
+};
+typedef sc_taf_s sc_taf_t;
/* Microsoft Visual Basic PRNG magic numbers, initial and current state. */
@@ -125,15 +126,13 @@ static sc_int taf_random_state = 0x00a09e86;
* we multiply by 255 and then divide by prng_cst3 + 1 to get output in the
* range 0..254. Thanks to Rik Snel for uncovering this obfuscation.
*/
-static sc_byte
-taf_random(void) {
+static sc_byte taf_random(void) {
/* Generate and return the next pseudo-random number. */
taf_random_state = (taf_random_state * PRNG_CST1 + PRNG_CST2) & PRNG_CST3;
return (UCHAR_MAX * (sc_uint) taf_random_state) / (sc_uint)(PRNG_CST3 + 1);
}
-static void
-taf_random_reset(void) {
+static void taf_random_reset(void) {
/* Reset PRNG to initial conditions. */
taf_random_state = PRNG_INITIAL_STATE;
}
@@ -144,8 +143,7 @@ taf_random_reset(void) {
*
* Return TRUE if pointer is a valid TAF structure, FALSE otherwise.
*/
-static sc_bool
-taf_is_valid(sc_tafref_t taf) {
+static sc_bool taf_is_valid(sc_tafref_t taf) {
return taf && taf->magic == TAF_MAGIC;
}
@@ -155,8 +153,7 @@ taf_is_valid(sc_tafref_t taf) {
*
* Allocate and return a new, empty TAF structure.
*/
-static sc_tafref_t
-taf_create_empty(void) {
+static sc_tafref_t taf_create_empty(void) {
sc_tafref_t taf;
/* Create an empty TAF structure. */
@@ -182,8 +179,7 @@ taf_create_empty(void) {
*
* Free TAF memory, and destroy a TAF structure.
*/
-void
-taf_destroy(sc_tafref_t taf) {
+void taf_destroy(sc_tafref_t taf) {
sc_int index_;
assert(taf_is_valid(taf));
@@ -207,8 +203,7 @@ taf_destroy(sc_tafref_t taf) {
* Insert nul's into slab data so that it turns into a series of nul-terminated
* strings. Nul's are used to replace carriage return and newline pairs.
*/
-static void
-taf_finalize_last_slab(sc_tafref_t taf) {
+static void taf_finalize_last_slab(sc_tafref_t taf) {
sc_slabdescref_t slab;
sc_int index_;
@@ -244,9 +239,7 @@ taf_finalize_last_slab(sc_tafref_t taf) {
* line feed. If none, found, return length and set is_unterminated to TRUE.
* Otherwise, return the count of usable bytes found in the buffer.
*/
-static sc_int
-taf_find_buffer_extent(const sc_byte *buffer,
- sc_int length, sc_bool *is_unterminated) {
+static sc_int taf_find_buffer_extent(const sc_byte *buffer, sc_int length, sc_bool *is_unterminated) {
sc_int bytes;
/* Search backwards from the buffer end for the final line feed. */
@@ -271,8 +264,7 @@ taf_find_buffer_extent(const sc_byte *buffer,
* Append a buffer of TAF lines to an existing TAF structure. Returns the
* number of characters consumed from the buffer.
*/
-static sc_int
-taf_append_buffer(sc_tafref_t taf, const sc_byte *buffer, sc_int length) {
+static sc_int taf_append_buffer(sc_tafref_t taf, const sc_byte *buffer, sc_int length) {
sc_int bytes;
sc_bool is_unterminated;
@@ -347,9 +339,8 @@ taf_append_buffer(sc_tafref_t taf, const sc_byte *buffer, sc_int length) {
* count of bytes placed in the buffer, or 0 if no more (end of file).
* Assumes that the file has been read past the header.
*/
-static sc_bool
-taf_unobfuscate(sc_tafref_t taf, sc_read_callbackref_t callback,
- void *opaque, sc_bool is_gamefile) {
+static sc_bool taf_unobfuscate(sc_tafref_t taf, sc_read_callbackref_t callback,
+ void *opaque, sc_bool is_gamefile) {
sc_byte *buffer;
sc_int bytes, used_bytes, total_bytes, index_;
@@ -427,7 +418,7 @@ taf_unobfuscate(sc_tafref_t taf, sc_read_callbackref_t callback,
* Decompress a version 4.0 TAF
*/
static sc_bool taf_decompress(sc_tafref_t taf, sc_read_callbackref_t callback,
- void *opaque, sc_bool is_gamefile) {
+ void *opaque, sc_bool is_gamefile) {
#if USE_ZLIB
Common::SeekableReadStream *src = (Common::SeekableReadStream *)opaque;
assert(src);
@@ -462,9 +453,8 @@ static sc_bool taf_decompress(sc_tafref_t taf, sc_read_callbackref_t callback,
* callback() function. Callback() should return the count of bytes placed
* in the buffer, or 0 if no more (end of file).
*/
-static sc_tafref_t
-taf_create_from_callback(sc_read_callbackref_t callback,
- void *opaque, sc_bool is_gamefile) {
+static sc_tafref_t taf_create_from_callback(sc_read_callbackref_t callback,
+ void *opaque, sc_bool is_gamefile) {
sc_tafref_t taf;
sc_bool status = FALSE;
assert(callback);
@@ -555,13 +545,11 @@ taf_create_from_callback(sc_read_callbackref_t callback,
* Public entry points for taf_create_from_callback(). Return a taf object
* constructed from either *.TAF (game) or *.TAS (saved game state) file data.
*/
-sc_tafref_t
-taf_create(sc_read_callbackref_t callback, void *opaque) {
+sc_tafref_t taf_create(sc_read_callbackref_t callback, void *opaque) {
return taf_create_from_callback(callback, opaque, TRUE);
}
-sc_tafref_t
-taf_create_tas(sc_read_callbackref_t callback, void *opaque) {
+sc_tafref_t taf_create_tas(sc_read_callbackref_t callback, void *opaque) {
return taf_create_from_callback(callback, opaque, FALSE);
}
@@ -571,8 +559,7 @@ taf_create_tas(sc_read_callbackref_t callback, void *opaque) {
*
* Iterator rewind function, reset current slab location to TAF data start.
*/
-void
-taf_first_line(sc_tafref_t taf) {
+void taf_first_line(sc_tafref_t taf) {
assert(taf_is_valid(taf));
/* Set current locations to TAF start. */
@@ -587,8 +574,7 @@ taf_first_line(sc_tafref_t taf) {
* Iterator function, return the next line of data from a TAF, or NULL
* if no more lines.
*/
-const sc_char *
-taf_next_line(sc_tafref_t taf) {
+const sc_char *taf_next_line(sc_tafref_t taf) {
assert(taf_is_valid(taf));
/* If there is a next line, return it and advance current. */
@@ -622,8 +608,7 @@ taf_next_line(sc_tafref_t taf) {
*
* Iterator end function, returns TRUE if more TAF lines are readable.
*/
-sc_bool
-taf_more_lines(sc_tafref_t taf) {
+sc_bool taf_more_lines(sc_tafref_t taf) {
assert(taf_is_valid(taf));
/* Return TRUE if not at TAF data end. */
@@ -638,8 +623,7 @@ taf_more_lines(sc_tafref_t taf) {
* appended to the TAF file after the game, so this value allows them to
* be located.
*/
-sc_int
-taf_get_game_data_length(sc_tafref_t taf) {
+sc_int taf_get_game_data_length(sc_tafref_t taf) {
assert(taf_is_valid(taf));
/*
@@ -656,8 +640,7 @@ taf_get_game_data_length(sc_tafref_t taf) {
*
* Return the version number of the TAF file, 400, 390, or 380.
*/
-sc_int
-taf_get_version(sc_tafref_t taf) {
+sc_int taf_get_version(sc_tafref_t taf) {
assert(taf_is_valid(taf));
assert(taf->version != TAF_VERSION_NONE);
@@ -673,8 +656,7 @@ taf_get_version(sc_tafref_t taf) {
* properties debugging, indicating if a given address is a string in a TAF
* slab, and therefore safe to print.
*/
-sc_bool
-taf_debug_is_taf_string(sc_tafref_t taf, const void *addr) {
+sc_bool taf_debug_is_taf_string(sc_tafref_t taf, const void *addr) {
const sc_byte *const addr_ = (const sc_byte * const)addr;
sc_int index_;
@@ -691,8 +673,7 @@ taf_debug_is_taf_string(sc_tafref_t taf, const void *addr) {
return FALSE;
}
-void
-taf_debug_dump(sc_tafref_t taf) {
+void taf_debug_dump(sc_tafref_t taf) {
sc_int index_, current_slab, current_offset;
assert(taf_is_valid(taf));
diff --git a/engines/glk/adrift/sctafpar.cpp b/engines/glk/adrift/sctafpar.cpp
index 9880603faf..6c2dcda2ae 100644
--- a/engines/glk/adrift/sctafpar.cpp
+++ b/engines/glk/adrift/sctafpar.cpp
@@ -71,10 +71,10 @@ static const sc_byte V380_SEPARATOR[SEPARATOR_SIZE] = {0x2a, 0x2a, 0x00};
* |...| - fixup specials for versions < 4
* {special} - because some things just defy description
*/
-typedef struct {
+struct sc_parse_schema_t {
const sc_char *const class_name;
const sc_char *const descriptor;
-} sc_parse_schema_t;
+};
/* Version 4.0 TAF file properties descriptor table. */
static const sc_parse_schema_t V400_PARSE_SCHEMA[] = {
@@ -455,8 +455,7 @@ static const sc_parse_schema_t V380_PARSE_SCHEMA[] = {
*
* Select one of the parse schemata based on a TAF file.
*/
-static const sc_parse_schema_t *
-parse_select_schema(sc_tafref_t taf) {
+static const sc_parse_schema_t *parse_select_schema(sc_tafref_t taf) {
/* Switch based on the TAF file version. */
switch (taf_get_version(taf)) {
case TAF_VERSION_400:
@@ -499,8 +498,7 @@ static sc_int parse_depth = 0;
* Push a key of the given type onto the property key stack, and pop a key
* off on unwind.
*/
-static void
-parse_push_key(sc_vartype_t vt_key, sc_char type) {
+static void parse_push_key(sc_vartype_t vt_key, sc_char type) {
if (parse_depth == PARSE_MAX_DEPTH)
sc_fatal("parse_push_key: stack overrun\n");
@@ -510,8 +508,7 @@ parse_push_key(sc_vartype_t vt_key, sc_char type) {
parse_depth++;
}
-static void
-parse_pop_key(void) {
+static void parse_pop_key(void) {
/* Check the stack has something to pop, then pop it. */
if (parse_depth == 0)
sc_fatal("parse_pop_key: stack underrun\n");
@@ -526,8 +523,7 @@ parse_pop_key(void) {
* index. An expedient fix is to switch i-s keys before storing a property
* value
*/
-static void
-parse_retrieve_stack(sc_char format[], sc_vartype_t vt_key[], sc_int *depth) {
+static void parse_retrieve_stack(sc_char format[], sc_vartype_t vt_key[], sc_int *depth) {
sc_int index_;
/* Switch index-string key pairs. */
@@ -560,8 +556,7 @@ parse_retrieve_stack(sc_char format[], sc_vartype_t vt_key[], sc_int *depth) {
* Dump the parse stack. Used for diagnostics on finding what we think may
* be a bad game.
*/
-static void
-parse_stack_backtrace(void) {
+static void parse_stack_backtrace(void) {
sc_vartype_t vt_key[PARSE_MAX_DEPTH];
sc_char format[PARSE_MAX_DEPTH];
sc_int depth, index_;
@@ -595,8 +590,7 @@ parse_stack_backtrace(void) {
*
* Write or read a property based on the keys amassed so far.
*/
-static void
-parse_put_property(sc_vartype_t vt_value, sc_char type) {
+static void parse_put_property(sc_vartype_t vt_value, sc_char type) {
sc_vartype_t vt_key[PARSE_MAX_DEPTH];
sc_char format[PARSE_MAX_DEPTH + 4];
sc_int depth;
@@ -615,8 +609,7 @@ parse_put_property(sc_vartype_t vt_value, sc_char type) {
prop_put(parse_bundle, format, vt_value, vt_key);
}
-static sc_bool
-parse_get_property(sc_vartype_t *vt_rvalue, sc_char type) {
+static sc_bool parse_get_property(sc_vartype_t *vt_rvalue, sc_char type) {
sc_vartype_t vt_key[PARSE_MAX_DEPTH];
sc_char format[PARSE_MAX_DEPTH + 4];
sc_int depth;
@@ -646,8 +639,7 @@ parse_get_property(sc_vartype_t *vt_rvalue, sc_char type) {
* indicating the child count of the effectively stacked node, or zero if
* no such node exists.
*/
-static sc_int
-parse_get_child_count(void) {
+static sc_int parse_get_child_count(void) {
sc_vartype_t vt_rvalue;
if (!parse_get_property(&vt_rvalue, PROP_INTEGER))
@@ -665,8 +657,7 @@ parse_get_child_count(void) {
* Convenience forms of parse_get_property(), retrieve directly, and report
* a fatal error if the property does not exist.
*/
-static sc_int
-parse_get_integer_property(void) {
+static sc_int parse_get_integer_property(void) {
sc_vartype_t vt_rvalue;
if (!parse_get_property(&vt_rvalue, PROP_INTEGER))
@@ -675,8 +666,7 @@ parse_get_integer_property(void) {
return vt_rvalue.integer;
}
-static sc_bool
-parse_get_boolean_property(void) {
+static sc_bool parse_get_boolean_property(void) {
sc_vartype_t vt_rvalue;
if (!parse_get_property(&vt_rvalue, PROP_BOOLEAN))
@@ -685,8 +675,7 @@ parse_get_boolean_property(void) {
return vt_rvalue.boolean;
}
-static const sc_char *
-parse_get_string_property(void) {
+static const sc_char *parse_get_string_property(void) {
sc_vartype_t vt_rvalue;
if (!parse_get_property(&vt_rvalue, PROP_STRING))
@@ -713,8 +702,7 @@ static sc_bool parse_use_pushback = FALSE;
* the line content into an integer or boolean, and a function for effective
* TAF line pushback.
*/
-static const sc_char *
-parse_get_taf_string(void) {
+static const sc_char *parse_get_taf_string(void) {
const sc_char *line;
/* If pushback requested, use that instead of reading. */
@@ -745,8 +733,7 @@ parse_get_taf_string(void) {
return line;
}
-static sc_int
-parse_get_taf_integer(void) {
+static sc_int parse_get_taf_integer(void) {
const sc_char *line;
sc_int integer;
@@ -762,8 +749,7 @@ parse_get_taf_integer(void) {
return integer;
}
-static sc_bool
-parse_get_taf_boolean(void) {
+static sc_bool parse_get_taf_boolean(void) {
const sc_char *line;
sc_uint boolean;
@@ -786,8 +772,7 @@ parse_get_taf_boolean(void) {
return boolean != 0;
}
-static void
-parse_taf_pushback(void) {
+static void parse_taf_pushback(void) {
if (parse_use_pushback || !parse_pushback_line)
sc_fatal("parse_taf_pushback: too much pushback requested\n");
@@ -835,8 +820,7 @@ static void parse_descriptor(const sc_char *descriptor);
*
* Parse a descriptor [] array.
*/
-static void
-parse_array(const sc_char *array) {
+static void parse_array(const sc_char *array) {
sc_int count, index_;
sc_char element[PARSE_TEMP_LENGTH];
@@ -871,8 +855,7 @@ parse_array(const sc_char *array) {
*
* Parse a variable-length vector of properties.
*/
-static void
-parse_vector_common(const sc_char *vector, sc_int count) {
+static void parse_vector_common(const sc_char *vector, sc_int count) {
sc_int index_;
/* Parse the vector property count times, pushing a key on each. */
@@ -888,8 +871,7 @@ parse_vector_common(const sc_char *vector, sc_int count) {
}
}
-static void
-parse_vector(const sc_char *vector) {
+static void parse_vector(const sc_char *vector) {
sc_int count;
if (parse_trace)
@@ -903,8 +885,7 @@ parse_vector(const sc_char *vector) {
sc_trace("Parse: leaving vector %s\n", vector);
}
-static void
-parse_vector_alternate(const sc_char *vector) {
+static void parse_vector_alternate(const sc_char *vector) {
sc_int count;
if (parse_trace)
@@ -925,8 +906,7 @@ parse_vector_alternate(const sc_char *vector) {
*
* Parse a conditional field definition, with runtime test.
*/
-static sc_bool
-parse_test_expression(const sc_char *test_expression) {
+static sc_bool parse_test_expression(const sc_char *test_expression) {
sc_vartype_t vt_key;
sc_char plhs[PARSE_TEMP_LENGTH];
sc_int rhs;
@@ -985,8 +965,7 @@ parse_test_expression(const sc_char *test_expression) {
return retval;
}
-static void
-parse_expression(const sc_char *expression) {
+static void parse_expression(const sc_char *expression) {
sc_char test_expression[PARSE_TEMP_LENGTH];
sc_bool is_present;
@@ -1034,8 +1013,7 @@ parse_expression(const sc_char *expression) {
* Helper for parse_terminal(), reads in a multiline string. The return
* string is malloc'ed, and the caller needs to handle that.
*/
-static sc_char *
-parse_read_multiline(void) {
+static sc_char *parse_read_multiline(void) {
const sc_byte *separator = NULL;
const sc_char *line;
sc_char *multiline;
@@ -1080,8 +1058,7 @@ parse_read_multiline(void) {
*
* Common handler for string, integer, boolean, and multiline parse terminals.
*/
-static void
-parse_terminal(const sc_char *terminal) {
+static void parse_terminal(const sc_char *terminal) {
sc_vartype_t vt_key, vt_value;
if (parse_trace)
@@ -1157,12 +1134,12 @@ parse_terminal(const sc_char *terminal) {
* for the various sound and graphic resources encountered on parsing
* version 4.0 games. It's unused if the version is not 4.0.
*/
-typedef struct {
+struct sc_parse_resource_t {
sc_char *name;
sc_uint hash;
sc_int length;
sc_int offset;
-} sc_parse_resource_t;
+};
enum { RESOURCE_GROW_INCREMENT = 32 };
static sc_int parse_resources_length = 0;
@@ -1175,8 +1152,7 @@ static sc_parse_resource_t *parse_resources = NULL;
*
* Free and clear down the version 4.0 resources table.
*/
-static void
-parse_clear_v400_resources_table(void) {
+static void parse_clear_v400_resources_table(void) {
/* Free allocated memory and return to initial values. */
if (parse_resources) {
sc_int index_;
@@ -1205,9 +1181,8 @@ parse_clear_v400_resources_table(void) {
* lengths; this function needs to handle that. The caller needs to compare
* length with real_length to see if that happened.
*/
-static sc_int
-parse_get_v400_resource_offset(const sc_char *name,
- sc_int length, sc_int *real_length) {
+static sc_int parse_get_v400_resource_offset(const sc_char *name,
+ sc_int length, sc_int *real_length) {
sc_char *clean_name;
sc_uint hash;
sc_int index_, offset;
@@ -1290,8 +1265,7 @@ parse_get_v400_resource_offset(const sc_char *name,
* 'resource number'; -(length+2) is tantalizingly close to the index into
* our parse_resources table, but not always...
*/
-static void
-parse_handle_v400_resources(sc_bool has_sound, sc_bool has_graphics) {
+static void parse_handle_v400_resources(sc_bool has_sound, sc_bool has_graphics) {
sc_vartype_t vt_key, vt_value;
const sc_char *file;
sc_int length, offset;
@@ -1391,8 +1365,7 @@ parse_handle_v400_resources(sc_bool has_sound, sc_bool has_graphics) {
* Handler for special items that can't be described accurately, and
* therefore need careful treatment.
*/
-static void
-parse_special(const sc_char *special) {
+static void parse_special(const sc_char *special) {
if (parse_trace)
sc_trace("Parse: entering special %s\n", special);
@@ -1617,14 +1590,9 @@ parse_special(const sc_char *special) {
* Helper for parse_fixup_v390_v380_room_alts(). Handles creation of
* version 4.0 room alts for version 3.9 and version 3.8 games.
*/
-static void
-parse_fixup_v390_v380_room_alt(const sc_char *m1, sc_int type,
- const sc_char *resource1,
- const sc_char *m2, sc_int var2,
- const sc_char *resource2,
- sc_int hide_objects,
- const sc_char *changed,
- sc_int var3, sc_int display_room) {
+static void parse_fixup_v390_v380_room_alt(const sc_char *m1, sc_int type,
+ const sc_char *resource1, const sc_char *m2, sc_int var2, const sc_char *resource2,
+ sc_int hide_objects, const sc_char *changed, sc_int var3, sc_int display_room) {
sc_vartype_t vt_key, vt_value, vt_gkey[2];
sc_bool has_sound, has_graphics;
sc_int alt_count;
@@ -1830,8 +1798,7 @@ enum { V390_V380_ALT_TYPEHIDE_MULT = 10 };
* converts version 3.9 and version 3.8 fixed room description alts into
* an equivalent array of version 4.0 style room alts.
*/
-static void
-parse_fixup_v390_v380_room_alts(void) {
+static void parse_fixup_v390_v380_room_alts(void) {
sc_vartype_t vt_key;
const sc_char *m1, *m2, *changed;
sc_int type, var2, hide_objects, var3, display_room;
@@ -1956,8 +1923,7 @@ parse_fixup_v390_v380_room_alts(void) {
* Handler for fixup special items to help with conversions from TAF version
* 3.9 format into version 4.0.
*/
-static void
-parse_fixup_v390(const sc_char *fixup) {
+static void parse_fixup_v390(const sc_char *fixup) {
if (parse_trace)
sc_trace("Parse: entering version 3.9 fixup %s\n", fixup);
@@ -2106,9 +2072,8 @@ enum { V380_TASK_MOVEMENTS = 6 };
*
* Helper for parse_fixup_v380(), adds a task action.
*/
-static void
-parse_fixup_v380_action(sc_int type, sc_int var_count,
- sc_int var1, sc_int var2, sc_int var3) {
+static void parse_fixup_v380_action(sc_int type, sc_int var_count,
+ sc_int var1, sc_int var2, sc_int var3) {
sc_vartype_t vt_key, vt_value;
sc_int action_count;
@@ -2163,8 +2128,7 @@ parse_fixup_v380_action(sc_int type, sc_int var_count,
*
* Helper for parse_fixup_v380(), converts a task movement into an action.
*/
-static void
-parse_fixup_v380_movement(sc_int mvar1, sc_int mvar2, sc_int mvar3) {
+static void parse_fixup_v380_movement(sc_int mvar1, sc_int mvar2, sc_int mvar3) {
sc_int var1;
/* If nothing was selected to move, ignore the call. */
@@ -2245,10 +2209,8 @@ parse_fixup_v380_movement(sc_int mvar1, sc_int mvar2, sc_int mvar3) {
*
* Helper for parse_fixup_v380(), adds a task restriction.
*/
-static void
-parse_fixup_v380_restr(sc_int type, sc_int var_count,
- sc_int var1, sc_int var2, sc_int var3,
- const sc_char *failmessage) {
+static void parse_fixup_v380_restr(sc_int type, sc_int var_count,
+ sc_int var1, sc_int var2, sc_int var3, const sc_char *failmessage) {
sc_vartype_t vt_key, vt_value;
sc_int restriction_count;
@@ -2314,9 +2276,7 @@ parse_fixup_v380_restr(sc_int type, sc_int var_count,
*
* Helper handlers for parse_fixup_v380(); create task restrictions.
*/
-static void
-parse_fixup_v380_obj_restr(sc_bool holding,
- sc_int holdobj, const sc_char *failmessage) {
+static void parse_fixup_v380_obj_restr(sc_bool holding, sc_int holdobj, const sc_char *failmessage) {
/* Ignore if no object selected. */
if (holdobj > 0) {
sc_int var1, var2;
@@ -2332,9 +2292,7 @@ parse_fixup_v380_obj_restr(sc_bool holding,
}
}
-static void
-parse_fixup_v380_task_restr(sc_bool tasknotdone, sc_int task,
- const sc_char *failmessage) {
+static void parse_fixup_v380_task_restr(sc_bool tasknotdone, sc_int task, const sc_char *failmessage) {
/* Ignore if no task selected. */
if (task > 0) {
sc_int var2;
@@ -2345,8 +2303,7 @@ parse_fixup_v380_task_restr(sc_bool tasknotdone, sc_int task,
}
}
-static void
-parse_fixup_v380_wear_restr(sc_int wearobj, const sc_char *failmessage) {
+static void parse_fixup_v380_wear_restr(sc_int wearobj, const sc_char *failmessage) {
/* Ignore if no object selected. */
if (wearobj > 0) {
sc_vartype_t vt_key[3];
@@ -2403,9 +2360,8 @@ parse_fixup_v380_wear_restr(sc_int wearobj, const sc_char *failmessage) {
}
}
-static void
-parse_fixup_v380_npc_restr(sc_bool notinsameroom, sc_int npc,
- const sc_char *failmessage) {
+static void parse_fixup_v380_npc_restr(sc_bool notinsameroom, sc_int npc,
+ const sc_char *failmessage) {
/* Ignore if no NPC selected. */
if (npc > 0) {
sc_int var2;
@@ -2423,9 +2379,7 @@ parse_fixup_v380_npc_restr(sc_bool notinsameroom, sc_int npc,
}
}
-static void
-parse_fixup_v380_objroom_restr(sc_int obj, sc_int objroom,
- const sc_char *failmessage) {
+static void parse_fixup_v380_objroom_restr(sc_int obj, sc_int objroom, const sc_char *failmessage) {
/* Ignore if no object selected. */
if (obj > 0) {
/* Create version 4.0 restriction to check object in room. */
@@ -2433,9 +2387,8 @@ parse_fixup_v380_objroom_restr(sc_int obj, sc_int objroom,
}
}
-static void
-parse_fixup_v380_objstate_restr(sc_int obj, sc_int ivar1, sc_int ivar2,
- const sc_char *failmessage) {
+static void parse_fixup_v380_objstate_restr(sc_int obj, sc_int ivar1, sc_int ivar2,
+ const sc_char *failmessage) {
sc_vartype_t vt_key[3];
sc_int object, dynamic, var2, var3;
@@ -2519,8 +2472,7 @@ parse_fixup_v380_objstate_restr(sc_int obj, sc_int ivar1, sc_int ivar2,
* Handler for fixup special items to help with conversions from TAF version
* 3.8 format into version 4.0.
*/
-static void
-parse_fixup_v380(const sc_char *fixup) {
+static void parse_fixup_v380(const sc_char *fixup) {
if (parse_trace)
sc_trace("Parse: entering version 3.8 fixup %s\n", fixup);
@@ -3012,8 +2964,7 @@ parse_fixup_v380(const sc_char *fixup) {
* Handler for fixup special items to help with conversions from TAF version
* 3.9 and version 3.8 formats into version 4.0.
*/
-static void
-parse_fixup(const sc_char *fixup) {
+static void parse_fixup(const sc_char *fixup) {
/*
* Pick a fixup handler specific to the TAF version. This helps keep
* fixup code separate, rather than glommed into one large function.
@@ -3040,8 +2991,7 @@ parse_fixup(const sc_char *fixup) {
*
* Parse a class descriptor element.
*/
-static void
-parse_element(const sc_char *element) {
+static void parse_element(const sc_char *element) {
if (parse_trace)
sc_trace("Parse: entering element %s\n", element);
@@ -3096,8 +3046,7 @@ parse_element(const sc_char *element) {
*
* Parse a class's properties descriptor list.
*/
-static void
-parse_descriptor(const sc_char *descriptor) {
+static void parse_descriptor(const sc_char *descriptor) {
sc_int next;
/* Find and parse each element in the descriptor. */
@@ -3123,8 +3072,7 @@ parse_descriptor(const sc_char *descriptor) {
*
* Parse a class of properties.
*/
-static void
-parse_class(const sc_char *class_) {
+static void parse_class(const sc_char *class_) {
sc_char class_name[PARSE_TEMP_LENGTH];
sc_int index_;
sc_vartype_t vt_key;
@@ -3171,8 +3119,7 @@ parse_class(const sc_char *class_) {
* Add a list of all NPC walks started by each task. This is post-processing
* that occurs after the TAF file has been successfully parsed.
*/
-static void
-parse_add_walkalerts(sc_prop_setref_t bundle) {
+static void parse_add_walkalerts(sc_prop_setref_t bundle) {
sc_vartype_t vt_key[5];
sc_int npcs_count, npc;
@@ -3225,8 +3172,7 @@ parse_add_walkalerts(sc_prop_setref_t bundle) {
* Add a list of move times to all NPC walks. This is post-processing that
* occurs after the TAF file has been successfully parsed.
*/
-static void
-parse_add_movetimes(sc_prop_setref_t bundle) {
+static void parse_add_movetimes(sc_prop_setref_t bundle) {
sc_vartype_t vt_key[6];
sc_int npcs_count, npc;
@@ -3280,8 +3226,7 @@ parse_add_movetimes(sc_prop_setref_t bundle) {
* Sort ALRs by original string length and store an indexer property, so
* that ALR replacements look at longer strings before shorter ones.
*/
-static void
-parse_add_alrs_index(sc_prop_setref_t bundle) {
+static void parse_add_alrs_index(sc_prop_setref_t bundle) {
sc_vartype_t vt_key[3];
sc_int alr_count, index_, alr;
sc_int *alr_lengths, longest, shortest, length;
@@ -3345,8 +3290,7 @@ parse_add_alrs_index(sc_prop_setref_t bundle) {
* for version 4.0 games. For version 3.9 and version 3.8 games, write
* zero; only version 4.0 games can embed their resources into the TAF file.
*/
-static void
-parse_add_resources_offset(sc_prop_setref_t bundle, sc_tafref_t taf) {
+static void parse_add_resources_offset(sc_prop_setref_t bundle, sc_tafref_t taf) {
sc_vartype_t vt_key[2], vt_value;
sc_bool embedded;
sc_int offset;
@@ -3373,8 +3317,7 @@ parse_add_resources_offset(sc_prop_setref_t bundle, sc_tafref_t taf) {
* Add the TAF version to the properties, both integer and character forms
* for convenience.
*/
-static void
-parse_add_version(sc_prop_setref_t bundle, sc_tafref_t taf) {
+static void parse_add_version(sc_prop_setref_t bundle, sc_tafref_t taf) {
sc_vartype_t vt_key, vt_value;
/* Add the version integer to the properties. */
@@ -3469,8 +3412,7 @@ sc_bool parse_game(sc_tafref_t taf, sc_prop_setref_t bundle) {
*
* Set parse tracing on/off.
*/
-void
-parse_debug_trace(sc_bool flag) {
+void parse_debug_trace(sc_bool flag) {
parse_trace = flag;
}
diff --git a/engines/glk/adrift/sctasks.cpp b/engines/glk/adrift/sctasks.cpp
index 8273affef6..cab6fcbb81 100644
--- a/engines/glk/adrift/sctasks.cpp
+++ b/engines/glk/adrift/sctasks.cpp
@@ -56,8 +56,7 @@ static sc_bool task_trace = FALSE;
* Return the assorted hint text strings, and TRUE if the given task offers
* hints.
*/
-static const sc_char *
-task_get_hint_common(sc_gameref_t game, sc_int task, const sc_char *hint) {
+static const sc_char *task_get_hint_common(sc_gameref_t game, sc_int task, const sc_char *hint) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
const sc_char *retval;
@@ -70,23 +69,19 @@ task_get_hint_common(sc_gameref_t game, sc_int task, const sc_char *hint) {
return retval;
}
-const sc_char *
-task_get_hint_question(sc_gameref_t game, sc_int task) {
+const sc_char *task_get_hint_question(sc_gameref_t game, sc_int task) {
return task_get_hint_common(game, task, "Question");
}
-const sc_char *
-task_get_hint_subtle(sc_gameref_t game, sc_int task) {
+const sc_char *task_get_hint_subtle(sc_gameref_t game, sc_int task) {
return task_get_hint_common(game, task, "Hint1");
}
-const sc_char *
-task_get_hint_unsubtle(sc_gameref_t game, sc_int task) {
+const sc_char *task_get_hint_unsubtle(sc_gameref_t game, sc_int task) {
return task_get_hint_common(game, task, "Hint2");
}
-sc_bool
-task_has_hints(sc_gameref_t game, sc_int task) {
+sc_bool task_has_hints(sc_gameref_t game, sc_int task) {
/* A non-empty question implies hints available. */
return !sc_strempty(task_get_hint_question(game, task));
}
@@ -98,9 +93,7 @@ task_has_hints(sc_gameref_t game, sc_int task) {
* Return TRUE if player is in a room where the task can be run and the task
* is runnable in the given direction.
*/
-sc_bool
-task_can_run_task_directional(sc_gameref_t game,
- sc_int task, sc_bool forwards) {
+sc_bool task_can_run_task_directional(sc_gameref_t game, sc_int task, sc_bool forwards) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int type;
@@ -169,8 +162,7 @@ task_can_run_task_directional(sc_gameref_t game,
*
* Returns TRUE if the task can be run in either direction.
*/
-sc_bool
-task_can_run_task(sc_gameref_t game, sc_int task) {
+sc_bool task_can_run_task(sc_gameref_t game, sc_int task) {
/*
* Testing reversible tasks first may be a little more efficient if they
* aren't common in games. There is, though, probably a little bit of
@@ -186,8 +178,7 @@ task_can_run_task(sc_gameref_t game, sc_int task) {
*
* Move an object to a place.
*/
-static void
-task_move_object(sc_gameref_t game, sc_int object, sc_int var2, sc_int var3) {
+static void task_move_object(sc_gameref_t game, sc_int object, sc_int var2, sc_int var3) {
const sc_var_setref_t vars = gs_get_vars(game);
/* Select action depending on var2. */
@@ -291,9 +282,7 @@ task_move_object(sc_gameref_t game, sc_int object, sc_int var2, sc_int var3) {
*
* Demultiplex an object move action and execute it.
*/
-static void
-task_run_move_object_action(sc_gameref_t game,
- sc_int var1, sc_int var2, sc_int var3) {
+static void task_run_move_object_action(sc_gameref_t game, sc_int var1, sc_int var2, sc_int var3) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_int object;
@@ -331,8 +320,7 @@ task_run_move_object_action(sc_gameref_t game,
*
* Move an NPC to a given room.
*/
-static void
-task_move_npc_to_room(sc_gameref_t game, sc_int npc, sc_int room) {
+static void task_move_npc_to_room(sc_gameref_t game, sc_int npc, sc_int room) {
if (task_trace)
sc_trace("Task: moving NPC %ld to room %ld\n", npc, room);
@@ -354,9 +342,7 @@ task_move_npc_to_room(sc_gameref_t game, sc_int npc, sc_int room) {
*
* Move player or NPC.
*/
-static void
-task_run_move_npc_action(sc_gameref_t game,
- sc_int var1, sc_int var2, sc_int var3) {
+static void task_run_move_npc_action(sc_gameref_t game, sc_int var1, sc_int var2, sc_int var3) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_int npc, room, ref_npc = -1;
@@ -506,8 +492,7 @@ task_run_move_npc_action(sc_gameref_t game,
*
* Change the status of an object.
*/
-static void
-task_run_change_object_status(sc_gameref_t game, sc_int var1, sc_int var2) {
+static void task_run_change_object_status(sc_gameref_t game, sc_int var1, sc_int var2) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
sc_int object, openable, lockable;
@@ -560,10 +545,8 @@ task_run_change_object_status(sc_gameref_t game, sc_int var1, sc_int var2) {
*
* Change a variable's value in inscrutable ways.
*/
-static void
-task_run_change_variable_action(sc_gameref_t game,
- sc_int var1, sc_int var2, sc_int var3,
- const sc_char *expr, sc_int var5) {
+static void task_run_change_variable_action(sc_gameref_t game,
+ sc_int var1, sc_int var2, sc_int var3, const sc_char *expr, sc_int var5) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
const sc_var_setref_t vars = gs_get_vars(game);
@@ -714,8 +697,7 @@ task_run_change_variable_action(sc_gameref_t game,
*
* Change game score.
*/
-static void
-task_run_change_score_action(sc_gameref_t game, sc_int task, sc_int var1) {
+static void task_run_change_score_action(sc_gameref_t game, sc_int task, sc_int var1) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
/* Increasing or decreasing the score? */
@@ -773,8 +755,7 @@ task_run_change_score_action(sc_gameref_t game, sc_int task, sc_int var1) {
*
* Redirect to another task.
*/
-static sc_bool
-task_run_set_task_action(sc_gameref_t game, sc_int var1, sc_int var2) {
+static sc_bool task_run_set_task_action(sc_gameref_t game, sc_int var1, sc_int var2) {
sc_bool status = FALSE;
/* Select based on var1. */
@@ -805,8 +786,7 @@ task_run_set_task_action(sc_gameref_t game, sc_int var1, sc_int var2) {
*
* End of game task action.
*/
-static sc_bool
-task_run_end_game_action(sc_gameref_t game, sc_int var1) {
+static sc_bool task_run_end_game_action(sc_gameref_t game, sc_int var1) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_bool status = FALSE;
@@ -868,8 +848,7 @@ task_run_end_game_action(sc_gameref_t game, sc_int var1) {
*
* Demultiplexer for task actions.
*/
-static sc_bool
-task_run_task_action(sc_gameref_t game, sc_int task, sc_int action) {
+static sc_bool task_run_task_action(sc_gameref_t game, sc_int task, sc_int action) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[5];
sc_int type, var1, var2, var3, var5;
@@ -966,8 +945,7 @@ task_run_task_action(sc_gameref_t game, sc_int task, sc_int action) {
* game, return immediately. Returns TRUE if any action ran and itself
* returned TRUE.
*/
-static sc_bool
-task_run_task_actions(sc_gameref_t game, sc_int task) {
+static sc_bool task_run_task_actions(sc_gameref_t game, sc_int task) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -1031,8 +1009,7 @@ task_run_task_actions(sc_gameref_t game, sc_int task) {
*
* Start NPC walks based on alerts.
*/
-static void
-task_start_npc_walks(sc_gameref_t game, sc_int task) {
+static void task_start_npc_walks(sc_gameref_t game, sc_int task) {
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[4];
sc_int alert_count, alert;
@@ -1064,8 +1041,7 @@ task_start_npc_walks(sc_gameref_t game, sc_int task) {
* outputting a message describing what prevented it, or why it couldn't be
* done.
*/
-static sc_bool
-task_run_task_unrestricted(sc_gameref_t game, sc_int task, sc_bool forwards) {
+static sc_bool task_run_task_unrestricted(sc_gameref_t game, sc_int task, sc_bool forwards) {
const sc_filterref_t filter = gs_get_filter(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -1221,8 +1197,7 @@ task_run_task_unrestricted(sc_gameref_t game, sc_int task, sc_bool forwards) {
* task with an error message if we seem to be in one. Checked by counting
* the call depth.
*/
-sc_bool
-task_run_task(sc_gameref_t game, sc_int task, sc_bool forwards) {
+sc_bool task_run_task(sc_gameref_t game, sc_int task, sc_bool forwards) {
static sc_int recursion_depth = 0;
const sc_filterref_t filter = gs_get_filter(game);
@@ -1288,8 +1263,7 @@ task_run_task(sc_gameref_t game, sc_int task, sc_bool forwards) {
*
* Set task tracing on/off.
*/
-void
-task_debug_trace(sc_bool flag) {
+void task_debug_trace(sc_bool flag) {
task_trace = flag;
}
diff --git a/engines/glk/adrift/scutils.cpp b/engines/glk/adrift/scutils.cpp
index 97db91dbb8..0c8165d581 100644
--- a/engines/glk/adrift/scutils.cpp
+++ b/engines/glk/adrift/scutils.cpp
@@ -93,8 +93,7 @@ static void *sc_zero_allocation = &sc_zero_allocation;
* cleared to zero. In ANSI/ISO C, zero byte allocations are implementation-
* defined, so we have to take special care to get predictable behavior.
*/
-void *
-sc_malloc(size_t size) {
+void *sc_malloc(size_t size) {
void *allocated;
if (size == 0)
@@ -110,8 +109,7 @@ sc_malloc(size_t size) {
return allocated;
}
-void *
-sc_realloc(void *pointer, size_t size) {
+void *sc_realloc(void *pointer, size_t size) {
void *allocated;
if (size == 0) {
@@ -133,8 +131,7 @@ sc_realloc(void *pointer, size_t size) {
return allocated;
}
-void
-sc_free(void *pointer) {
+void sc_free(void *pointer) {
if (sc_zero_allocation != &sc_zero_allocation)
sc_fatal("sc_free: write to zero-byte allocation address detected\n");
@@ -150,8 +147,7 @@ sc_free(void *pointer) {
* Strncasecmp and strcasecmp are not ANSI functions, so here are local
* definitions to do the same jobs.
*/
-sc_int
-sc_strncasecmp(const sc_char *s1, const sc_char *s2, sc_int n) {
+sc_int sc_strncasecmp(const sc_char *s1, const sc_char *s2, sc_int n) {
sc_int index_;
assert(s1 && s2);
@@ -166,8 +162,7 @@ sc_strncasecmp(const sc_char *s1, const sc_char *s2, sc_int n) {
return 0;
}
-sc_int
-sc_strcasecmp(const sc_char *s1, const sc_char *s2) {
+sc_int sc_strcasecmp(const sc_char *s1, const sc_char *s2) {
sc_int s1len, s2len, result;
assert(s1 && s2);
@@ -194,8 +189,7 @@ sc_strcasecmp(const sc_char *s1, const sc_char *s2) {
* to return the same sequence for all platforms. The default is the first,
* with the latter intended for predictability of game actions.
*/
-static sc_int
-sc_platform_rand(sc_uint new_seed) {
+static sc_int sc_platform_rand(sc_uint new_seed) {
static sc_bool is_seeded = FALSE;
/* If reseeding, seed with the value supplied, note seeded, and return 0. */
@@ -215,8 +209,7 @@ sc_platform_rand(sc_uint new_seed) {
}
}
-static sc_int
-sc_congruential_rand(sc_uint new_seed) {
+static sc_int sc_congruential_rand(sc_uint new_seed) {
static sc_bool is_seeded = FALSE;
static sc_uint rand_state = 1;
@@ -263,29 +256,24 @@ static sc_int(*sc_rand_function)(sc_uint) = sc_platform_rand;
* handler in use, generate a random number, and a convenience function to
* generate a random value within a given range.
*/
-void
-sc_set_congruential_random(void) {
+void sc_set_congruential_random(void) {
sc_rand_function = sc_congruential_rand;
}
-void
-sc_set_platform_random(void) {
+void sc_set_platform_random(void) {
sc_rand_function = sc_platform_rand;
}
-sc_bool
-sc_is_congruential_random(void) {
+sc_bool sc_is_congruential_random(void) {
return sc_rand_function == sc_congruential_rand;
}
-void
-sc_seed_random(sc_uint new_seed) {
+void sc_seed_random(sc_uint new_seed) {
/* Ignore zero values of new_seed by simply using 1 instead. */
sc_rand_function(new_seed > 0 ? new_seed : 1);
}
-sc_int
-sc_rand(void) {
+sc_int sc_rand(void) {
sc_int retval;
/* Passing zero indicates this is not a seed operation. */
@@ -293,8 +281,7 @@ sc_rand(void) {
return retval;
}
-sc_int
-sc_randomint(sc_int low, sc_int high) {
+sc_int sc_randomint(sc_int low, sc_int high) {
/*
* If the range is invalid, just return the low value given. This mimics
* Adrift under the same conditions, and also guards against division by
@@ -313,8 +300,7 @@ static const sc_char SPACE = ' ';
*
* Return TRUE if a string is either zero-length or contains only whitespace.
*/
-sc_bool
-sc_strempty(const sc_char *string) {
+sc_bool sc_strempty(const sc_char *string) {
sc_int index_;
assert(string);
@@ -335,8 +321,7 @@ sc_strempty(const sc_char *string) {
* Trim leading and trailing whitespace from a string. Modifies the string
* in place, and returns the string address for convenience.
*/
-sc_char *
-sc_trim_string(sc_char *string) {
+sc_char *sc_trim_string(sc_char *string) {
sc_int index_;
assert(string);
@@ -359,8 +344,7 @@ sc_trim_string(sc_char *string) {
* Modifies the string in place, and returns the string address for
* convenience.
*/
-sc_char *
-sc_normalize_string(sc_char *string) {
+sc_char *sc_normalize_string(sc_char *string) {
sc_int index_;
assert(string);
@@ -389,8 +373,7 @@ sc_normalize_string(sc_char *string) {
*
* Return TRUE if the first word in the string is word, case insensitive.
*/
-sc_bool
-sc_compare_word(const sc_char *string, const sc_char *word, sc_int length) {
+sc_bool sc_compare_word(const sc_char *string, const sc_char *word, sc_int length) {
assert(string && word);
/* Return TRUE if string starts with word, then space or string end. */
@@ -405,8 +388,7 @@ sc_compare_word(const sc_char *string, const sc_char *word, sc_int length) {
* Hash a string, hashpjw algorithm, from 'Compilers, principles, techniques,
* and tools', page 436, unmodulo'ed and somewhat restyled.
*/
-sc_uint
-sc_hash(const sc_char *string) {
+sc_uint sc_hash(const sc_char *string) {
sc_int index_;
sc_uint hash;
assert(string);
diff --git a/engines/glk/adrift/scvars.cpp b/engines/glk/adrift/scvars.cpp
index 65957e1c6e..f9203fb384 100644
--- a/engines/glk/adrift/scvars.cpp
+++ b/engines/glk/adrift/scvars.cpp
@@ -57,13 +57,14 @@ static const sc_char *const VAR_NUMBERS[VAR_NUMBERS_SIZE] = {
};
/* Variable entry, held on a list hashed by variable name. */
-typedef struct sc_var_s {
+struct sc_var_s {
struct sc_var_s *next;
const sc_char *name;
sc_int type;
sc_vartype_t value;
-} sc_var_t;
+};
+typedef sc_var_s sc_var_t;
typedef sc_var_t *sc_varref_t;
/*
@@ -73,7 +74,7 @@ typedef sc_var_t *sc_varref_t;
* exceed a fill factor of two (~422 variables).
*/
enum { VAR_HASH_TABLE_SIZE = 211 };
-typedef struct sc_var_set_s {
+struct sc_var_set_s {
sc_uint magic;
sc_prop_setref_t bundle;
sc_int referenced_character;
@@ -86,7 +87,8 @@ typedef struct sc_var_set_s {
sc_uint time_offset;
sc_gameref_t game;
sc_varref_t variable[VAR_HASH_TABLE_SIZE];
-} sc_var_set_t;
+};
+typedef sc_var_set_s sc_var_set_t;
/*
@@ -94,8 +96,7 @@ typedef struct sc_var_set_s {
*
* Return TRUE if pointer is a valid variables set, FALSE otherwise.
*/
-static sc_bool
-var_is_valid(sc_var_setref_t vars) {
+static sc_bool var_is_valid(sc_var_setref_t vars) {
return vars && vars->magic == VARS_MAGIC;
}
@@ -105,8 +106,7 @@ var_is_valid(sc_var_setref_t vars) {
*
* Hash a variable name, modulo'ed to the number of buckets.
*/
-static sc_uint
-var_hash_name(const sc_char *name) {
+static sc_uint var_hash_name(const sc_char *name) {
return sc_hash(name) % VAR_HASH_TABLE_SIZE;
}
@@ -116,8 +116,7 @@ var_hash_name(const sc_char *name) {
*
* Create and return a new empty set of variables.
*/
-static sc_var_setref_t
-var_create_empty(void) {
+static sc_var_setref_t var_create_empty(void) {
sc_var_setref_t vars;
sc_int index_;
@@ -148,8 +147,7 @@ var_create_empty(void) {
*
* Destroy a variable set, and free its heap memory.
*/
-void
-var_destroy(sc_var_setref_t vars) {
+void var_destroy(sc_var_setref_t vars) {
sc_int index_;
assert(var_is_valid(vars));
@@ -185,8 +183,7 @@ var_destroy(sc_var_setref_t vars) {
* Find and return a pointer to a named variable structure, or nullptr if no such
* variable exists, and add a new variable structure to the lists.
*/
-static sc_varref_t
-var_find(sc_var_setref_t vars, const sc_char *name) {
+static sc_varref_t var_find(sc_var_setref_t vars, const sc_char *name) {
sc_uint hash;
sc_varref_t var;
@@ -201,8 +198,7 @@ var_find(sc_var_setref_t vars, const sc_char *name) {
return var;
}
-static sc_varref_t
-var_add(sc_var_setref_t vars, const sc_char *name, sc_int type) {
+static sc_varref_t var_add(sc_var_setref_t vars, const sc_char *name, sc_int type) {
sc_varref_t var;
sc_uint hash;
@@ -227,8 +223,7 @@ var_add(sc_var_setref_t vars, const sc_char *name, sc_int type) {
* Return the value of %scare_version%. Used to generate the system version
* of this variable, and to re-initialize user versions initialized to zero.
*/
-static sc_int
-var_get_scare_version(void) {
+static sc_int var_get_scare_version(void) {
sc_int major, minor, point, version;
if (sscanf(SCARE_VERSION, "%ld.%ld.%ld", &major, &minor, &point) != 3) {
@@ -247,9 +242,7 @@ var_get_scare_version(void) {
* Store a variable type in a named variable. If not present, the variable
* is created. Type is one of 'I' or 'S' for integer or string.
*/
-void
-var_put(sc_var_setref_t vars,
- const sc_char *name, sc_int type, sc_vartype_t vt_value) {
+void var_put(sc_var_setref_t vars, const sc_char *name, sc_int type, sc_vartype_t vt_value) {
sc_varref_t var;
sc_bool is_modification;
assert(var_is_valid(vars));
@@ -350,8 +343,7 @@ var_put(sc_var_setref_t vars,
* Helper for object listers. Extends temporary, and appends the given text
* to the string.
*/
-static void
-var_append_temp(sc_var_setref_t vars, const sc_char *string) {
+static void var_append_temp(sc_var_setref_t vars, const sc_char *string) {
sc_bool new_sentence;
sc_int noted;
@@ -383,8 +375,7 @@ var_append_temp(sc_var_setref_t vars, const sc_char *string) {
* Convenience functions to append an object's name, with and without any
* prefix, to variables temporary.
*/
-static void
-var_print_object_np(sc_gameref_t game, sc_int object) {
+static void var_print_object_np(sc_gameref_t game, sc_int object) {
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -440,8 +431,7 @@ var_print_object_np(sc_gameref_t game, sc_int object) {
var_append_temp(vars, name);
}
-static void
-var_print_object(sc_gameref_t game, sc_int object) {
+static void var_print_object(sc_gameref_t game, sc_int object) {
const sc_var_setref_t vars = gs_get_vars(game);
const sc_prop_setref_t bundle = gs_get_bundle(game);
sc_vartype_t vt_key[3];
@@ -474,9 +464,8 @@ var_print_object(sc_gameref_t game, sc_int object) {
* Convenience function for listers. Selects one of two responses depending
* on whether an object appears singular or plural.
*/
-static const sc_char *
-var_select_plurality(sc_gameref_t game, sc_int object,
- const sc_char *singular, const sc_char *plural) {
+static const sc_char *var_select_plurality(sc_gameref_t game, sc_int object,
+ const sc_char *singular, const sc_char *plural) {
return obj_appears_plural(game, object) ? plural : singular;
}
@@ -486,8 +475,7 @@ var_select_plurality(sc_gameref_t game, sc_int object,
*
* List the objects in a given container object.
*/
-static void
-var_list_in_object(sc_gameref_t game, sc_int container) {
+static void var_list_in_object(sc_gameref_t game, sc_int container) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_int object, count, trail;
@@ -535,8 +523,7 @@ var_list_in_object(sc_gameref_t game, sc_int container) {
*
* List the objects on a given surface object.
*/
-static void
-var_list_on_object(sc_gameref_t game, sc_int supporter) {
+static void var_list_on_object(sc_gameref_t game, sc_int supporter) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_int object, count, trail;
@@ -583,8 +570,7 @@ var_list_on_object(sc_gameref_t game, sc_int supporter) {
*
* List the objects on and in a given associate object.
*/
-static void
-var_list_onin_object(sc_gameref_t game, sc_int associate) {
+static void var_list_onin_object(sc_gameref_t game, sc_int associate) {
const sc_var_setref_t vars = gs_get_vars(game);
sc_int object, count, trail;
sc_bool supporting;
@@ -685,15 +671,13 @@ var_list_onin_object(sc_gameref_t game, sc_int associate) {
* a bit easier. Set appropriate values for return type and the relevant
* return value field, and always return TRUE. A macro was tempting here...
*/
-static sc_bool
-var_return_integer(sc_int value, sc_int *type, sc_vartype_t *vt_rvalue) {
+static sc_bool var_return_integer(sc_int value, sc_int *type, sc_vartype_t *vt_rvalue) {
*type = VAR_INTEGER;
vt_rvalue->integer = value;
return TRUE;
}
-static sc_bool
-var_return_string(const sc_char *value, sc_int *type, sc_vartype_t *vt_rvalue) {
+static sc_bool var_return_string(const sc_char *value, sc_int *type, sc_vartype_t *vt_rvalue) {
*type = VAR_STRING;
vt_rvalue->string = value;
return TRUE;
@@ -706,9 +690,8 @@ var_return_string(const sc_char *value, sc_int *type, sc_vartype_t *vt_rvalue) {
* Construct a system variable, and return its type and value, or FALSE
* if invalid name passed in. Uses var_return_*() to reduce code untidiness.
*/
-static sc_bool
-var_get_system(sc_var_setref_t vars,
- const sc_char *name, sc_int *type, sc_vartype_t *vt_rvalue) {
+static sc_bool var_get_system(sc_var_setref_t vars, const sc_char *name,
+ sc_int *type, sc_vartype_t *vt_rvalue) {
const sc_prop_setref_t bundle = vars->bundle;
const sc_gameref_t game = vars->game;
@@ -1324,9 +1307,8 @@ var_get_system(sc_var_setref_t vars,
* Retrieve a user variable, and return its type and value, or FALSE if the
* name passed in is not a defined user variable.
*/
-static sc_bool
-var_get_user(sc_var_setref_t vars,
- const sc_char *name, sc_int *type, sc_vartype_t *vt_rvalue) {
+static sc_bool var_get_user(sc_var_setref_t vars, const sc_char *name,
+ sc_int *type, sc_vartype_t *vt_rvalue) {
sc_varref_t var;
/* Check user variables for a reference to the named variable. */
@@ -1360,9 +1342,7 @@ var_get_user(sc_var_setref_t vars,
* Retrieve a variable, and return its value and type. Returns FALSE if the
* named variable does not exist.
*/
-sc_bool
-var_get(sc_var_setref_t vars,
- const sc_char *name, sc_int *type, sc_vartype_t *vt_rvalue) {
+sc_bool var_get(sc_var_setref_t vars, const sc_char *name, sc_int *type, sc_vartype_t *vt_rvalue) {
sc_bool status;
assert(var_is_valid(vars));
assert(name && type && vt_rvalue);
@@ -1407,8 +1387,7 @@ var_get(sc_var_setref_t vars,
* Convenience functions to store and retrieve an integer variable. It is
* an error for the variable not to exist or to have the wrong type.
*/
-void
-var_put_integer(sc_var_setref_t vars, const sc_char *name, sc_int value) {
+void var_put_integer(sc_var_setref_t vars, const sc_char *name, sc_int value) {
sc_vartype_t vt_value;
assert(var_is_valid(vars));
@@ -1416,8 +1395,7 @@ var_put_integer(sc_var_setref_t vars, const sc_char *name, sc_int value) {
var_put(vars, name, VAR_INTEGER, vt_value);
}
-sc_int
-var_get_integer(sc_var_setref_t vars, const sc_char *name) {
+sc_int var_get_integer(sc_var_setref_t vars, const sc_char *name) {
sc_vartype_t vt_rvalue;
sc_int type;
assert(var_is_valid(vars));
@@ -1438,9 +1416,7 @@ var_get_integer(sc_var_setref_t vars, const sc_char *name) {
* Convenience functions to store and retrieve a string variable. It is
* an error for the variable not to exist or to have the wrong type.
*/
-void
-var_put_string(sc_var_setref_t vars,
- const sc_char *name, const sc_char *string) {
+void var_put_string(sc_var_setref_t vars, const sc_char *name, const sc_char *string) {
sc_vartype_t vt_value;
assert(var_is_valid(vars));
@@ -1448,8 +1424,7 @@ var_put_string(sc_var_setref_t vars,
var_put(vars, name, VAR_STRING, vt_value);
}
-const sc_char *
-var_get_string(sc_var_setref_t vars, const sc_char *name) {
+const sc_char *var_get_string(sc_var_setref_t vars, const sc_char *name) {
sc_vartype_t vt_rvalue;
sc_int type;
assert(var_is_valid(vars));
@@ -1469,8 +1444,7 @@ var_get_string(sc_var_setref_t vars, const sc_char *name) {
* Create and return a new set of variables. Variables are created from the
* properties bundle passed in.
*/
-sc_var_setref_t
-var_create(sc_prop_setref_t bundle) {
+sc_var_setref_t var_create(sc_prop_setref_t bundle) {
sc_var_setref_t vars;
sc_int var_count, index_;
sc_vartype_t vt_key[3];
@@ -1534,8 +1508,7 @@ var_create(sc_prop_setref_t bundle) {
* system variables. To ensure integrity, the game being registered must
* reference this variable set.
*/
-void
-var_register_game(sc_var_setref_t vars, sc_gameref_t game) {
+void var_register_game(sc_var_setref_t vars, sc_gameref_t game) {
assert(var_is_valid(vars));
assert(gs_is_game_valid(game));
@@ -1554,27 +1527,23 @@ var_register_game(sc_var_setref_t vars, sc_gameref_t game) {
*
* Set the "referenced" character, object, number, and text.
*/
-void
-var_set_ref_character(sc_var_setref_t vars, sc_int character) {
+void var_set_ref_character(sc_var_setref_t vars, sc_int character) {
assert(var_is_valid(vars));
vars->referenced_character = character;
}
-void
-var_set_ref_object(sc_var_setref_t vars, sc_int object) {
+void var_set_ref_object(sc_var_setref_t vars, sc_int object) {
assert(var_is_valid(vars));
vars->referenced_object = object;
}
-void
-var_set_ref_number(sc_var_setref_t vars, sc_int number) {
+void var_set_ref_number(sc_var_setref_t vars, sc_int number) {
assert(var_is_valid(vars));
vars->referenced_number = number;
vars->is_number_referenced = TRUE;
}
-void
-var_set_ref_text(sc_var_setref_t vars, const sc_char *text) {
+void var_set_ref_text(sc_var_setref_t vars, const sc_char *text) {
assert(var_is_valid(vars));
/* Take a copy of the string, and retain it. */
@@ -1591,26 +1560,22 @@ var_set_ref_text(sc_var_setref_t vars, const sc_char *text) {
*
* Get the "referenced" character, object, number, and text.
*/
-sc_int
-var_get_ref_character(sc_var_setref_t vars) {
+sc_int var_get_ref_character(sc_var_setref_t vars) {
assert(var_is_valid(vars));
return vars->referenced_character;
}
-sc_int
-var_get_ref_object(sc_var_setref_t vars) {
+sc_int var_get_ref_object(sc_var_setref_t vars) {
assert(var_is_valid(vars));
return vars->referenced_object;
}
-sc_int
-var_get_ref_number(sc_var_setref_t vars) {
+sc_int var_get_ref_number(sc_var_setref_t vars) {
assert(var_is_valid(vars));
return vars->referenced_number;
}
-const sc_char *
-var_get_ref_text(sc_var_setref_t vars) {
+const sc_char *var_get_ref_text(sc_var_setref_t vars) {
assert(var_is_valid(vars));
/*
@@ -1629,8 +1594,7 @@ var_get_ref_text(sc_var_setref_t vars) {
* Get a count of seconds elapsed since the variables were created (start
* of game), and set the count to a given value (game restore).
*/
-sc_uint
-var_get_elapsed_seconds(sc_var_setref_t vars) {
+sc_uint var_get_elapsed_seconds(sc_var_setref_t vars) {
double delta;
assert(var_is_valid(vars));
@@ -1638,8 +1602,7 @@ var_get_elapsed_seconds(sc_var_setref_t vars) {
return (sc_uint) delta + vars->time_offset;
}
-void
-var_set_elapsed_seconds(sc_var_setref_t vars, sc_uint seconds) {
+void var_set_elapsed_seconds(sc_var_setref_t vars, sc_uint seconds) {
assert(var_is_valid(vars));
/*
@@ -1657,8 +1620,7 @@ var_set_elapsed_seconds(sc_var_setref_t vars, sc_uint seconds) {
*
* Set variable tracing on/off.
*/
-void
-var_debug_trace(sc_bool flag) {
+void var_debug_trace(sc_bool flag) {
var_trace = flag;
}
@@ -1668,8 +1630,7 @@ var_debug_trace(sc_bool flag) {
*
* Print out a complete variables set.
*/
-void
-var_debug_dump(sc_var_setref_t vars) {
+void var_debug_dump(sc_var_setref_t vars) {
sc_int index_;
sc_varref_t var;
assert(var_is_valid(vars));
diff --git a/engines/glk/adrift/sxfile.cpp b/engines/glk/adrift/sxfile.cpp
index 4b91db9687..f5df4008d8 100644
--- a/engines/glk/adrift/sxfile.cpp
+++ b/engines/glk/adrift/sxfile.cpp
@@ -80,8 +80,7 @@ void *file_open_file_callback(sc_bool is_save) {
return stream;
}
-sc_int
-file_read_file_callback(void *opaque, sc_byte *buffer, sc_int length) {
+sc_int file_read_file_callback(void *opaque, sc_byte *buffer, sc_int length) {
sx_scr_stream_t *const stream = (sx_scr_stream_t *)opaque;
sc_int bytes;
assert(opaque && buffer && length > 0);
@@ -106,8 +105,7 @@ file_read_file_callback(void *opaque, sc_byte *buffer, sc_int length) {
return bytes;
}
-void
-file_write_file_callback(void *opaque, const sc_byte *buffer, sc_int length) {
+void file_write_file_callback(void *opaque, const sc_byte *buffer, sc_int length) {
sx_scr_stream_t *const stream = (sx_scr_stream_t *)opaque;
assert(opaque && buffer && length > 0);
@@ -129,8 +127,7 @@ file_write_file_callback(void *opaque, const sc_byte *buffer, sc_int length) {
stream->length += length;
}
-void
-file_close_file_callback(void *opaque) {
+void file_close_file_callback(void *opaque) {
sx_scr_stream_t *const stream = (sx_scr_stream_t *)opaque;
assert(opaque);
@@ -162,8 +159,7 @@ file_close_file_callback(void *opaque) {
*
* Free any pending allocations and clean up on completion of a script.
*/
-void
-file_cleanup(void) {
+void file_cleanup(void) {
sx_scr_stream_t *const stream = &scr_serialization_stream;
sx_free(stream->data);
diff --git a/engines/glk/adrift/sxglob.cpp b/engines/glk/adrift/sxglob.cpp
index c6133aa458..f57eed7df2 100644
--- a/engines/glk/adrift/sxglob.cpp
+++ b/engines/glk/adrift/sxglob.cpp
@@ -66,9 +66,7 @@ namespace Adrift {
* Match a "[...]" character range, and match general glob wildcards. See
* above for notes on where these functions came from originally.
*/
-static int
-glob_inrange_unsigned(const unsigned char **const pattern,
- unsigned char ch) {
+static int glob_inrange_unsigned(const unsigned char **const pattern, unsigned char ch) {
const unsigned char *const pattern_ = *pattern;
int in_range = FALSE;
unsigned int l = 256, r = 0, index_;
@@ -116,9 +114,7 @@ glob_inrange_unsigned(const unsigned char **const pattern,
return in_range;
}
-static int
-glob_match_unsigned(const unsigned char *pattern,
- const unsigned char *string) {
+static int glob_match_unsigned(const unsigned char *pattern, const unsigned char *string) {
int is_match = FALSE;
if (!*string) {
@@ -161,10 +157,10 @@ glob_match_unsigned(const unsigned char *pattern,
/* Structures and data for the self test function. */
-typedef struct {
+struct sx_test_data_t {
const sc_char *const pattern;
const sc_char *const string;
-} sx_test_data_t;
+};
static const sx_test_data_t SHOULD_MATCH[] = {
{"a", "a"}, {"abc", "abc"}, {"", ""},
@@ -226,8 +222,7 @@ static const sx_test_data_t SHOULD_NOT_MATCH[] = {
*
* Sed quis custodiet ipsos custodes?
*/
-static void
-glob_self_test(void) {
+static void glob_self_test(void) {
const sx_test_data_t *test;
sc_int errors;
@@ -271,8 +266,7 @@ glob_self_test(void) {
* Adapter for the above globbing functions, presenting a more standard char-
* based interface. Here is where all the evil casting lives.
*/
-sc_bool
-glob_match(const sc_char *pattern, const sc_char *string) {
+sc_bool glob_match(const sc_char *pattern, const sc_char *string) {
static sc_bool initialized = FALSE;
const unsigned char *pattern_ = (const unsigned char *) pattern;
diff --git a/engines/glk/adrift/sxscript.cpp b/engines/glk/adrift/sxscript.cpp
index 33c0501a3c..566aa3485f 100644
--- a/engines/glk/adrift/sxscript.cpp
+++ b/engines/glk/adrift/sxscript.cpp
@@ -75,8 +75,7 @@ static sc_char *scr_game_output = NULL;
*
* Set error reporting for expectation errors detected in the script.
*/
-void
-scr_set_verbose(sc_bool flag) {
+void scr_set_verbose(sc_bool flag) {
scr_is_verbose = flag;
}
@@ -88,8 +87,7 @@ scr_set_verbose(sc_bool flag) {
* Simple common message and test case failure handling functions. The second
* is used by the serialization helper, so is not static.
*/
-static void
-scr_test_message(const sc_char *format, const sc_char *string) {
+static void scr_test_message(const sc_char *format, const sc_char *string) {
if (scr_is_verbose) {
sx_trace("--- ");
sx_trace(format, string);
@@ -97,8 +95,7 @@ scr_test_message(const sc_char *format, const sc_char *string) {
}
}
-void
-scr_test_failed(const sc_char *format, const sc_char *string) {
+void scr_test_failed(const sc_char *format, const sc_char *string) {
assert(format && string);
if (scr_is_verbose) {
@@ -123,34 +120,28 @@ scr_test_failed(const sc_char *format, const sc_char *string) {
*
* Line classifiers, return TRUE if line has the given type.
*/
-static sc_bool
-scr_is_line_type(const sc_char *line, sc_char type) {
+static sc_bool scr_is_line_type(const sc_char *line, sc_char type) {
return line[0] == type;
}
-static sc_bool
-scr_is_line_comment_or_empty(const sc_char *line) {
+static sc_bool scr_is_line_comment_or_empty(const sc_char *line) {
return scr_is_line_type(line, SCRIPT_COMMENT)
|| strspn(line, "\t\n\v\f\r ") == strlen(line);
}
-static sc_bool
-scr_is_line_game_command(const sc_char *line) {
+static sc_bool scr_is_line_game_command(const sc_char *line) {
return scr_is_line_type(line, GAME_COMMAND);
}
-static sc_bool
-scr_is_line_debug_command(const sc_char *line) {
+static sc_bool scr_is_line_debug_command(const sc_char *line) {
return scr_is_line_type(line, DEBUG_COMMAND);
}
-static sc_bool
-scr_is_line_command(const sc_char *line) {
+static sc_bool scr_is_line_command(const sc_char *line) {
return scr_is_line_game_command(line) || scr_is_line_debug_command(line);
}
-static sc_bool
-scr_is_line_empty_debug_command(const sc_char *line) {
+static sc_bool scr_is_line_empty_debug_command(const sc_char *line) {
return scr_is_line_type(line, DEBUG_COMMAND) && line[1] == NUL;
}
@@ -168,8 +159,7 @@ typedef sx_scr_location_t *sx_scr_locationref_t;
*
* Save and restore the script location in the given structure.
*/
-static void
-scr_save_location(sx_script script, sx_scr_locationref_t location) {
+static void scr_save_location(sx_script script, sx_scr_locationref_t location) {
location->position = script->pos();
location->line_number = scr_line_number;
}
@@ -217,8 +207,7 @@ static sc_char *scr_get_next_line(sx_script script) {
* the second argument to the first. If the first is NULL, acts as strdup()
* instead.
*/
-static sc_char *
-scr_concatenate(sc_char *string, const sc_char *buffer) {
+static sc_char *scr_concatenate(sc_char *string, const sc_char *buffer) {
/* If string is not null, concatenate buffer, otherwise duplicate. */
if (string) {
string = (sc_char *)sx_realloc(string,
@@ -243,9 +232,7 @@ scr_concatenate(sc_char *string, const sc_char *buffer) {
* returned). Command and expectation are allocated, and the caller needs to
* free them.
*/
-static sc_bool
-scr_get_next_section(sx_script script,
- sc_char **command, sc_char **expectation) {
+static sc_bool scr_get_next_section(sx_script script, sc_char **command, sc_char **expectation) {
sc_char *line, *first_line, *other_lines;
sx_scr_location_t location;
@@ -308,8 +295,7 @@ scr_get_next_section(sx_script script,
* error if required. It then frees both the expectation and accumulated
* input.
*/
-static void
-scr_expect(sc_char *expectation) {
+static void scr_expect(sc_char *expectation) {
/*
* Save the expectation, and set up collection of game output if needed.
* And if not needed, ensure expectation and game output are cleared.
@@ -327,8 +313,7 @@ scr_expect(sc_char *expectation) {
}
}
-static void
-scr_verify_expectation(void) {
+static void scr_verify_expectation(void) {
/* Compare expected with actual, and handle any error detected. */
if (scr_expectation && scr_game_output) {
scr_game_output = sx_normalize_string(scr_game_output);
@@ -357,8 +342,7 @@ scr_verify_expectation(void) {
* Also, it turns on the game debugger, and it's the caller's responsibility
* to turn it off when it's no longer needed.
*/
-static void
-scr_execute_debugger_command(const sc_char *command, sc_char *expectation) {
+static void scr_execute_debugger_command(const sc_char *command, sc_char *expectation) {
sc_bool status;
/* Set up the expectation. */
@@ -390,8 +374,7 @@ scr_execute_debugger_command(const sc_char *command, sc_char *expectation) {
* to "" so that accumulation begins. Then pass the next line of data back
* to the game.
*/
-static sc_bool
-scr_read_line_callback(sc_char *buffer, sc_int length) {
+static sc_bool scr_read_line_callback(sc_char *buffer, sc_int length) {
sc_char *command, *expectation;
assert(buffer && length > 0);
@@ -455,8 +438,7 @@ scr_read_line_callback(sc_char *buffer, sc_int length) {
* game into scr_game_output, unless no expectation is set, in which case
* the current game output will be NULL, and we can simply save the effort.
*/
-static void
-scr_print_string_callback(const sc_char *string) {
+static void scr_print_string_callback(const sc_char *string) {
assert(string);
if (scr_game_output) {
@@ -476,8 +458,7 @@ scr_print_string_callback(const sc_char *string) {
* "expect" pair from the script, satisfy the request with the send data,
* and match against the expectations on next request or on finalization.
*/
-void
-scr_start_script(sc_game game, sx_script script) {
+void scr_start_script(sc_game game, sx_script script) {
sc_char *command, *expectation;
sx_scr_location_t location;
assert(game && script);
@@ -541,8 +522,7 @@ scr_start_script(sc_game game, sx_script script) {
* clear local records of the game, stream, and error count. Returns the
* count of errors detected during the script.
*/
-sc_int
-scr_finalize_script(void) {
+sc_int scr_finalize_script(void) {
sc_char *command, *expectation;
sc_int errors;
diff --git a/engines/glk/adrift/sxtester.cpp b/engines/glk/adrift/sxtester.cpp
index f82ca275ad..ae28b3b48b 100644
--- a/engines/glk/adrift/sxtester.cpp
+++ b/engines/glk/adrift/sxtester.cpp
@@ -54,8 +54,7 @@ static sc_int test_run_game_script(sc_game game, sx_script script) {
* Run each test in the given descriptor array, reporting the results and
* accumulating an error count overall. Return the total error count.
*/
-sc_int test_run_game_tests(const sx_test_descriptor_t tests[],
- sc_int count, sc_bool is_verbose) {
+sc_int test_run_game_tests(const sx_test_descriptor_t tests[], sc_int count, sc_bool is_verbose) {
const sx_test_descriptor_t *test;
sc_int errors;
assert(tests);
diff --git a/engines/glk/adrift/sxutils.cpp b/engines/glk/adrift/sxutils.cpp
index 90c7385131..e4b3519ebf 100644
--- a/engines/glk/adrift/sxutils.cpp
+++ b/engines/glk/adrift/sxutils.cpp
@@ -89,8 +89,7 @@ static void *sx_zero_allocation = &sx_zero_allocation;
* cleared to zero. In ANSI/ISO C, zero byte allocations are implementation-
* defined, so we have to take special care to get predictable behavior.
*/
-void *
-sx_malloc(size_t size) {
+void *sx_malloc(size_t size) {
void *allocated;
if (size == 0)
@@ -106,8 +105,7 @@ sx_malloc(size_t size) {
return allocated;
}
-void *
-sx_realloc(void *pointer, size_t size) {
+void *sx_realloc(void *pointer, size_t size) {
void *allocated;
if (size == 0) {
@@ -167,15 +165,13 @@ static const sc_char NUL = '\0';
*
* Built in replacements for locale-sensitive libc ctype.h functions.
*/
-static sc_bool
-sx_isspace(sc_char character) {
+static sc_bool sx_isspace(sc_char character) {
static const sc_char *const WHITESPACE = "\t\n\v\f\r ";
return character != NUL && strchr(WHITESPACE, character) != NULL;
}
-static sc_bool
-sx_isprint(sc_char character) {
+static sc_bool sx_isprint(sc_char character) {
static const sc_int MIN_PRINTABLE = ' ', MAX_PRINTABLE = '~';
return character >= MIN_PRINTABLE && character <= MAX_PRINTABLE;
@@ -188,8 +184,7 @@ sx_isprint(sc_char character) {
* Trim leading and trailing whitespace from a string. Modifies the string
* in place, and returns the string address for convenience.
*/
-sc_char *
-sx_trim_string(sc_char *string) {
+sc_char *sx_trim_string(sc_char *string) {
sc_int index_;
assert(string);
@@ -212,8 +207,7 @@ sx_trim_string(sc_char *string) {
* and convert all non-printing characters to '?'. Modifies the string in
* place, and returns the string address for convenience.
*/
-sc_char *
-sx_normalize_string(sc_char *string) {
+sc_char *sx_normalize_string(sc_char *string) {
sc_int index_;
assert(string);