From b93c8623bc8c4255d8bde022338ec21d91840747 Mon Sep 17 00:00:00 2001 From: fuzzie Date: Wed, 23 Apr 2008 16:35:30 +0000 Subject: [PATCH] fix EDIT to not just call addCarried git-svn-id: svn://openc2e.ccdevnet.org/openc2e/trunk@1812 5a3b5b51-85f2-0310-b56e-886e3cf1dda3 --- PointerAgent.cpp | 8 ++++++++ PointerAgent.h | 2 ++ caosVM_agent.cpp | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/PointerAgent.cpp b/PointerAgent.cpp index 81e8fbe..89e9e8d 100644 --- a/PointerAgent.cpp +++ b/PointerAgent.cpp @@ -93,6 +93,9 @@ void PointerAgent::handleEvent(SomeEvent &event) { velx.setInt(event.xrel * 4); vely.setInt(event.yrel * 4); + if (editAgent) + editAgent->moveTo(pointerX(), pointerY()); + // middle mouse button scrolling if (event.button & buttonmiddle) world.camera.moveTo(world.camera.getX() - event.xrel, world.camera.getY() - event.yrel, jump); @@ -207,6 +210,11 @@ void PointerAgent::handleEvent(SomeEvent &event) { } } } else if (event.button == buttonright) { + if (editAgent) { + editAgent.clear(); + return; + } + if (world.paused) return; // TODO: wrong? // picking up and dropping are implictly handled by the scripts (well, diff --git a/PointerAgent.h b/PointerAgent.h index 04b79d3..d06ee60 100644 --- a/PointerAgent.h +++ b/PointerAgent.h @@ -38,6 +38,8 @@ public: AgentRef wireOriginAgent; unsigned int wireOriginID; + AgentRef editAgent; + PointerAgent(std::string spritefile); void finishInit(); void firePointerScript(unsigned short event, Agent *src); diff --git a/caosVM_agent.cpp b/caosVM_agent.cpp index 2bc43a6..34c7356 100644 --- a/caosVM_agent.cpp +++ b/caosVM_agent.cpp @@ -1950,12 +1950,11 @@ void caosVM::v_TCAR() { %pragma variants c1 c2 Attach the target agent to the mouse cursor for positioning purposes. - Presently just causes the hand to pick it up. */ void caosVM::c_EDIT() { valid_agent(targ); - world.hand()->addCarried(targ); + world.hand()->editAgent = targ; } /** -- 2.11.4.GIT