[IXPhysicalWorld::] Map Element. This section masterminds the creation of the World and Kinds index pages, though it delegates much of the work elsewhere. Though it does belong to core Inform, these indexes will look pretty sparse if the spatial Plugins aren't plugged in. @h The World page. = int suppress_panel_changes = FALSE; void IXPhysicalWorld::render(OUTPUT_STREAM, int test_only) { PL::SpatialMap::initialise_page_directions(); IXInstances::make_faux(); PL::SpatialMap::establish_spatial_coordinates(); if (test_only) { PL::SpatialMap::perform_map_internal_test(OUT); } else { PL::HTMLMap::render_map_as_HTML(OUT); PL::HTMLMap::add_region_key(OUT); IXBackdrops::index_object_further(OUT, NULL, 0, FALSE, 1); Index::anchor(OUT, I"MDETAILS"); int unruly = FALSE; @; @; @; @; } } @ = faux_instance *I; LOOP_OVER_OBJECTS(I) if ((IXSpatial::no_detail_index(I)) || (IXInstances::is_a_direction(I))) IXInstances::increment_indexing_count(I); @ = faux_instance *reg; LOOP_OVER_OBJECTS(reg) if (IXInstances::is_a_region(reg)) { int subheaded = FALSE; IXInstances::increment_indexing_count(reg); faux_instance *rm; LOOP_OVER_ROOMS(rm) if (IXInstances::region_of(rm) == reg) { if (subheaded == FALSE) { @; @; IXBackdrops::index_object_further(OUT, reg, 0, FALSE, 2); HTML_OPEN("p"); subheaded = TRUE; } PL::HTMLMap::render_single_room_as_HTML(OUT, rm); IXInstances::increment_indexing_count(rm); } } @ = WRITE("The %S region", IXInstances::get_name(reg)); faux_instance *within = IXInstances::region_of(reg); if (within) WRITE(" within the %S region", IXInstances::get_name(within)); WRITE(""); @ = faux_instance *I; LOOP_OVER_ROOMS(I) if (IXInstances::indexed_yet(I) == FALSE) { @; PL::HTMLMap::render_single_room_as_HTML(OUT, I); } @ By this point we've accounted for rooms (and their contents and any parts thereof), directions (which we excluded), regions (ditto), and the player object (which the Player plugin put in the right place). The only remainder will be things which are offstage (and their contents and any parts thereof): @ = int out_of_play_count = 0; faux_instance *I; LOOP_OVER_OBJECTS(I) if ((IXInstances::indexed_yet(I) == FALSE) && (IXInstances::progenitor(I) == NULL)) { @; if (++out_of_play_count == 1) { suppress_panel_changes = TRUE; WRITE("Nowhere (that is, initially not in any room):"); HTML_TAG("br"); } IXPhysicalWorld::index(OUT, I, 2, FALSE); } suppress_panel_changes = FALSE; @ = if ((unruly) && (suppress_panel_changes == FALSE)) HTML_TAG("hr"); unruly = TRUE; @h Indexing individual objects. @default MAX_OBJECT_INDEX_DEPTH 10000 = faux_instance *indexing_room = NULL; int xtras_count = 0; faux_instance *IXPhysicalWorld::room_being_indexed(void) { return indexing_room; } void IXPhysicalWorld::set_room_being_indexed(faux_instance *I) { indexing_room = I; } void IXPhysicalWorld::index(OUTPUT_STREAM, faux_instance *I, int depth, int details) { if (depth == MAX_OBJECT_INDEX_DEPTH) internal_error("MAX_OBJECT_INDEX_DEPTH exceeded"); if (I) { if (depth > NUMBER_CREATED(faux_instance) + 1) return; /* to recover from errors */ IXInstances::increment_indexing_count(I); if (IXInstances::is_a_room(I)) indexing_room = I; } @; int xtra = -1; if (I) xtra = xtras_count++; if (xtra >= 0) Index::extra_link(OUT, xtra); @; if (I) @; @; @; if (details) @; if (xtra >= 0) { Index::extra_div_open(OUT, xtra, depth+1, "e0e0e0"); @; @; @; IXPhysicalWorld::index_usages(OUT, I); Index::extra_div_close(OUT, "e0e0e0"); } @; } @ = if (details) { HTML::open_indented_p(OUT, depth, "halftight"); if (I != indexing_room) Index::anchor(OUT, I->anchor_text); } else { #ifdef IF_MODULE if (I) IXSpatial::index_spatial_relationship(OUT, I); #endif } @ = if (details) HTML_CLOSE("p"); @ = @; @ = TEMPORARY_TEXT(name) IXInstances::write_name(name, I); if ((Str::len(name) == 0) && (I)) IXInstances::write_kind(name, I); if (Str::len(name) == 0) { WRITE("nameless"); } else { int embolden = details; if (IXInstances::is_a_room(I)) embolden = TRUE; if (embolden) WRITE(""); WRITE("%S", name); if (embolden) WRITE(""); if (details) @; } @ = if (I) { WRITE(", a kind of "); IXInstances::write_kind(OUT, I); } @ = if ((IXMap::annotate_in_World_index(OUT, I) == FALSE) && (IXPlayer::annotate_in_World_index(OUT, I) == FALSE)) { if (I->specify_kind) { WRITE(" - "); IXInstances::write_kind(OUT, I); WRITE(""); } } @ = if (I->created_at > 0) Index::link(OUT, I->created_at); @ This either recurses down through subkinds or through the spatial hierarchy. @ = #ifdef IF_MODULE IXSpatial::index_object_further(OUT, I, depth, details); #endif @ = HTML::open_indented_p(OUT, depth, "tight"); text_stream *material = Metadata::read_optional_textual(I->package, I"^brief_inferences"); WRITE("%S", material); @ = HTML::open_indented_p(OUT, 1, "tight"); IXInstances::write_kind_chain(OUT, I); if (I->kind_set_at > 0) Index::link(OUT, I->kind_set_at); WRITE(" > "); IXInstances::write_name(OUT, I); WRITE(""); HTML_CLOSE("p"); @ = text_stream *material = Metadata::read_optional_textual(I->package, I"^specific_inferences"); WRITE("%S", material); @ = IXMap::add_to_World_index(OUT, I); IXRegions::add_to_World_index(OUT, I); IXSpatial::add_to_World_index(OUT, I); @ = void IXPhysicalWorld::index_usages(OUTPUT_STREAM, faux_instance *I) { int k = 0; inter_package *pack = I->package; inter_tree_node *P = Metadata::read_optional_list(pack, I"^backdrop_presences"); if (P) { int offset = DATA_CONST_IFLD; while (offset < P->W.extent) { inter_ti v1 = P->W.data[offset], v2 = P->W.data[offset+1]; if (v1 == LITERAL_IVAL) { k++; if (k == 1) { HTML::open_indented_p(OUT, 1, "tight"); WRITE("mentioned in rules: "); } else WRITE("; "); Index::link(OUT, (int) v2); } else internal_error("malformed usage metadata"); offset += 2; } } if (k > 0) HTML_CLOSE("p"); }