diff options
| author | Mittendrein Markus <maxmitti@gmx.net> | 2016-12-14 19:22:31 +0100 |
|---|---|---|
| committer | Mittendrein Markus <maxmitti@gmx.net> | 2016-12-14 19:22:31 +0100 |
| commit | aac6a3ee2ee219b6c320c7ebccb2ac10e7e16485 (patch) | |
| tree | ea26f2684c94242619b2fc1f36f4b4abfa6159e2 /System.c4g/DTSelectionContext.c | |
| parent | 93ddddae60a39f32f33996190be62c700deeb010 (diff) | |
| download | ObjectsAppend-aac6a3ee2ee219b6c320c7ebccb2ac10e7e16485.tar.gz ObjectsAppend-aac6a3ee2ee219b6c320c7ebccb2ac10e7e16485.zip | |
Update
Diffstat (limited to 'System.c4g/DTSelectionContext.c')
| -rw-r--r-- | System.c4g/DTSelectionContext.c | 26 |
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()) |
