summaryrefslogtreecommitdiffstats
path: root/System.c4g/DTSelectionContext.c
diff options
context:
space:
mode:
Diffstat (limited to 'System.c4g/DTSelectionContext.c')
-rw-r--r--System.c4g/DTSelectionContext.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/System.c4g/DTSelectionContext.c b/System.c4g/DTSelectionContext.c
index 794029c..998c6f5 100644
--- a/System.c4g/DTSelectionContext.c
+++ b/System.c4g/DTSelectionContext.c
@@ -52,7 +52,7 @@ func FxIntShowSelectionTimer(object target, int effectNumber)
else
{
var obj = selectionObjects[GetMenuSelection(target)];
- if(!obj)
+ if(!obj || (GetType(obj) == C4V_Array && !obj[0]))
{
if(selectMark)
{
@@ -227,16 +227,29 @@ func AtObjectWithLines()
return !Contained() && FindConnections(true);
}
+global func HasLine(bool lineCheck, object target)
+{
+ if(lineCheck)
+ {
+ return GetProcedure() == "CONNECT" && (GetActionTarget(0) == target || GetActionTarget(1) == target);
+ }
+ else
+ {
+ return FindObject2(Find_Func("HasLine", true, this));
+ }
+}
+
func FindConnections(bool single)
{
- var targets = FindObjects(Find_OCF(OCF_LineConstruct), Find_AtPoint(), Find_Exclude(this));
+ var targets = FindObjects(Find_AtPoint(), Find_Exclude(this), Find_Or(Find_OCF(OCF_LineConstruct), Find_Func("HasLine")));
var connections = [];
for(var target in targets)
{
var lines = FindObjects(Find_Action("Connect"), Find_Or(Find_ActionTarget(target), Find_ActionTarget2(target)));
for(var line in lines)
{
- if(GetID(GetActionTarget(0, line)) == LNKT || GetID(GetActionTarget(1, line)) == LNKT) // not connected on the other side
+ var kit = line->~KitID() || LNKT;
+ if(GetID(GetActionTarget(0, line)) == kit || GetID(GetActionTarget(1, line)) == kit) // not connected on the other side
{
continue;
}
@@ -346,7 +359,7 @@ func RemoveLineEntry(id id, int pos)
return false;
}
- var lnkt = CreateObject(LNKT, 0, 0, GetOwner());
+ var lnkt = CreateObject(connection[1]->~KitID() || LNKT, 0, 0, GetOwner());
Collect(lnkt);
Sound("Connect");
if(GetActionTarget(0, connection[1]) == connection[0])
@@ -366,14 +379,15 @@ func ControlDigDouble()
var ret = _inherited(...);
if(!ret)
{
- if((GetProcedure() == "WALK" || GetProcedure() == "DIG" || GetProcedure() == "SWIM"))
+ if(GetProcedure() == "WALK" || GetProcedure() == "DIG" || GetProcedure() == "SWIM")
{
if(Contents() && Contents()->~Activate(this))
{
return true;
}
- else if((AtTreeToChop() && GetProcedure() != "SWIM") && ContextChop())
+ else if(AtTreeToChop() && GetProcedure() != "SWIM")
{
+ SetAllCursorsCommand(GetController(this), "Chop", FindTree());
return true;
}
else if(AtObjectWithLines())