Creating a simple graph of scenes, ends and connectors.
+
+
§1. As with Faux Instances, we need to make faux scenes: these more or less
+reconstruct the original data structures in Inform, though they are much less
+annotated.
+
+
+
+
+
+
+
diff --git a/docs/index-module/2-ii.html b/docs/index-module/2-ii.html
index 55ec5e449..637b6460e 100644
--- a/docs/index-module/2-ii.html
+++ b/docs/index-module/2-ii.html
@@ -342,7 +342,7 @@ of the Inter tree currently being indexed.
faux_instance_set *indexing_fis = NULL;
-faux_instance_set *InterpretIndex::get_faux_instances(void) {
+faux_instance_set *InterpretIndex::get_faux_instances(void) {if (indexing_fis == NULL) {if (indexing_tree == NULL) internal_error("no indexing lexicon");indexing_fis = FauxInstances::make_faux(indexing_tree);
@@ -383,7 +383,7 @@ of the Inter tree currently being indexed.
}
diff --git a/docs/index-module/2-iu.html b/docs/index-module/2-iu.html
index 7cee600dc..01055c27f 100644
--- a/docs/index-module/2-iu.html
+++ b/docs/index-module/2-iu.html
@@ -146,11 +146,11 @@ the source text in the application.
-voidIndexUtilities::link(OUTPUT_STREAM, intwn) {
+voidIndexUtilities::link(OUTPUT_STREAM, intwn) {IndexUtilities::link_to_location(OUT, Lexer::word_location(wn), TRUE);}
-voidIndexUtilities::link_package(OUTPUT_STREAM, inter_package *pack) {
+voidIndexUtilities::link_package(OUTPUT_STREAM, inter_package *pack) {intat = (int) Metadata::read_optional_numeric(pack, I"^at");if (at > 0) IndexUtilities::link(OUT, at);}
@@ -348,7 +348,7 @@ see the Phrasebook element for examples of how this comes out.
}
diff --git a/docs/index-module/2-lcl.html b/docs/index-module/2-lcl.html
index 5c088e63d..230a59eb9 100644
--- a/docs/index-module/2-lcl.html
+++ b/docs/index-module/2-lcl.html
@@ -292,25 +292,39 @@ with everything under the first line being italicised. For example:
-voidLocalisation::bold_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+voidLocalisation::bold_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {WRITE("<b>");Localisation::write_0(OUT, D, key);WRITE("</b>");}
-voidLocalisation::italic_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+voidLocalisation::italic_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {WRITE("<i>");Localisation::write_0(OUT, D, key);WRITE("</i>");}
-voidLocalisation::write_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {
+voidLocalisation::write_0(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key) {text_stream *vals[10];Vacate the vals5.1;Localisation::write_general(OUT, D, key, vals);}
-voidLocalisation::write_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+voidLocalisation::bold_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+text_stream *val1) {
+WRITE("<b>");
+Localisation::write_1(OUT, D, key, val1);
+WRITE("</b>");
+}
+
+voidLocalisation::italic_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+text_stream *val1) {
+WRITE("<i>");
+Localisation::write_1(OUT, D, key, val1);
+WRITE("</i>");
+}
+
+voidLocalisation::write_1(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,text_stream *val1) {text_stream *vals[10];Vacate the vals5.1;
@@ -318,7 +332,7 @@ with everything under the first line being italicised. For example:
Localisation::write_general(OUT, D, key, vals);}
-voidLocalisation::write_1n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+voidLocalisation::write_1n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,intval1) {text_stream *vals[10];Vacate the vals5.1;
@@ -329,7 +343,21 @@ with everything under the first line being italicised. For example:
DISCARD_TEXT(f1)}
-voidLocalisation::write_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+voidLocalisation::bold_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+text_stream *val1, text_stream *val2) {
+WRITE("<b>");
+Localisation::write_2(OUT, D, key, val1, val2);
+WRITE("</b>");
+}
+
+voidLocalisation::italic_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+text_stream *val1, text_stream *val2) {
+WRITE("<i>");
+Localisation::write_2(OUT, D, key, val1, val2);
+WRITE("</i>");
+}
+
+voidLocalisation::write_2(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,text_stream *val1, text_stream *val2) {text_stream *vals[10];Vacate the vals5.1;
@@ -337,7 +365,7 @@ with everything under the first line being italicised. For example:
Localisation::write_general(OUT, D, key, vals);}
-voidLocalisation::write_2n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+voidLocalisation::write_2n(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,intval1, intval2) {text_stream *vals[10];Vacate the vals5.1;
@@ -351,7 +379,7 @@ with everything under the first line being italicised. For example:
DISCARD_TEXT(f2)}
-voidLocalisation::write_2sn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+voidLocalisation::write_2sn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,text_stream *val1, intval2) {text_stream *vals[10];Vacate the vals5.1;
@@ -362,7 +390,7 @@ with everything under the first line being italicised. For example:
DISCARD_TEXT(f2)}
-voidLocalisation::write_2ns(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+voidLocalisation::write_2ns(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,intval1, text_stream *val2) {text_stream *vals[10];Vacate the vals5.1;
@@ -373,7 +401,15 @@ with everything under the first line being italicised. For example:
DISCARD_TEXT(f1)}
-voidLocalisation::write_3nsn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+voidLocalisation::write_3(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,
+text_stream *val1, text_stream *val2, text_stream *val3) {
+text_stream *vals[10];
+Vacate the vals5.1;
+vals[1] = val1; vals[2] = val2; vals[3] = val3;
+Localisation::write_general(OUT, D, key, vals);
+}
+
+voidLocalisation::write_3nsn(OUTPUT_STREAM, localisation_dictionary *D, text_stream *key,intval1, text_stream *val2, intval3) {text_stream *vals[10];Vacate the vals5.1;
@@ -393,11 +429,11 @@ with everything under the first line being italicised. For example:
-voidLocalisation::write_general(OUTPUT_STREAM, localisation_dictionary *D,
+voidLocalisation::write_general(OUTPUT_STREAM, localisation_dictionary *D,text_stream *key, text_stream **vals) {text_stream *prototype = Localisation::read(D, key);intitalics_open = FALSE;
@@ -437,7 +473,7 @@ with everything under the first line being italicised. For example:
}
diff --git a/docs/index-module/2-lxc.html b/docs/index-module/2-lxc.html
index 2d7f82498..46f186a0a 100644
--- a/docs/index-module/2-lxc.html
+++ b/docs/index-module/2-lxc.html
@@ -481,7 +481,7 @@ different contexts. We want to quote all of those.
diff --git a/docs/index-module/3-ae.html b/docs/index-module/3-ae.html
index 6fe635d1e..c42a8fad6 100644
--- a/docs/index-module/3-ae.html
+++ b/docs/index-module/3-ae.html
@@ -76,7 +76,7 @@ function togglePopup(material_id) {
-voidAlphabeticElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
+voidAlphabeticElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {inter_tree *I = InterpretIndex::get_tree();tree_inventory *inv = Synoptic::inv(I);TreeLists::sort(inv->action_nodes, AlphabeticElement::alphabetical_order);
diff --git a/docs/index-module/3-ae2.html b/docs/index-module/3-ae2.html
index 57ddcb6e9..0ce554590 100644
--- a/docs/index-module/3-ae2.html
+++ b/docs/index-module/3-ae2.html
@@ -77,7 +77,7 @@ so we do little more than tabulate that data here.
-voidEventsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
+voidEventsElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {inter_tree *I = InterpretIndex::get_tree();tree_inventory *inv = Synoptic::inv(I);TreeLists::sort(inv->rule_nodes, Synoptic::module_order);
diff --git a/docs/index-module/3-ee2.html b/docs/index-module/3-ee2.html
index 7405d930e..4b6f14c90 100644
--- a/docs/index-module/3-ee2.html
+++ b/docs/index-module/3-ee2.html
@@ -77,7 +77,7 @@ really, and most of the code here is just to arrange them in some logical order.
§1. This is by far the most complicated element to render, and much of the work
+is delegated to Chapter 4: Spatial Mapping. This section contains only the code which
+cues all of that up; but even that code is fairly long.
+
The structure simplified_scene is accessed in 2/ir and here.
The structure simplified_end is private to this section.
The structure simplified_connector is private to this section.
§1.1. The sorted ordering is used as-is later on, when we get to the details, but
for the tabulation it's refined further. First we have the start-of-play
scenes, in sorted order; then scenes with a condition for their beginning
@@ -247,36 +113,38 @@ about and created but never made use of.)
HTML::open_indented_p(OUT, 1, "tight");
-WRITE("The Entire Game scene is built-in. It is going on whenever play is "
-"going on. (It is recurring so that if the story ends, but then resumes, "
-"it too will end but then begin again.)");
+Localisation::write_0(OUT, LD, I"Index.Elements.Pl.EntireGame");HTML_CLOSE("p");
-HTML_OPEN("p"); WRITE("<b>Rules added to the sequence of play</b>"); HTML_CLOSE("p");
-HTML_OPEN("p"); WRITE("These rulebooks are the best places to put rules timed to happen "
-"at the start, at the end, or once each turn. (Each is run through at "
-"a carefully chosen moment in the relevant top-level rulebook.) It is "
-"also possible to have rules take effect at specific times of day "
-"or when certain events happen. Those are listed in the Scenes index, "
-"alongside rules taking place when scenes begin or end."); HTML_CLOSE("p");
-IndexRules::rulebook_box(OUT, inv, I"When play begins", I"rules_wpb",
+StandardsElement::subhead(OUT, LD,
+I"Index.Elements.St.SequenceHeading", I"Index.Elements.St.SequenceRubric");
+IndexRules::rulebook_box(OUT, inv, I"Index.Elements.St.WhenPlayBegins", I"rules_wpb",IndexRules::find_rulebook(inv, I"when_play_begins"), NULL, 1, TRUE, LD);
-IndexRules::rulebook_box(OUT, inv, I"Every turn", I"rules_et",
+IndexRules::rulebook_box(OUT, inv, I"Index.Elements.St.EveryTurn", I"rules_et",IndexRules::find_rulebook(inv, I"every_turn"), NULL, 1, TRUE, LD);
-IndexRules::rulebook_box(OUT, inv, I"When play ends", I"rules_wpe",
+IndexRules::rulebook_box(OUT, inv, I"Index.Elements.St.WhenPlayEnds", I"rules_wpe",IndexRules::find_rulebook(inv, I"when_play_ends"), NULL, 1, TRUE, LD);
@@ -141,12 +132,9 @@ their contents in logical order.
-HTML_OPEN("p"); WRITE("<b>How commands are understood</b>"); HTML_CLOSE("p");
-HTML_OPEN("p"); WRITE("'Understanding' here means turning a typed command, like GET FISH, "
-"into one or more actions, like taking the red herring. This is all handled "
-"by a single large rule (the parse command rule), but that rule makes use "
-"of the following activities and rulebooks in its work."); HTML_CLOSE("p");
-IndexRules::rulebook_box(OUT, inv, I"Does the player mean", I"rules_dtpm",
+StandardsElement::subhead(OUT, LD,
+I"Index.Elements.St.UnderstoodHeading", I"Index.Elements.St.UnderstoodRubric");
+IndexRules::rulebook_box(OUT, inv, I"Index.Elements.St.DoesThePlayerMean", I"rules_dtpm",IndexRules::find_rulebook(inv, I"does_the_player_mean"), NULL, 1, TRUE, LD);StandardsElement::activity(OUT, inv, I"reading_a_command", 1, LD);StandardsElement::activity(OUT, inv, I"deciding_scope", 1, LD);
@@ -164,41 +152,37 @@ their contents in logical order.
@@ -206,9 +190,8 @@ their contents in logical order.
-HTML_OPEN("p"); WRITE("<b>How responses are printed</b>"); HTML_CLOSE("p");
-HTML_OPEN("p"); WRITE("The Standard Rules, and some extensions, reply to the player's "
-"commands with messages which are able to be modified."); HTML_CLOSE("p");
+StandardsElement::subhead(OUT, LD,
+I"Index.Elements.St.ResponsesHeading", I"Index.Elements.St.ResponsesRubric");StandardsElement::activity(OUT, inv, I"printing_response", 1, LD);
@@ -231,8 +213,8 @@ their contents in logical order.
-HTML_OPEN("p"); WRITE("<b>Light and darkness</b>"); HTML_CLOSE("p");
-HTML_OPEN("p"); WRITE("These activities control how we describe darkness."); HTML_CLOSE("p");
+StandardsElement::subhead(OUT, LD,
+I"Index.Elements.St.LightHeading", I"Index.Elements.St.LightRubric");StandardsElement::activity(OUT, inv, I"printing_name_of_dark_room", 1, LD);StandardsElement::activity(OUT, inv, I"printing_desc_of_dark_room", 1, LD);StandardsElement::activity(OUT, inv, I"printing_news_of_darkness", 1, LD);
@@ -244,9 +226,8 @@ their contents in logical order.
-HTML_OPEN("p"); WRITE("<b>How things are described</b>"); HTML_CLOSE("p");
-HTML_OPEN("p"); WRITE("These activities control what is printed when naming rooms or "
-"things, and their descriptions."); HTML_CLOSE("p");
+StandardsElement::subhead(OUT, LD,
+I"Index.Elements.St.DescriptionHeading", I"Index.Elements.St.DescriptionRubric");StandardsElement::activity(OUT, inv, I"printing_the_name", 1, LD);StandardsElement::activity(OUT, inv, I"printing_the_plural_name", 1, LD);StandardsElement::activity(OUT, inv, I"printing_a_number_of", 1, LD);
@@ -264,7 +245,13 @@ their contents in logical order.
§1. Indexing. Tables inside extensions are often used just for the storage needed to manage
-back-of-house algorithms, so to speak, and they aren't intended for the end
-user to poke around with; that's certainly true of the tables in the Standard
-Rules, which of course are always present. So these are hidden by default.
+
§1. This is arranged as a sequence of "blocks" of tables, where each block
+corresponds to one of the compilation modules: thus, all the tables in the
+main source text, all the tables in the Standard Rules, and so on.
-voidTablesElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
+voidTablesElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {inter_tree *I = InterpretIndex::get_tree();tree_inventory *inv = Synoptic::inv(I);TreeLists::sort(inv->table_nodes, Synoptic::category_order);
@@ -108,7 +105,13 @@ Rules, which of course are always present. So these are hidden by default.
Close block of tables1.2;}
-
§1.1. Open block of tables1.1 =
+
§1.1. Tables inside extensions are often used just for the storage needed to manage
+back-of-house algorithms, so to speak, and they aren't intended for the end
+user to poke around with; that's certainly true of the tables in the Standard
+Rules, which of course are always present. So these are hidden by default.
+
+
+
Open block of tables1.1 =
@@ -116,8 +119,8 @@ Rules, which of course are always present. So these are hidden by default.
if (first_ext) {HTML_OPEN("p");IndexUtilities::extra_link(OUT, 2);
-if (mc > 1) WRITE("Show tables inside extensions too");
-elseWRITE("Show tables inside extensions (there are none in the main text)");
+if (mc > 1) Localisation::write_0(OUT, LD, I"Index.Elements.Tb.ShowExtensionTables");
+elseLocalisation::write_0(OUT, LD, I"Index.Elements.Tb.ShowOnlyExtensionTables");HTML_CLOSE("p");first_ext = FALSE; }
@@ -140,83 +143,100 @@ Rules, which of course are always present. So these are hidden by default.
}
diff --git a/docs/index-module/3-te2.html b/docs/index-module/3-te2.html
index dada149c9..5a5f4c8ea 100644
--- a/docs/index-module/3-te2.html
+++ b/docs/index-module/3-te2.html
@@ -75,73 +75,85 @@ function togglePopup(material_id) {
§1.
-voidTokensElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {
+voidTokensElement::render(OUTPUT_STREAM, localisation_dictionary *LD) {HTML_OPEN("p");
-WRITE("In addition to the tokens listed below, any description of an object "
-"or value can be used: for example, \"[number]\" matches text like 127 or "
-" SIX, and \"[open door]\" matches the name of any nearby door which is "
-"currently open.");
+Localisation::write_0(OUT, LD, I"Index.Elements.To.Explanation1");HTML_CLOSE("p");HTML_OPEN("p");
-WRITE("Names of objects are normally understood only when they are within "
-"sight, but writing 'any' lifts this restriction. So \"[any person]\" allows "
-"every name of a person, wherever they happen to be.");
+Localisation::write_0(OUT, LD, I"Index.Elements.To.Explanation2");HTML_CLOSE("p");inter_tree *I = InterpretIndex::get_tree();
-TokensElement::index_tokens_for(OUT, I, "anybody", NULL, I"someone_token", "same as \"[someone]\"");
-TokensElement::index_tokens_for(OUT, I, "anyone", NULL, I"someone_token", "same as \"[someone]\"");
-TokensElement::index_tokens_for(OUT, I, "anything", NULL, I"things_token", "same as \"[thing]\"");
-TokensElement::index_tokens_for(OUT, I, "other things", NULL, I"things_token", NULL);
-TokensElement::index_tokens_for(OUT, I, "somebody", NULL, I"someone_token", "same as \"[someone]\"");
-TokensElement::index_tokens_for(OUT, I, "someone", NULL, I"someone_token", NULL);
-TokensElement::index_tokens_for(OUT, I, "something", NULL, I"things_token", "same as \"[thing]\"");
-TokensElement::index_tokens_for(OUT, I, "something preferably held", NULL, I"things_token", NULL);
-TokensElement::index_tokens_for(OUT, I, "text", NULL, I"text_token", NULL);
-TokensElement::index_tokens_for(OUT, I, "things", NULL, I"things_token", NULL);
-TokensElement::index_tokens_for(OUT, I, "things inside", NULL, I"things_token", NULL);
-TokensElement::index_tokens_for(OUT, I, "things preferably held", NULL, I"things_token", NULL);
+
+TokensElement::token(OUT, I, "anybody", NULL, I"someone_token", I"[someone]", LD);
+TokensElement::token(OUT, I, "anyone", NULL, I"someone_token", I"[someone]", LD);
+TokensElement::token(OUT, I, "anything", NULL, I"things_token", I"[thing]", LD);
+TokensElement::token(OUT, I, "other things", NULL, I"things_token", NULL, LD);
+TokensElement::token(OUT, I, "somebody", NULL, I"someone_token", I"[someone]", LD);
+TokensElement::token(OUT, I, "someone", NULL, I"someone_token", NULL, LD);
+TokensElement::token(OUT, I, "something", NULL, I"things_token", I"[thing]", LD);
+TokensElement::token(OUT, I, "something preferably held", NULL, I"things_token", NULL, LD);
+TokensElement::token(OUT, I, "text", NULL, I"text_token", NULL, LD);
+TokensElement::token(OUT, I, "things", NULL, I"things_token", NULL, LD);
+TokensElement::token(OUT, I, "things inside", NULL, I"things_token", NULL, LD);
+TokensElement::token(OUT, I, "things preferably held", NULL, I"things_token", NULL, LD);
+
inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/grammar");inter_package *cg_pack;LOOP_THROUGH_SUBPACKAGES(cg_pack, pack, I"_command_grammar") {if (Metadata::read_optional_numeric(cg_pack, I"^is_token"))
-TokensElement::index_tokens_for(OUT, I, NULL, cg_pack, NULL, NULL);
+TokensElement::token(OUT, I, NULL, cg_pack, NULL, NULL, LD); }}
+
+
§2. So, then, this function is sometimes called for the standard built-in tokens,
+in which case special is set, and sometimes for those created by source text,
+when special is null.
+
§1. The EPS map-maker is really a miniature interpreted programming
-language in its own right, and here we define that language's data
-types and variables.
+
§1. The EPS map-maker is really a miniature interpreted programming language in
+its own right, and here we define that language's data types and variables.
-
The "mapping parameters" amount to being variables. The following
-structure defines the type and current value for each variable: see
-the Inform documentation for details. But note that variables of the
-same name are held by many different objects in the map, and their
-values inherited by sub-objects.
+
The "mapping parameters" amount to being variables. The following structure
+defines the type and current value for each variable: see the Inform
+documentation for details. But note that variables of the same name are held by
+many different objects in the map, and their values inherited by sub-objects.
defineINT_MDT1 an integer
@@ -119,9 +117,9 @@ values inherited by sub-objects.
} plotting_parameter;
The structure plotting_parameter is accessed in 2/fi and here.
-
§2. A set of variables associated with any map object is called a "scope".
-As implied above, the global scope is special: it contains the default
-settings passed down to all lower scopes.
+
§2. A set of variables associated with any map object is called a "scope". As
+implied above, the global scope is special: it contains the default settings
+passed down to all lower scopes.
The structure map_parameter_scope is accessed in 4/rem and here.
+
§3. A little dynamic initialisation is needed here, because I"whatever" constants
+are not in fact legal in constant context in C. So those L"whatever" values,
+which are legal, are converted to to I"whatever" values here:
+
§6. The following sets a parameter to a given value (the string value if that's
+non-NULL, the number value otherwise), for a particular scope: this is
+slightly wastefully specified either as a map_parameter_scope object,
+or as a single room, or as a single region, or as a kind of room or region.
+If all are null, then the global scope is used.
+
§9. Rubric definitions. A "rubric" is a freestanding piece of text written on the map. Typically
+it will be a title, or "Here Be Monsters", or something like that.
@@ -206,7 +326,7 @@ it will be a title.
} rubric_holder;
The structure rubric_holder is accessed in 2/fi, 4/rhm, 4/rem and here.
-
§4. Each horizontal level of the EPS map needs its own storage, not least to
+
§10. EPS definitions. Each horizontal level of the EPS map needs its own storage, not least to
hold the applicable mapping parameters.
@@ -228,7 +348,7 @@ hold the applicable mapping parameters.
} EPS_map_level;
The structure EPS_map_level is accessed in 2/fi, 4/rem.
-
§5. The following are the directions at which arrows for UP, DOWN, IN and OUT
+
§11. The following are the directions at which arrows for UP, DOWN, IN and OUT
are drawn on EPS maps.
@@ -238,119 +358,6 @@ are drawn on EPS maps.
vectorIN_vector_EPS = {3, 2, 0};vectorOUT_vector_EPS = {-3, -2, 0};
-
§6. Map parameters. We convert a parameter's name to its index in the list; slowly, but that
-doesn't matter.
-
§8. The following sets a parameter to a given value (the string value if that's
-non-NULL, the number value otherwise), for a particular scope: this is
-slightly wastefully specified either as a map_parameter_scope object,
-or as a single room, or as a single region, or as a kind of room or region.
-If all are null, then the global scope is used.
-
@@ -500,8 +521,8 @@ on — come from here.
defineMAX_EPS_ABBREVIATED_LENGTHMAX_EPS_TEXT_LENGTH
-voidRenderEPSMap::plot_text_at(OUTPUT_STREAM, text_stream *text_to_plot, faux_instance *I, intabbrev_to,
-text_stream *font, intx, inty, intpointsize, intcentre_h, intcentre_v) {
+voidRenderEPSMap::plot_text_at(OUTPUT_STREAM, text_stream *text_to_plot, faux_instance *I,
+intabbrev_to, text_stream *font, intx, inty, intpointsize, intcentre_h, intcentre_v) {TEMPORARY_TEXT(txt)if (text_to_plot) {WRITE_TO(txt, "%S", text_to_plot);
@@ -509,7 +530,8 @@ on — come from here.
Try taking the name from the printed name property of the room3.1;If that fails, try taking the name from its source text name3.2; } elsereturn;
-RenderEPSMap::plot_stream_at(OUT, txt, I, abbrev_to, font, x, y, pointsize, centre_h, centre_v);
+RenderEPSMap::plot_stream_at(OUT, txt, I, abbrev_to, font, x, y, pointsize,
+centre_h, centre_v);DISCARD_TEXT(txt)}
@@ -536,8 +558,9 @@ on — come from here.
§4.
-voidRenderEPSMap::plot_stream_at(OUTPUT_STREAM, text_stream *text_to_plot, faux_instance *I, intabbrev_to,
-text_stream *font, intx, inty, intpointsize, intcentre_h, intcentre_v) {
+voidRenderEPSMap::plot_stream_at(OUTPUT_STREAM, text_stream *text_to_plot,
+faux_instance *I, intabbrev_to, text_stream *font, intx, inty, intpointsize,
+intcentre_h, intcentre_v) {TEMPORARY_TEXT(txt)Str::copy(txt, text_to_plot);Abbreviate the text to be printed by stripping dispensable letters4.1;
@@ -577,8 +600,8 @@ is "PsyNn".
-voidRenderEPSMap::EPS_compile_header(OUTPUT_STREAM, intbounding_box_width, intbounding_box_height,
-text_stream *default_font, intdefault_point_size) {
+voidRenderEPSMap::EPS_compile_header(OUTPUT_STREAM, intbounding_box_width,
+intbounding_box_height, text_stream *default_font, intdefault_point_size) {WRITE("%%!PS-Adobe EPSF-3.0\n");WRITE("%%%%BoundingBox: 0 0 %d %d\n", bounding_box_width, bounding_box_height);WRITE("%%%%IncludeFont: %S\n", default_font);
@@ -598,7 +621,8 @@ closed (joined up back to the start position) with a WRITE("closepath\n");}
-voidRenderEPSMap::EPS_compile_rectangular_path(OUTPUT_STREAM, intx0, inty0, intx1, inty1) {
+voidRenderEPSMap::EPS_compile_rectangular_path(OUTPUT_STREAM, intx0, inty0,
+intx1, inty1) {WRITE("%d %d moveto %% bottom left corner\n", x0, y0);WRITE("%d %d lineto %% bottom side\n", x1, y0);WRITE("%d %d lineto %% right side\n", x1, y1);
@@ -610,15 +634,19 @@ closed (joined up back to the start position) with a
@@ -297,7 +297,7 @@ adjacent icons representing the same exit. Thus the east side icon of
one room may need to be married up with the west side icon of the
adjacent room, and so on. The four by four cornices diagonally in
between rooms require special care. To plot a northeast exit blocked by
-a 2-sided door, for faux_instance, requires all four icons to be plotted, but
+a 2-sided door, for instance, requires all four icons to be plotted, but
we need to be careful in case the two icons not occupied by the exit are
needed for something else (if a northwest exit crossed over it, for
faux_instance).
@@ -309,7 +309,7 @@ vector to one of its eight neighbouring cell positions on the map. If
§3. So now the vector \(BL\) represents the bottom left cell (i.e., the southwestern
@@ -402,7 +402,7 @@ map connection (are "used"), and two are off-diagonal (are "unused").
-voidPL::HTMLMap::correct_diagonal(vectorBL, intSW_to_NE) {
+voidHTMLMap::correct_diagonal(vectorBL, intSW_to_NE) {intpos_00, corner icon position of lower cell used by the map connectionpos_01, corner icon position of lower cell not used by the map connectionpos_10, corner icon position of upper cell not used by the map connection
@@ -493,19 +493,19 @@ it consists, in the end, of tessalations of rectangles.
intmap_tables_begun = 2;
-voidPL::HTMLMap::begin_variable_width_table(OUTPUT_STREAM) {
+voidHTMLMap::begin_variable_width_table(OUTPUT_STREAM) {Include some indentation for a new map table4.2;map_tables_begun++;HTML::begin_html_table(OUT, NULL, FALSE, 0, 0, 0, 0, 0);}
-voidPL::HTMLMap::begin_map_table(OUTPUT_STREAM, intwidth, intheight) {
+voidHTMLMap::begin_map_table(OUTPUT_STREAM, intwidth, intheight) {Include some indentation for a new map table4.2;map_tables_begun++;HTML::begin_html_table(OUT, NULL, FALSE, 0, 0, 0, height, width);}
-voidPL::HTMLMap::begin_variable_width_table_with_background(OUTPUT_STREAM, char *bg_image) {
+voidHTMLMap::begin_variable_width_table_with_background(OUTPUT_STREAM, char *bg_image) {Include some indentation for a new map table4.2;map_tables_begun++;HTML::begin_html_table_bg(OUT, NULL, FALSE, 0, 0, 0, 0, 0, bg_image);
@@ -515,7 +515,7 @@ it consists, in the end, of tessalations of rectangles.
-voidPL::HTMLMap::end_map_table(OUTPUT_STREAM) {
+voidHTMLMap::end_map_table(OUTPUT_STREAM) {map_tables_begun--;Include some indentation for a new map table4.2;HTML::end_html_table(OUT);
@@ -536,11 +536,11 @@ when it hovers for long enough over the icon.
§8. Single-room submaps. The following provides the "details" portion of the World index: there
@@ -742,7 +745,8 @@ that the grids are calculated, the region colours decided, and so on.
-voidPL::HTMLMap::render_single_room_as_HTML(OUTPUT_STREAM, faux_instance *R) {
+voidHTMLMap::render_single_room_as_HTML(OUTPUT_STREAM, faux_instance *R,
+localisation_dictionary *LD) {WRITE("\n\n");HTML_OPEN("p");IndexUtilities::anchor(OUT, R->anchor_text);
@@ -750,11 +754,11 @@ that the grids are calculated, the region colours decided, and so on.
HTML::begin_plain_html_table(OUT);HTML::first_html_column(OUT, 0);vectorP = Room_position(R);
-PL::HTMLMap::plot_map_level(OUT, P.x, P.x, P.y, P.y, P.z, 2);
+HTMLMap::plot_map_level(OUT, P.x, P.x, P.y, P.y, P.z, 2, LD);HTML::next_html_column(OUT, 0);WRITE(" ");HTML::next_html_column(OUT, 0);
-MapElement::index(OUT, R, 1, FALSE);
+MapElement::index(OUT, R, 1, FALSE, LD);HTML::end_html_row(OUT);HTML::end_html_table(OUT);HTML_CLOSE("p");
@@ -767,7 +771,8 @@ index page.
@@ -994,7 +999,7 @@ There are 15 possibilities, and their icons are named as the following shows:
HTML_OPEN("td");intbits = (icon_grid[ICON_GRID_POS(P, 2, 2)]) & LONGS_BITMAP;if (bits == 0)
-PL::HTMLMap::index_room_square(OUT, room_grid[ROOM_GRID_POS(P)], pass);
+HTMLMap::index_room_square(OUT, room_grid[ROOM_GRID_POS(P)], pass);else {TEMPORARY_TEXT(icon_name)WRITE_TO(icon_name, "long");
@@ -1002,7 +1007,7 @@ There are 15 possibilities, and their icons are named as the following shows:
if (bits & LONGNS_MAPBIT) WRITE_TO(icon_name, "_ns");if (bits & LONGSWNE_MAPBIT) WRITE_TO(icon_name, "_swne");if (bits & LONGNWSE_MAPBIT) WRITE_TO(icon_name, "_nwse");
-PL::HTMLMap::plot_map_icon(OUT, icon_name);
+HTMLMap::plot_map_icon(OUT, icon_name);DISCARD_TEXT(icon_name) }HTML_CLOSE("td");
@@ -1014,21 +1019,21 @@ There are 15 possibilities, and their icons are named as the following shows:
@@ -1186,15 +1200,15 @@ which are bordered and coloured single-cell tables.
defineROOM_TEXT_COLOUR"000000"
-voidPL::HTMLMap::index_room_square(OUTPUT_STREAM, faux_instance *I, intpass) {
+voidHTMLMap::index_room_square(OUTPUT_STREAM, faux_instance *I, intpass) {if (I) {intb = ROOM_BORDER_SIZE;if ((I == FauxInstances::benchmark()) && (pass == 1)) b = B_ROOM_BORDER_SIZE;HTML_OPEN_WITH("table","border=\"%d\" cellpadding=\"0\" cellspacing=\"0\" "
-"bordercolor=\"#%s\" width=\"%d\" height=\"%d\" "
-"title=\"%S\"",
-b, ROOM_BORDER_COLOUR, MAP_CELL_INNER_SIZE, MAP_CELL_INNER_SIZE, FauxInstances::get_name(I));
+"bordercolor=\"#%s\" width=\"%d\" height=\"%d\" title=\"%S\"",
+b, ROOM_BORDER_COLOUR, MAP_CELL_INNER_SIZE, MAP_CELL_INNER_SIZE,
+FauxInstances::get_name(I));HTML_OPEN("tr");HTML_OPEN_WITH("td", "valign=\"middle\" align=\"center\" bgcolor=\"#%S\"",I->fimd.colour);
@@ -1244,7 +1258,7 @@ This is the chip shown on the "details" box for a room in the World Index.
-voidPL::HTMLMap::colour_chip(OUTPUT_STREAM, faux_instance *I, faux_instance *Reg, intat) {
+voidHTMLMap::colour_chip(OUTPUT_STREAM, faux_instance *I, faux_instance *Reg, intat) {HTML_OPEN_WITH("table","border=\"%d\" cellpadding=\"0\" cellspacing=\"0\" ""bordercolor=\"#%s\" height=\"%d\"",
@@ -1267,16 +1281,16 @@ that nothing is shown if all of the rooms are outside of regions.
The structure vector is accessed in 4/sm, 4/rhm, 4/rem and here.
-
§2. Some useful constant vectors, including those pointing in each direction.
-Note that these are not of unit length — rather, they are the ideal grid
-offsets on the map we will eventually draw.
+
§2. Some useful constant vectors:
@@ -108,7 +106,10 @@ offsets on the map we will eventually draw.
returnZero_vector;}
-
§3.
+
§3. Now for vectors pointing in each direction. Note that not all of these are of
+unit length — rather, they are the ideal grid offsets on the map we will
+eventually draw.
+
vectorN_vector = {0, 1, 0};
diff --git a/docs/index-module/4-sm.html b/docs/index-module/4-sm.html
index df7a001c5..664d4b351 100644
--- a/docs/index-module/4-sm.html
+++ b/docs/index-module/4-sm.html
@@ -180,7 +180,7 @@ This is usually the room in which the player begins.
-intPL::SpatialMap::benchmark_level(void) {
+intSpatialMap::benchmark_level(void) {if (FauxInstances::benchmark() == NULL) return0;returnRoom_position(FauxInstances::benchmark()).z;}
@@ -231,7 +231,7 @@ to get the results in time to write them in the story file.
intspatial_coordinates_established = FALSE;intpartitioned_into_components = FALSE;
-voidPL::SpatialMap::establish_spatial_coordinates(void) {
+voidSpatialMap::establish_spatial_coordinates(void) {if (spatial_coordinates_established) return;faux_instance_set *faux_set = InterpretIndex::get_faux_instances();Universe = Geometry::empty_cuboid();
@@ -253,13 +253,13 @@ will be using the following:
§7.11. Along-lattice directions are those which (a) are mappable, and (b) involve
@@ -432,8 +432,8 @@ not necessarily vice versa.
-intPL::SpatialMap::direction_is_along_lattice(intstory_direction) {
-vectorD = PL::SpatialMap::direction_as_vector(story_direction);
+intSpatialMap::direction_is_along_lattice(intstory_direction) {
+vectorD = SpatialMap::direction_as_vector(story_direction);if (Geometry::vec_eq(D, Zero_vector)) returnFALSE;returnTRUE;}
@@ -459,7 +459,7 @@ will be plotted with an icon at cell \((4, 2)\).
-voidPL::SpatialMap::cell_position_for_direction(intstory_direction, int *mx, int *my) {
+voidSpatialMap::cell_position_for_direction(intstory_direction, int *mx, int *my) { *mx = 0; *my = 0;if ((story_direction < 0) || (story_direction >= MAX_DIRECTIONS)) return;intpage_direction = story_dir_to_page_dir[story_direction];
@@ -483,7 +483,7 @@ will be plotted with an icon at cell \((4, 2)\).
-char *PL::SpatialMap::find_icon_label(intstory_direction) {
+char *SpatialMap::find_icon_label(intstory_direction) {if ((story_direction < 0) || (story_direction >= MAX_DIRECTIONS)) returnNULL;intpage_direction = story_dir_to_page_dir[story_direction];switch(page_direction) {
@@ -503,7 +503,7 @@ will be plotted with an icon at cell \((4, 2)\).
returnNULL;}
-char *PL::SpatialMap::usual_Inform_direction_name(intstory_direction) {
+char *SpatialMap::usual_Inform_direction_name(intstory_direction) {if ((story_direction < 0) || (story_direction >= MAX_DIRECTIONS)) return"<none>";intpage_direction = story_dir_to_page_dir[story_direction];switch(page_direction) {
@@ -523,13 +523,14 @@ will be plotted with an icon at cell \((4, 2)\).
return"<none>";}
-
§7.15. Map reading. The map is read in the first faux_instance by the PL::SpatialMap::room_exit
+
§7.15. Map reading. The map is read in the first faux_instance by the SpatialMap::room_exit
routine below, which works out what room the exit leads to, perhaps via a
door, which we take a note of if asked to do so.
-faux_instance *PL::SpatialMap::room_exit(faux_instance *origin, intdir_num, faux_instance **via) {
+faux_instance *SpatialMap::room_exit(faux_instance *origin, intdir_num,
+faux_instance **via) {if (via) *via = NULL;if ((origin == NULL) || (FauxInstances::is_a_room(origin) == FALSE) || (dir_num < 0) || (dir_num >= MAX_DIRECTIONS)) returnNULL;
@@ -549,10 +550,11 @@ door, which we take a note of if asked to do so.
returnultimate_destination;}
-faux_instance *PL::SpatialMap::room_exit_as_indexed(faux_instance *origin, intdir_num, faux_instance **via) {
+faux_instance *SpatialMap::room_exit_as_indexed(faux_instance *origin, intdir_num,
+faux_instance **via) {for (intj=0; j<MAX_DIRECTIONS; j++) {if (story_dir_to_page_dir[j] == dir_num) {
-faux_instance *I = PL::SpatialMap::room_exit(origin, j, via);
+faux_instance *I = SpatialMap::room_exit(origin, j, via);if (I) returnI; } }
@@ -577,13 +579,13 @@ adjudication.
LOOP_OVER_FAUX_ROOMS(faux_set, R) {inti;LOOP_OVER_LATTICE_DIRECTIONS(i) {
-faux_instance *T = PL::SpatialMap::room_exit_as_indexed(R, i, NULL);
+faux_instance *T = SpatialMap::room_exit_as_indexed(R, i, NULL);if (T) Consider this Inform map connection for a spatial relationship7.16.1; } }
§7.16.1. We first find a spread of nearly opposite directions: for faux_instance, if i
+
§7.16.1. We first find a spread of nearly opposite directions: for instance, if i
is northeast, then back is SW, cw is W, cwcw is NW, ccw is S, ccwccw
is SE. We also find the backstep, the room you get to if trying to go back
from the destination in the back direction; which in a nicely arranged
@@ -602,13 +604,13 @@ position the rooms.)
§9. The spatial relationships arrays are read only by the following. Note
-that PL::SpatialMap::read_smap suppresses relationships between different submaps (at
+that SpatialMap::read_smap suppresses relationships between different submaps (at
least once the initial map components have been set up). This is done to
make it easy and quick to cut up a submap into two sub-submaps; effectively
severing any links between them. All we need do is move the rooms around
from one submap to another.
-
PL::SpatialMap::read_smap_cross has the ability to read relationships which cross submap
+
SpatialMap::read_smap_cross has the ability to read relationships which cross submap
boundaries, and will be needed when we place submaps on the global grid.
-faux_instance *PL::SpatialMap::read_smap(faux_instance *from, intdir) {
+faux_instance *SpatialMap::read_smap(faux_instance *from, intdir) {if (from == NULL) internal_error("tried to read smap at null room");drognas_spent++;faux_instance *to = from->fimd.spatial_relationship[dir];
@@ -747,10 +749,10 @@ boundaries, and will be needed when we place submaps on the global grid.
returnto;}
-faux_instance *PL::SpatialMap::read_smap_cross(faux_instance *from, intdir) {
+faux_instance *SpatialMap::read_smap_cross(faux_instance *from, intdir) {if (from == NULL) internal_error("tried to read smap at null room");drognas_spent++;
-faux_instance *to = PL::SpatialMap::room_exit(from, dir, NULL);
+faux_instance *to = SpatialMap::room_exit(from, dir, NULL);returnto;}
@@ -758,7 +760,7 @@ boundaries, and will be needed when we place submaps on the global grid.
-faux_instance *PL::SpatialMap::read_slock(faux_instance *from, intdir) {
+faux_instance *SpatialMap::read_slock(faux_instance *from, intdir) {if (from == NULL) internal_error("tried to read slock at null room");drognas_spent++;returnfrom->fimd.lock_exits[dir];
@@ -768,7 +770,7 @@ boundaries, and will be needed when we place submaps on the global grid.
-connected_submap *PL::SpatialMap::new_submap(void) {
+connected_submap *SpatialMap::new_submap(void) {connected_submap *sub = CREATE(connected_submap);sub->bounds = Geometry::empty_cuboid();sub->first_room_in_submap = NULL;
@@ -794,7 +796,7 @@ room to a submap takes constant time with respect to the number of rooms \(R\).
-voidPL::SpatialMap::add_room_to_submap(faux_instance *R, connected_submap *sub) {
+voidSpatialMap::add_room_to_submap(faux_instance *R, connected_submap *sub) {if (sub->last_room_in_submap == NULL) {sub->last_room_in_submap = R;sub->first_room_in_submap = R;
@@ -804,7 +806,7 @@ room to a submap takes constant time with respect to the number of rooms \(R\).
}R->fimd.submap = sub;R->next_room_in_submap = NULL;
-PL::SpatialMap::add_room_to_cache(sub, Room_position(R), 1);
+SpatialMap::add_room_to_cache(sub, Room_position(R), 1);}
§13. Here is how we read from the incidence cache. Its purpose is to provide
@@ -822,7 +824,7 @@ resized as the rooms in the submap move around, which complicates things.
-intPL::SpatialMap::occupied_in_submap(connected_submap *sub, vectorP) {
+intSpatialMap::occupied_in_submap(connected_submap *sub, vectorP) {inti = Geometry::cuboid_index(P, sub->incidence_cache_bounds);if (i < 0) return0;returnsub->incidence_cache[i];
@@ -833,9 +835,9 @@ routine must be notified of any such:
§7.24. The following grows a component outwards from at, so that it also includes
@@ -1024,26 +1027,27 @@ all rooms locked to at
component, we start a new submap to hold it.
-
Note that PL::SpatialMap::create_map_component_around has constant running time, i.e., it
+
Note that SpatialMap::create_map_component_around has constant running time, i.e., it
doesn't depend on \(R\), the number of rooms. It is called exactly once for
each room, so phase (2) has running time \(O(R)\).
§7.26. Synchronising movements of locked rooms. The next preliminary we need is the implementation of locking. As we've seen,
@@ -1073,24 +1077,24 @@ corresponding positions.
§7.28. Positioning within components. This is much more difficult. It's going to be a matter of minimising the
@@ -1130,9 +1134,9 @@ the loop over submaps doesn't therefore add to the running time.
inttotal_accuracy = 0;LOOP_OVER(sub, connected_submap) {LOGIF(SPATIAL_MAP, "Laying out component %d\n", sub->allocation_id);
-PL::SpatialMap::lock_positions_in_submap(sub); \(O(R)\) running time
-PL::SpatialMap::establish_natural_lengths(sub); \(O(R)\) running time
-PL::SpatialMap::position_submap(sub);
+SpatialMap::lock_positions_in_submap(sub); \(O(R)\) running time
+SpatialMap::establish_natural_lengths(sub); \(O(R)\) running time
+SpatialMap::position_submap(sub);total_accuracy += sub->heat;LOGIF(SPATIAL_MAP, "Component %d has final heat %d\n", sub->allocation_id, sub->heat); }
@@ -1155,12 +1159,12 @@ can have it. Initially, all SRs have length 1.
-voidPL::SpatialMap::establish_natural_lengths(connected_submap *sub) {
+voidSpatialMap::establish_natural_lengths(connected_submap *sub) {faux_instance *R;LOOP_OVER_SUBMAP(R, sub) {inti;LOOP_OVER_LATTICE_DIRECTIONS(i) {
-if (PL::SpatialMap::read_smap(R, i))
+if (SpatialMap::read_smap(R, i))R->fimd.exit_lengths[i] = 1;elseR->fimd.exit_lengths[i] = -1;
@@ -1190,12 +1194,12 @@ even in submaps at this unthinkably hot level.
temperature is CHERYL_COLE, but I think I'll call it FUSION_POINT.
-
-intPL::SpatialMap::heat_sum(inth1, inth2) {
+intSpatialMap::heat_sum(inth1, inth2) {inth = h1+h2;if (h > FUSION_POINT) returnFUSION_POINT;returnh;
@@ -1203,26 +1207,26 @@ temperature is CHERYL_COLE
§18. Finding the heat of a submap runs in \(O(S)\) time, where \(S\) is the number
of rooms in the submap; this is the point of having the incidence cache,
-without which it would be \(O(S^2)\). Even so, we will try to make \(S\) a lot
+without which it would be \(O(S^2)\). (Even so, we will try to make \(S\) a lot
smaller than \(R\).)
§22.1.4. The zone-1 rooms are now correctly placed with respect to each other, and
@@ -1508,7 +1513,7 @@ sliding taking up about 80 percent of our time, which is unacceptable.
§23. Finding how to divide. That completes the logic for how we divide and conquer the submaps, except,
@@ -1571,17 +1576,17 @@ of the larger zone compared to the smaller zone; we want to minimise this.)
Here is the basic idea. We will recursively spread a generation count out
into the submap, with the first room (first below) belonging to generation 1.
We'll use the zone field to store this, since it's an integer attached to
-each room which isn't yet in use. PL::SpatialMap::assign_generation_count is recursively
+each room which isn't yet in use. SpatialMap::assign_generation_count is recursively
called so that it visits each room exactly once, and increases the generation
on each call. Thus a line of rooms from first would have generations 1, 2,
-3, ... When PL::SpatialMap::assign_generation_count finds a connection from its current
+3, ... When SpatialMap::assign_generation_count finds a connection from its current
position to a room with a lower generation, we say that there's a "contact".
What makes the routine so effective is that it returns a great deal of data
about the high-spots of the history after it was called. The mechanism for
this, though, is that the caller has to set up a pile of arrays, and then
-pass pointers to PL::SpatialMap::assign_generation_count; on its exit, the arrays are
+pass pointers to SpatialMap::assign_generation_count; on its exit, the arrays are
then populated with answers.
@@ -1596,7 +1601,7 @@ cut if any exists.
The guarantees are void in a small number of cases where locks have been
-applied: for faux_instance, if the entire submap is locked together, nothing can
+applied: for instance, if the entire submap is locked together, nothing can
ever be cut. Should that happen, the user will find that the map-maker may
run slowly; it's his own fault.
@@ -1608,7 +1613,7 @@ run slowly; it's his own fault.
defineCLIPBOARD_SIZE3 a term to be explained below
-intPL::SpatialMap::work_out_optimal_cutpoint(connected_submap *sub,
+intSpatialMap::work_out_optimal_cutpoint(connected_submap *sub,faux_instance **from, faux_instance **to, int *way,faux_instance **from2, faux_instance **to2, int *way2) {faux_instance *first = NULL; intsize = 0;
@@ -1626,7 +1631,7 @@ run slowly; it's his own fault.
faux_instance *outer_contact_from[CLIPBOARD_SIZE], *outer_contact_to[CLIPBOARD_SIZE];Initialise all this cutpoint search workspace23.2;
-PL::SpatialMap::assign_generation_count(first, NULL, size,
+SpatialMap::assign_generation_count(first, NULL, size,best_spread,best_from1, best_to1, best_dir1,best_from2, best_to2, best_dir2,
@@ -1708,7 +1713,7 @@ the time it takes.
}
§24. The return value of PL::SpatialMap::assign_generation_count is the number of rooms which
+
§24. The return value of SpatialMap::assign_generation_count is the number of rooms which
it, and its recursive incarnations, visit in total. But as noted above, it
also records data in the arrays it is passed pointers to; that's what the
last eleven arguments are for. Otherwise: at is the room we are currently at,
@@ -1717,7 +1722,7 @@ call; size is t
What this leaves is cases where T_generation is zero, that is, where
-T is a room with no generation count. This ensures PL::SpatialMap::assign_generation_count
+T is a room with no generation count. This ensures SpatialMap::assign_generation_count
is called at most once on each room.
§27. Zones 1 and 2 for a double cut. This is more or less the same, but simpler, since it can't determine whether
@@ -2040,28 +2046,28 @@ we've chosen the cuts correctly, so doesn't even try.
§30. The cooling tactic. The whole universe was in a hot dense state: as we begin each component,
@@ -2132,13 +2138,13 @@ if \(S\) grows. So my guess is that cooling is \(O(S)\) in practice.
no locks, and no multiple exits between pairs of rooms A to B, then cooling
is guaranteed to find a perfect (heat 0) grid positioning if one exists.
There are plenty of Inform projects for which that happens: "Bronze",
-for faux_instance, has a single component of 55 rooms, and one round of cooling
+for instance, has a single component of 55 rooms, and one round of cooling
reduces this to absolute zero.
-voidPL::SpatialMap::cool_component_from(connected_submap *sub, faux_instance *R) {
+voidSpatialMap::cool_component_from(connected_submap *sub, faux_instance *R) {if (R->fimd.cooled) return;R->fimd.cooled = TRUE;
@@ -2192,8 +2198,8 @@ can only be cooled once in a given round.
§33. The quenching tactic. After the age of cooling, we can expect the universe to be mostly cold, but
@@ -2306,8 +2312,9 @@ on large connected submaps.
@@ -2611,8 +2618,8 @@ is so high that this is unlikely to be an issue.
defineMAX_EXPLOSION_DISTANCE3
-voidPL::SpatialMap::explode_submap(connected_submap *sub) {
-intinitial_heat = PL::SpatialMap::find_submap_heat(sub), initial_spending = drognas_spent;
+voidSpatialMap::explode_submap(connected_submap *sub) {
+intinitial_heat = SpatialMap::find_submap_heat(sub), initial_spending = drognas_spent;LOGIF(SPATIAL_MAP, "\nTACTIC: Exploding submap %d: initial heat %d\n",sub->allocation_id, sub->heat);intkeep_trying = TRUE, moves = 0;
@@ -2621,7 +2628,7 @@ is so high that this is unlikely to be an issue.
faux_instance *R;LOOP_OVER_SUBMAP(R, sub) {vectorAt = Room_position(R);
-if (PL::SpatialMap::occupied_in_submap(sub, At) >= 2) {
+if (SpatialMap::occupied_in_submap(sub, At) >= 2) {LOGIF(SPATIAL_MAP, "Collision: pushing $O away\n", R);intx, y, coldest = FUSION_POINT;vectorColdest = Geometry::vec(MAX_EXPLOSION_DISTANCE + 1, 0, 0);
@@ -2629,13 +2636,13 @@ is so high that this is unlikely to be an issue.
for (y = -MAX_EXPLOSION_DISTANCE; y<=MAX_EXPLOSION_DISTANCE; y++)if ((x != 0) || (y != 0)) {vectorV = Geometry::vec_plus(At, Geometry::vec(x, y, 0));
-if (PL::SpatialMap::occupied_in_submap(sub, V) == 0) {
-PL::SpatialMap::move_room_to(R, V);
-inth = PL::SpatialMap::find_submap_heat(sub);
+if (SpatialMap::occupied_in_submap(sub, V) == 0) {
+SpatialMap::move_room_to(R, V);
+inth = SpatialMap::find_submap_heat(sub);if (h < coldest) { Coldest = V; coldest = h; } } }
-PL::SpatialMap::move_room_to(R, Geometry::vec_plus(At, Coldest));
+SpatialMap::move_room_to(R, Geometry::vec_plus(At, Coldest));LOGIF(SPATIAL_MAP, "Moving $O to blank offset (%d,%d,%d) for heat %d\n",R, Coldest.x, Coldest.y, Coldest.z, coldest);keep_trying = TRUE;
@@ -2644,7 +2651,7 @@ is so high that this is unlikely to be an issue.
} } }
-PL::SpatialMap::find_submap_heat(sub);
+SpatialMap::find_submap_heat(sub);LOGIF(SPATIAL_MAP, "Exploding submap %d done after %d move(s): ""cooled by %d at cost of %d drognas\n",sub->allocation_id, moves,
@@ -2656,7 +2663,7 @@ is so high that this is unlikely to be an issue.
bodies, but still have to establish their spatial relationship to each
other. We ensure that the components do not overlap by the crude method of
making their bounding cuboids disjoint, even though this will often mean
-that there is wasted space on the page. (Thus we do not, for faux_instance, use
+that there is wasted space on the page. (Thus we do not, for instance, use
the trick adopted by the British Ordnance Survey in mapping the outlying
island of St Kilda on an inset square of what would otherwise be empty
ocean on OS18 "Sound of Harris", despite its being separated by about
@@ -2685,7 +2692,7 @@ ocean on OS18 "Sound of Harris", despite its being separated by about
for (j=ncom-1; j>=0; j--) {sub = sorted[j];if ((sub->positioned == FALSE) &&
- (PL::SpatialMap::no_links_to_placed_components(sub) == 1)) {
+ (SpatialMap::no_links_to_placed_components(sub) == 1)) {Position this map component in space7.31.1; } }
@@ -2701,9 +2708,9 @@ ocean on OS18 "Sound of Harris", despite its being separated by about
§37. The following means the components are sorted in descending size order,
@@ -2829,7 +2836,7 @@ contain.
-intPL::SpatialMap::compare_components(constvoid *ent1, constvoid *ent2) {
+intSpatialMap::compare_components(constvoid *ent1, constvoid *ent2) {constconnected_submap *mc1 = *((constconnected_submap **) ent1);constconnected_submap *mc2 = *((constconnected_submap **) ent2);intd = mc2->bounds.population - mc1->bounds.population;
@@ -2859,13 +2866,13 @@ component; the second means it has no link at all to any other component.
§41. So, now we have to define our Swiss-army-knife routine to cope with all
@@ -2922,8 +2929,8 @@ rooms connected that way are by definition in the same component.
-intPL::SpatialMap::cross_component_links(connected_submap *sub, faux_instance **outer, faux_instance **inner,
-int *heat, intposnd) {
+intSpatialMap::cross_component_links(connected_submap *sub, faux_instance **outer,
+faux_instance **inner, int *heat, intposnd) {faux_instance_set *faux_set = InterpretIndex::get_faux_instances();intno_links = 0;if (heat) *heat = 0;
@@ -2931,12 +2938,13 @@ rooms connected that way are by definition in the same component.
LOOP_OVER_SUBMAP(R, sub) {intd;LOOP_OVER_NONLATTICE_DIRECTIONS(d) {
-faux_instance *R2 = PL::SpatialMap::read_smap_cross(R, d);
+faux_instance *R2 = SpatialMap::read_smap_cross(R, d);if ((R2) && (R2->fimd.submap != sub)) {if ((posnd == FALSE) || (R2->fimd.submap->positioned)) {no_links++;if (inner) *inner = R; if (outer) *outer = R2;
-if (heat) *heat = PL::SpatialMap::heat_sum(*heat, PL::SpatialMap::find_cross_link_heat(R, R2, d));
+if (heat) *heat = SpatialMap::heat_sum(*heat,
+SpatialMap::find_cross_link_heat(R, R2, d)); } } }
@@ -2946,11 +2954,12 @@ rooms connected that way are by definition in the same component.
if ((posnd) && (S->fimd.submap->positioned == FALSE)) continue;intd;LOOP_OVER_NONLATTICE_DIRECTIONS(d) {
-faux_instance *R2 = PL::SpatialMap::read_smap_cross(S, d);
+faux_instance *R2 = SpatialMap::read_smap_cross(S, d);if ((R2) && (R2->fimd.submap == sub)) {no_links++;if (outer) *outer = S; if (inner) *inner = R2;
-if (heat) *heat = PL::SpatialMap::heat_sum(*heat, PL::SpatialMap::find_cross_link_heat(S, R2, d));
+if (heat) *heat = SpatialMap::heat_sum(*heat,
+SpatialMap::find_cross_link_heat(S, R2, d)); } } }
@@ -2989,7 +2998,8 @@ running time in check.
LOGIF(SPATIAL_MAP, "vdW force between $O and $O\n", R, closest_S);no_links++;if (outer) *outer = closest_S; if (inner) *inner = R;
-if (heat) *heat = PL::SpatialMap::heat_sum(*heat, PL::SpatialMap::find_cross_link_heat(closest_S, R, 3));
+if (heat) *heat = SpatialMap::heat_sum(*heat,
+SpatialMap::find_cross_link_heat(closest_S, R, 3)); } } }
@@ -3004,12 +3014,12 @@ insets — this makes the map line up elegantly.
-
Some of the more complicated indexing tasks need to build data structures cross-referencing the instance packages in the Inter tree: the spatial map, in particular. For convenience, we create faux-instance objects for them, which partly correspond to the instance objects in the original compiler.
+
-
- To deal with vectors and cuboids in a three-dimensional integer lattice.
+ Simple mathematical functions for dealing with vectors and cuboids in a three-dimensional integer lattice.