[Scummvm-git-logs] scummvm master -> e632a94cd40e45f8545ad994d62365c7b7827fb6
aquadran
noreply at scummvm.org
Sun May 29 17:05:56 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e632a94cd4 GLK: Avoid global constructors
Commit: e632a94cd40e45f8545ad994d62365c7b7827fb6
https://github.com/scummvm/scummvm/commit/e632a94cd40e45f8545ad994d62365c7b7827fb6
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-05-29T19:05:51+02:00
Commit Message:
GLK: Avoid global constructors
Changed paths:
engines/glk/quest/geas_file.cpp
engines/glk/quest/geas_file.h
engines/glk/quest/read_file.cpp
diff --git a/engines/glk/quest/geas_file.cpp b/engines/glk/quest/geas_file.cpp
index 3df61c4e3a9..ec7ef606273 100644
--- a/engines/glk/quest/geas_file.cpp
+++ b/engines/glk/quest/geas_file.cpp
@@ -32,9 +32,6 @@ namespace Quest {
void report_error(const String &s);
-// FIXME: This requires global constructor
-reserved_words obj_tag_property("look", "examine", "speak", "take", "alias", "prefix", "suffix", "detail", "displaytype", "gender", "article", "hidden", "invisible", (char *) nullptr);
-
// FIXME: This requires global constructor
//reserved_words room_tag_property("look", "alias", "prefix", "indescription", "description", "north", "south", "east", "west", "northwest", "northeast", "southeast", "southwest", "up", "down", "out", (char *) NULL);
@@ -96,18 +93,19 @@ bool GeasFile::obj_has_property(String objname, String propname) const {
//Set<String, CI_LESS> GeasFile::get_obj_keys (String obj) const
Set<String> GeasFile::get_obj_keys(String obj) const {
//Set<String, CI_LESS> rv;
+ reserved_words obj_tag_property("look", "examine", "speak", "take", "alias", "prefix", "suffix", "detail", "displaytype", "gender", "article", "hidden", "invisible", (char *) nullptr);
Set<String> rv;
- get_obj_keys(obj, rv);
+ get_obj_keys(obj, rv, obj_tag_property);
return rv;
}
-void GeasFile::get_obj_keys(String obj, Set<String> &rv) const {
+void GeasFile::get_obj_keys(String obj, Set<String> &rv, const reserved_words &obj_tag_property) const {
cerr << "get_obj_keys (gf, <" << obj << ">)\n";
//Set<String> rv;
uint c1, c2;
String tok, line;
- reserved_words *rw = nullptr;
+ const reserved_words *rw = nullptr;
const GeasBlock *gb = find_by_name("object", obj);
rw = &obj_tag_property;
diff --git a/engines/glk/quest/geas_file.h b/engines/glk/quest/geas_file.h
index 4810fc5f153..b0edcae6325 100644
--- a/engines/glk/quest/geas_file.h
+++ b/engines/glk/quest/geas_file.h
@@ -80,7 +80,7 @@ struct GeasFile {
const GeasBlock &block(String type, uint index) const;
uint size(String type) const;
- void read_into(const Common::Array<String> &, String, uint, bool, const reserved_words &, const reserved_words &);
+ void read_into(const Common::Array<String> &, String, uint, bool, const reserved_words &, const reserved_words &, const reserved_words &);
@@ -98,7 +98,7 @@ struct GeasFile {
bool type_of_type(String subtype, String supertype) const;
Set<String> get_obj_keys(String obj) const;
- void get_obj_keys(String, Set<String> &) const;
+ void get_obj_keys(String, Set<String> &, const reserved_words &obj_tag_property) const;
void get_type_keys(String, Set<String> &) const;
bool obj_has_action(String objname, String propname) const;
diff --git a/engines/glk/quest/read_file.cpp b/engines/glk/quest/read_file.cpp
index c9258e2068d..a75e5ad1588 100644
--- a/engines/glk/quest/read_file.cpp
+++ b/engines/glk/quest/read_file.cpp
@@ -131,13 +131,11 @@ bool is_end_define(String s) {
extern Common::Array<String> split_lines(String data);
-// FIXME: This requires global constructor
-reserved_words dir_tag_property("north", "south", "east", "west", "northwest", "northeast", "southeast", "southwest", "up", "down", "out", (char *) nullptr);
-
void GeasFile::read_into(const Common::Array<String> &in_data,
String in_parent, uint cur_line, bool recurse,
const reserved_words &props,
- const reserved_words &actions) {
+ const reserved_words &actions,
+ const reserved_words &dir_tag_property) {
//cerr << "r_i: Reading in from" << cur_line << ": " << in_data[cur_line] << endl;
//output.push_back (GeasBlock());
//GeasBlock &out_block = output[output.size() - 1];
@@ -302,6 +300,7 @@ GeasFile::GeasFile(const Common::Array<String> &v, GeasInterface *_gi) : gi(_gi)
reserved_words recursive_passes("game", "room", (char *) nullptr),
object_passes("game", "room", "objects", (char *) nullptr);
+ reserved_words dir_tag_property("north", "south", "east", "west", "northwest", "northeast", "southeast", "southwest", "up", "down", "out", (char *) nullptr);
//Common::Array <GeasBlock> outv;
for (uint pass = 0; pass < sizeof(pass_names) / sizeof(*pass_names);
@@ -333,14 +332,14 @@ GeasFile::GeasFile(const Common::Array<String> &v, GeasInterface *_gi) : gi(_gi)
// SENSITIVE?
if (blocktype == this_pass)
- read_into(v, "", i, recursive, props, actions);
+ read_into(v, "", i, recursive, props, actions, dir_tag_property);
} else if (depth == 2 && blocktype == this_pass) {
// SENSITIVE?
if (this_pass == "object" && parenttype == "room")
- read_into(v, parentname, i, false, props, actions);
+ read_into(v, parentname, i, false, props, actions, dir_tag_property);
// SENSITIVE?
else if (this_pass == "variable" && parenttype == "game")
- read_into(v, "", i, false, props, actions);
+ read_into(v, "", i, false, props, actions, dir_tag_property);
}
} else if (is_end_define(v[i]))
-- depth;
More information about the Scummvm-git-logs
mailing list