---
 lib/wormux/include/WORMUX_action.h |    1 -
 src/include/action_handler.cpp     |   40 ------------------------------------
 src/weapon/grapple.cpp             |   32 +---------------------------
 3 files changed, 2 insertions(+), 71 deletions(-)

diff --git a/lib/wormux/include/WORMUX_action.h 
b/lib/wormux/include/WORMUX_action.h
index 19d0e06..584cc06 100644
--- a/lib/wormux/include/WORMUX_action.h
+++ b/lib/wormux/include/WORMUX_action.h
@@ -103,7 +103,6 @@ public:
     // Special weapon options
     ACTION_WEAPON_CONSTRUCTION,
     ACTION_WEAPON_GNU,
-    ACTION_WEAPON_GRAPPLE,
     ACTION_WEAPON_POLECAT,
     ACTION_WEAPON_SUPERTUX,
 
diff --git a/src/include/action_handler.cpp b/src/include/action_handler.cpp
index 24f5360..18bdc2f 100644
--- a/src/include/action_handler.cpp
+++ b/src/include/action_handler.cpp
@@ -713,45 +713,6 @@ static void Action_Weapon_Gnu (Action *a)
   launcher->ExplosionFromNetwork(pos);
 }
 
-static void Action_Weapon_Grapple (Action *a)
-{
-  Grapple* grapple = dynamic_cast<Grapple*>(&(ActiveTeam().AccessWeapon()));
-  NET_ASSERT(grapple != NULL)
-  {
-    return;
-  }
-
-  int subaction = a->PopInt();
-  switch (subaction) {
-  case Grapple::ATTACH_ROPE:
-    {// attach rope
-      Point2i contact_point = a->PopPoint2i();
-      grapple->AttachRope(contact_point);
-    }
-    break;
-
-  case Grapple::ATTACH_NODE: // attach node
-    {
-      Point2i contact_point = a->PopPoint2i();
-      double angle = a->PopDouble();
-      int sense = a->PopInt();
-      grapple->AttachNode(contact_point, angle, sense);
-    }
-    break;
-
-  case Grapple::DETACH_NODE: // detach last node
-    grapple->DetachNode();
-    break;
-
-  case Grapple::SET_ROPE_SIZE: // update rope size
-    grapple->SetRopeSize(a->PopDouble());
-    break;
-
-  default:
-    ASSERT(false);
-  }
-}
-
 static void Action_Weapon_Polecat (Action *a)
 {
   PolecatLauncher* launcher = 
dynamic_cast<PolecatLauncher*>(&(ActiveTeam().AccessWeapon()));
@@ -1032,7 +993,6 @@ void Action_Handler_Init()
   // Special weapon options
   ActionHandler::GetInstance()->Register (Action::ACTION_WEAPON_CONSTRUCTION, 
"WEAPON_construction", &Action_Weapon_Construction);
   ActionHandler::GetInstance()->Register (Action::ACTION_WEAPON_GNU, 
"WEAPON_gnu", &Action_Weapon_Gnu);
-  ActionHandler::GetInstance()->Register (Action::ACTION_WEAPON_GRAPPLE, 
"WEAPON_grapple", &Action_Weapon_Grapple);
   ActionHandler::GetInstance()->Register (Action::ACTION_WEAPON_POLECAT, 
"WEAPON_polecat", &Action_Weapon_Polecat);
   ActionHandler::GetInstance()->Register (Action::ACTION_WEAPON_SUPERTUX, 
"WEAPON_supertux", &Action_Weapon_Supertux);
 
diff --git a/src/weapon/grapple.cpp b/src/weapon/grapple.cpp
index e2e952b..d078ad5 100644
--- a/src/weapon/grapple.cpp
+++ b/src/weapon/grapple.cpp
@@ -32,7 +32,6 @@
 #include "include/action_handler.h"
 #include "map/camera.h"
 #include "map/map.h"
-#include "network/network.h"
 #include "sound/jukebox.h"
 #include "team/team.h"
 #include "team/teams_list.h"
@@ -226,16 +225,7 @@ bool Grapple::TryAttachRope()
   Point2i contact_point;
   if (find_first_contact_point(pos, angle, length, 4, contact_point))
     {
-      if (!ActiveTeam().IsLocal() && !ActiveTeam().IsLocalAI())
-        return false;
-
-      // The rope reaches the fixation point. Let's fix it !
-      Action* a = new Action(Action::ACTION_WEAPON_GRAPPLE);
-      a->Push(ATTACH_ROPE);
-      a->Push(contact_point);
-      ActionHandler::GetInstance()->NewAction(a);
-
-      MSG_DEBUG("grapple.hook", "Creating ATTACH_GRAPPLE Action");
+      AttachRope(contact_point);
       return true;
     }
 
@@ -288,14 +278,6 @@ bool Grapple::TryAddNode(int CurrentSense)
       // Add a node on the rope and change the fixation point
       AttachNode(contact_point, rope_angle, CurrentSense);
 
-      // Send node addition over the network
-      Action a(Action::ACTION_WEAPON_GRAPPLE);
-      a.Push(ATTACH_NODE);
-      a.Push(contact_point);
-      a.Push(rope_angle);
-      a.Push(CurrentSense);
-      Network::GetInstance()->SendActionToAll(a);
-
       return true;
     }
 
@@ -312,7 +294,7 @@ bool Grapple::TryRemoveNodes(int currentSense)
   double currentAngle = ActiveCharacter().GetRopeAngle();
   Point2i mapRopeStart = ActiveCharacter().GetHandPosition();
 
-  const int max_nodes_per_turn = 100; // safe value to avoid network congestion
+  const int max_nodes_per_turn = 100; // safe value, was used to avoid network 
congestion
   int nodes_to_remove = 0;
 
   TraceResult tr;
@@ -361,10 +343,6 @@ bool Grapple::TryRemoveNodes(int currentSense)
 
      // remove last node
      DetachNode();
-     // Send node suppression over the network
-     Action a(Action::ACTION_WEAPON_GRAPPLE);
-     a.Push(DETACH_NODE);
-     Network::GetInstance()->SendActionToAll(a);
   }
 
   return nodes_to_remove > 0;
@@ -378,9 +356,6 @@ void Grapple::NotifyMove(bool collision)
   if (!IsInUse() || m_attaching)
     return;
 
-  if (!ActiveTeam().IsLocal() && !ActiveTeam().IsLocalAI())
-    return;
-
   // Check if the character collide something.
   if (collision)
     {
@@ -430,9 +405,6 @@ void Grapple::Refresh()
   if (m_attaching)
     TryAttachRope();
 
-  if (!ActiveTeam().IsLocal() && !ActiveTeam().IsLocalAI())
-    return;
-
   if (IsInUse() && !m_attaching)
   {
     ActiveCharacter().SetMovement("ninja-rope");
-- 
1.6.0.4


_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à