[Gtkradiant] CVS: target/targetname collision fixes

Joseph, William gtkradiant@zerowing.idsoftware.com
Wed, 27 Feb 2002 12:13:36 -0000


I've noticed some more issues, after fixing the off-by-one.

Opening q3dm7sample.map with File > Open results in lots of
target/targetnames being re-assigned, so targeting objects are randomly
re-targeted at random other target objects. This is because the code was
added in Map_ImportEntities() which is the single function used by all of
the map open/import functions. The targetname collision issue occurs when
anything is imported (using File->Load or copy/paste), so this is certainly
the right place for collision-resolving stuff.. but i suspect you overlooked
the cases of File->Open and File->Load when testing it.

In Entity_Connect(), g_qeglobals.d_select_count is NOT a reliable way to
track the number of brushes that are selected. Currently the only reliable
way is to count the number of brushes in the selected_brushes list
(annoying... I'm researching a proper selection manager right now).

The reason I didn't implement target/targetname collision detection yet for
the new map module stuff.. is that I don't like the system of
target/targetname at all (the collision problem is caused directly by the
limitations of the target/targetname system).

One way to solve it would be, for objects linked by target/targetname,
internally create separate "link" objects which reference both the targeting
object and the target object. These could be synchronised with the
target/targetname key in the objects on load/save, when objects are deleted,
and when the user wants to edit the keys directly. Collisions could be
resolved much more easily by using these link objects.

Perhaps a simpler way to solve the collusion problem would be to internally
assign every object a unique ID, and then use that unique ID in the
target/targetname keys. IE. when you connect object 73 to object 59, object
73 gets a target value of "object59", and object 59 gets a targetname value
of the same. When you import new objects, you can avoid collisions by
incrementing all of the new objects ID's by the current largest unique
object ID.

-SPoG

-----Original Message-----
From: Joseph, William [mailto:WJoseph@europe.ea.com]
Sent: 27 February 2002 10:36
To: 'gtkradiant@zerowing.idsoftware.com'
Subject: RE: [Gtkradiant] CVS: target/targetname collision fixes


There was an off-by-one bug in the version of the target/targetname
collision fixes I got from cvs yesterday (trunk).
You're reading the entity array backwards from array[numelems] instead of
array[numelems-1]. It causes a crash on loading any map.

-SPoG