Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001982Core InformRelationspublic2016-12-29 08:052016-12-29 10:07
Reporterdfremont 
Assigned To 
PrioritynormalSeveritymildReproducibilityalways
StatusconfirmedResolutionopen 
Platformx86OSMac OS XOS Version10.11
Product Version6M62 
Target VersionFixed in Version 
Summary0001982: Regional-containment doesn't relate regions correctly
DescriptionWI 6.11 states that regional-containment allows regions to be "in" regions, but testing the relation between two regions always fails (see the example below). This occurs regardless of how the test is done, using the verbs "in" or "regionally in", or with "R relates X to Y".

The Index does correctly mention one region as being in the other (as long as the inner region contains a room).
Minimal Source Text To Reproduce
Blorp is a region. Zorp is a region in Blorp.
Foo is a room in Zorp.
When play begins: if Zorp is [regionally] in Blorp, say "hooray!"
TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships

-  Notes
(0004635)
zarf (developer)
2016-12-29 09:57

Confirmed.

The TestRegionalContainment() routine has no logic to support the case where obj is a region. It reaches the line

if (~~(obj ofclass K1_room)) obj = LocationOf(obj);

...and LocationOf() always returns "nothing" for regions. Thus the test always returns false.


(0004636)
zarf (developer)
2016-12-29 10:07

I thought this might have been fallout from http://inform7.com/mantis/view.php?id=1501 [^] in 6L38. Nope -- while TestRegionalContainment changed in that fix, this example failed before that.
(0004637)
zarf (developer)
2016-12-29 10:07

Quick cut at a fix:

[ TestRegionalContainment obj region o;
	if ((obj == nothing) || (region == nothing)) rfalse;
	if (obj ofclass K7_backdrop or K4_door) {
		if (obj has absent) rfalse;
		objectloop (o ofclass K1_room)
			if (TestRegionalContainment(o, region))
				if (BackdropLocation(obj, o))
					rtrue;
		rfalse;
	}
	if (obj ofclass K9_region) {
		o = obj;
	}
	else {
		if (~~(obj ofclass K1_room)) obj = LocationOf(obj);
		if (obj == nothing) rfalse;
		o = obj.map_region;
	}
	while (o) {
		if (o == region) rtrue;
		o = parent(o);
	}
	rfalse;
];

- Issue History
Date Modified Username Field Change
2016-12-29 08:05 dfremont New Issue
2016-12-29 09:57 zarf Note Added: 0004635
2016-12-29 09:57 zarf Status new => confirmed
2016-12-29 10:07 zarf Note Added: 0004636
2016-12-29 10:07 zarf Note Added: 0004637


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker