I'm a little bit stressful with that patch, but really, it's a good work 
if game runs good with such a patch!

Have you tested the whole series between 2 wormux instances, one at 
50fps and another one at 10fps ?



Florian Köberle a écrit :
> ---
>  lib/wormux/include/WORMUX_action.h      |    3 -
>  src/ai/ai_movement_module.cpp           |    2 +-
>  src/character/character.cpp             |  164 
> +------------------------------
>  src/character/character.h               |   10 --
>  src/include/action_handler.cpp          |  108 +-------------------
>  src/include/action_handler.h            |    8 --
>  src/interface/man_machine_interface.cpp |    9 +-
>  src/interface/mouse.cpp                 |    7 +-
>  src/object/bonus_box.cpp                |   12 ---
>  src/object/bonus_box.h                  |    2 -
>  src/object/medkit.cpp                   |   12 ---
>  src/object/medkit.h                     |    2 -
>  src/object/objbox.cpp                   |   16 ---
>  src/object/objbox.h                     |    2 -
>  src/object/physical_obj.cpp             |   49 ---------
>  src/object/physical_obj.h               |    4 -
>  src/object/physics.cpp                  |   53 ----------
>  src/object/physics.h                    |    4 -
>  src/team/teams_list.cpp                 |    1 -
>  src/weapon/explosion.cpp                |   89 +----------------
>  src/weapon/explosion.h                  |   11 +--
>  src/weapon/grapple.cpp                  |    3 +-
>  src/weapon/jetpack.cpp                  |    1 -
>  src/weapon/parachute.cpp                |    3 +-
>  src/weapon/suicide.cpp                  |    1 -
>  src/weapon/weapon.cpp                   |    4 +-
>  src/weapon/weapon_launcher.cpp          |    4 +-
>  27 files changed, 29 insertions(+), 555 deletions(-)
>
> diff --git a/lib/wormux/include/WORMUX_action.h 
> b/lib/wormux/include/WORMUX_action.h
> index 3c64807..c5d0f05 100644
> --- a/lib/wormux/include/WORMUX_action.h
> +++ b/lib/wormux/include/WORMUX_action.h
> @@ -83,8 +83,6 @@ public:
>      ACTION_CHARACTER_HIGH_JUMP,
>      ACTION_CHARACTER_BACK_JUMP,
>  
> -    ACTION_CHARACTER_SET_PHYSICS,
> -
>      // ########################################################
>      // Using Weapon
>      ACTION_WEAPON_SHOOT,
> @@ -105,7 +103,6 @@ public:
>      ACTION_DROP_BONUS_BOX,
>  
>      // ########################################################
> -    ACTION_EXPLOSION,
>      ACTION_NETWORK_PING,
>      ACTION_NETWORK_VERIFY_RANDOM_SYNC,
>      // ########################################################
> diff --git a/src/ai/ai_movement_module.cpp b/src/ai/ai_movement_module.cpp
> index 83e5713..1a21e92 100644
> --- a/src/ai/ai_movement_module.cpp
> +++ b/src/ai/ai_movement_module.cpp
> @@ -133,7 +133,7 @@ void AIMovementModule::Jump()
>  
>    //  GameMessages::GetInstance()->Add("try to jump!");
>    SetMovement(JUMPING);
> -  ActionHandler::GetInstance()->NewActionActiveCharacter(new 
> Action(Action::ACTION_CHARACTER_HIGH_JUMP));
> +  ActionHandler::GetInstance()->NewAction(new 
> Action(Action::ACTION_CHARACTER_HIGH_JUMP));
>  }
>  
>  void AIMovementModule::EndOfJump()
> diff --git a/src/character/character.cpp b/src/character/character.cpp
> index 74b2cb4..f65edda 100644
> --- a/src/character/character.cpp
> +++ b/src/character/character.cpp
> @@ -704,11 +704,6 @@ void Character::Move(enum BodyDirection direction, bool 
> slowly)
>    }
>  
>    ASSERT(&ActiveCharacter() == this);
> -
> -  //Refresh skin position across network
> -  if (!Network::GetInstance()->IsLocal()
> -      && (ActiveTeam().IsLocal() || ActiveTeam().IsLocalAI()))
> -    SendActiveCharacterInfo();
>  }
>  
>  // Signal the end of a fall
> @@ -926,154 +921,6 @@ uint Character::GetCharacterIndex() const
>    return 0;
>  }
>  
> -// ###################################################################
> -// ###################################################################
> -// ###################################################################
> -
> -void Character::StoreValue(Action *a)
> -{
> -  PhysicalObj::StoreValue(a);
> -  a->Push((int)GetDirection());
> -  a->Push(GetAbsFiringAngle());
> -  a->Push((int)disease_damage_per_turn);
> -  a->Push((int)disease_duration);
> -  if (IsActiveCharacter()) { // If active character, store step animation
> -    a->Push((int)true);
> -    a->Push(GetBody()->GetClothe());
> -    a->Push(GetBody()->GetMovement());
> -    a->Push((int)GetBody()->GetFrame());
> -  } else {
> -    a->Push((int)false);
> -  }
> -}
> -
> -void Character::GetValueFromAction(Action *a)
> -{
> -  // those 2 parameters will be retrieved by PhysicalObj::GetValueFromAction
> -  alive_t prev_live_state = m_alive;
> -  int prev_energy = m_energy;
> -  Point2d prev_position = Physics::GetPos();
> -
> -  PhysicalObj::GetValueFromAction(a);
> -  SetDirection((BodyDirection_t)(a->PopInt()));
> -  SetFiringAngle(a->PopDouble());
> -
> -  if (m_alive != prev_live_state) {
> -    switch (m_alive) {
> -    case ALIVE:
> -      fprintf(stderr, "Character::GetValueFromAction: %s has been 
> resurrected\n",
> -           GetName().c_str());
> -      SetClothe("normal");
> -      SetMovement("breathe");
> -      if (prev_live_state == DROWNED) {
> -     SignalGoingOutOfWater();
> -      }
> -      break;
> -    case DEAD:
> -      fprintf(stderr,
> -           "Character::GetValueFromAction: %s has died on the other side of 
> the network\n"
> -           "        Previous energy: %d\n",
> -           GetName().c_str(), prev_energy);
> -      death_explosion = false;
> -
> -      // to avoid violating an ASSERT in Die()
> -      m_alive = prev_live_state;
> -      if (m_alive != ALIVE && m_alive != DROWNED)
> -     m_alive = ALIVE;
> -
> -      Die();
> -      break;
> -    case GHOST: {
> -      fprintf(stderr, "Character::GetValueFromAction: %s is now a ghost!\n", 
> GetName().c_str());
> -      m_alive = prev_live_state;
> -      bool was_dead = IsDead();
> -      m_alive = GHOST;
> -      SignalGhostState(was_dead);
> -      break;
> -    }
> -    case DROWNED:
> -      fprintf(stderr, "Character::GetValueFromAction: %s is drowning!\n", 
> GetName().c_str());
> -      SignalDrowning();
> -      break;
> -    }
> -  }
> -
> -  if (prev_energy != m_energy) {
> -    fprintf(stderr,
> -         "Character::GetValueFromAction: energy points were differents for 
> %s:\n"
> -         "        - remote : %d\n"
> -         "        - local  : %d\n",
> -         GetName().c_str(), m_energy, prev_energy);
> -    if (m_energy > 0) {
> -      energy_bar.Actu(m_energy);
> -    }
> -  }
> -
> -  uint disease_damage_per_turn = (a->PopInt());
> -  uint disease_duration = (a->PopInt());
> -  SetDiseaseDamage(disease_damage_per_turn, disease_duration);
> -  if (a->PopInt()) { // If active characters, retrieve stored animation
> -    if (GetTeam().IsActiveTeam())
> -      ActiveTeam().SelectCharacter(this);
> -
> -    std::string clothe = a->PopString();
> -    std::string movement = a->PopString();
> -    uint frame = a->PopInt();
> -
> -    fprintf(stderr,
> -         "Character::GetValueFromAction: Animation for %s\n"
> -         "        - Clothe %s (current: %s)\n"
> -         "        - Movement %s (current: %s)\n"
> -         "        - Frame %d (current: %d)\n",
> -         GetName().c_str(),
> -         clothe.c_str(), GetBody()->GetClothe().c_str(),
> -         movement.c_str(), GetBody()->GetMovement().c_str(),
> -         frame, GetBody()->GetFrame());
> -
> -    SetClothe(clothe, true);
> -    SetMovement(movement, true);
> -    GetBody()->SetFrame(frame);
> -
> -    GetBody()->UpdateWeaponPosition(GetPosition());
> -  }
> -
> -  // If the player has moved, the camera should follow it!
> -  Point2d current_position = Physics::GetPos();
> -  if (IsActiveCharacter() && prev_position != current_position) {
> -    Camera::GetInstance()->FollowObject(this);
> -    HideGameInterface();
> -  }
> -}
> -
> -// Static method
> -void Character::RetrieveCharacterFromAction(Action *a)
> -{
> -  int team_no = a->PopInt();
> -  int char_no = a->PopInt();
> -  Character * c = 
> GetTeamsList().FindPlayingByIndex(team_no)->FindByIndex(char_no);
> -  c->GetValueFromAction(a);
> -}
> -
> -// Static method
> -void Character::StoreActiveCharacter(Action *a)
> -{
> -  Character::StoreCharacter(a, ActiveCharacter().GetTeamIndex(), 
> ActiveCharacter().GetCharacterIndex());
> -}
> -
> -// Static method
> -void Character::StoreCharacter(Action *a, uint team_no, uint char_no)
> -{
> -  a->Push((int)team_no);
> -  a->Push((int)char_no);
> -  Character * c = 
> GetTeamsList().FindPlayingByIndex(team_no)->FindByIndex(char_no);
> -  c->StoreValue(a);
> -}
> -
> -// ###################################################################
> -// ###################################################################
> -// ###################################################################
> -
> -
>  const std::string& Character::GetName() const
>  {
>      return character_name;
> @@ -1115,8 +962,6 @@ void Character::HandleKeyReleased_MoveRight(bool 
> /*slowly*/)
>    StopWalk();
>  
>    ActiveTeam().crosshair.Show();
> -
> -  SendActiveCharacterInfo();
>  }
>  
>  // #################### MOVE_LEFT
> @@ -1142,8 +987,6 @@ void Character::HandleKeyReleased_MoveLeft(bool 
> /*slowly*/)
>    body->StopWalk();
>  
>    ActiveTeam().crosshair.Show();
> -
> -  SendActiveCharacterInfo();
>  }
>  
>  // #################### UP
> @@ -1175,7 +1018,6 @@ void Character::HandleKeyRefreshed_Down(bool slowly)
>        CharacterCursor::GetInstance()->Hide();
>        if (slowly) AddFiringAngle(DELTA_CROSSHAIR/10.0);
>        else       AddFiringAngle(DELTA_CROSSHAIR);
> -      SendActiveCharacterInfo();
>      }
>  }
>  
> @@ -1189,7 +1031,7 @@ void Character::HandleKeyPressed_Jump()
>  
>    if (IsImmobile()) {
>      Action a(Action::ACTION_CHARACTER_JUMP);
> -    SendActiveCharacterAction(a);
> +    Network::GetInstance()->SendActionToAll(a);
>      Jump();
>    }
>  }
> @@ -1203,7 +1045,7 @@ void Character::HandleKeyPressed_HighJump()
>  
>    if (IsImmobile()) {
>      Action a(Action::ACTION_CHARACTER_HIGH_JUMP);
> -    SendActiveCharacterAction(a);
> +    Network::GetInstance()->SendActionToAll(a);
>      HighJump();
>    }
>  }
> @@ -1217,7 +1059,7 @@ void Character::HandleKeyPressed_BackJump()
>  
>    if (IsImmobile()) {
>      Action a(Action::ACTION_CHARACTER_BACK_JUMP);
> -    SendActiveCharacterAction(a);
> +    Network::GetInstance()->SendActionToAll(a);
>      BackJump();
>    }
>  }
> diff --git a/src/character/character.h b/src/character/character.h
> index f9e4ac3..ce9b54f 100644
> --- a/src/character/character.h
> +++ b/src/character/character.h
> @@ -149,16 +149,6 @@ public:
>      else disease_damage_per_turn = 0;
>    }
>  
> -  // ================================================
> -  // Used to sync value across network
> -  virtual void GetValueFromAction(Action *);
> -  virtual void StoreValue(Action *);
> -
> -  static void RetrieveCharacterFromAction(Action *);
> -  static void StoreActiveCharacter(Action *);
> -  static void StoreCharacter(Action *, uint team_no, uint char_no);
> -  // ================================================
> -
>    void Draw();
>    void Refresh();
>  
> diff --git a/src/include/action_handler.cpp b/src/include/action_handler.cpp
> index 5e90b29..e7aa6e9 100644
> --- a/src/include/action_handler.cpp
> +++ b/src/include/action_handler.cpp
> @@ -304,8 +304,9 @@ static void Action_Player_ChangeWeapon (Action *a)
>  static void Action_Player_ChangeCharacter (Action *a)
>  {
>    JukeBox::GetInstance()->Play("default", "character/change_in_same_team");
> -  Character::RetrieveCharacterFromAction(a);       // Retrieve current 
> character's information
> -  Character::RetrieveCharacterFromAction(a);       // Retrieve next 
> character information
> +  int char_no = a->PopInt();
> +  Character * c = ActiveTeam().FindByIndex(char_no);
> +  ActiveTeam().SelectCharacter(c);
>    Camera::GetInstance()->FollowObject(&ActiveCharacter(),true);
>  }
>  
> @@ -313,11 +314,7 @@ static void Action_Game_NextTeam (Action *a)
>  {
>    std::string team = a->PopString();
>    GetTeamsList().SetActive(team);
> -
> -  Character::RetrieveCharacterFromAction(a);       // Retrieve current 
> character's information
> -
> -  ASSERT (!ActiveCharacter().IsDead());
> -
> +  ActiveTeam().NextCharacter(true);
>    Camera::GetInstance()->FollowObject(&ActiveCharacter());
>  
>    // Are we turn master for next turn ?
> @@ -334,11 +331,10 @@ static void Action_Game_CalculateFrame (Action */*a*/)
>    // that the frame is complete.
>  }
>  
> -static void Action_DropBonusBox (Action *a)
> +static void Action_DropBonusBox (Action */*a*/)
>  {
>    ObjBox* current_box = Game::GetInstance()->GetCurrentBox();
>    if (current_box != NULL) {
> -    current_box->GetValueFromAction(a);
>      current_box->DropBox();
>    }
>  }
> @@ -559,30 +555,6 @@ void WORMUX_DisconnectPlayer(Player& player)
>  
>  // ########################################################
>  
> -// Send information about energy and the position of every character
> -void SyncCharacters()
> -{
> -  ASSERT(Network::GetInstance()->IsTurnMaster());
> -
> -  TeamsList::iterator
> -    it=GetTeamsList().playing_list.begin(),
> -    end=GetTeamsList().playing_list.end();
> -
> -  for (int team_no = 0; it != end; ++it, ++team_no)
> -  {
> -    Team& team = **it;
> -    Team::iterator
> -        tit = team.begin(),
> -        tend = team.end();
> -
> -    for (int char_no = 0; tit != tend; ++tit, ++char_no)
> -    {
> -      // Sync the character's position, energy, ...
> -      SendCharacterInfo(team_no, char_no);
> -    }
> -  }
> -}
> -
>  static void Action_Character_Jump (Action */*a*/)
>  {
>    Game::GetInstance()->SetCharacterChosen(true);
> @@ -604,42 +576,6 @@ static void Action_Character_BackJump (Action */*a*/)
>    ActiveCharacter().BackJump();
>  }
>  
> -static void Action_Character_SetPhysics (Action *a)
> -{
> -  while(!a->IsEmpty())
> -    Character::RetrieveCharacterFromAction(a);
> -}
> -
> -void SendActiveCharacterAction(const Action& a)
> -{
> -  ASSERT(ActiveTeam().IsLocal() || ActiveTeam().IsLocalAI());
> -  SendActiveCharacterInfo();
> -  Network::GetInstance()->SendActionToAll(a);
> -}
> -
> -// Send character information over the network (it's totally stupid to send 
> it locally ;-)
> -void SendCharacterInfo(int team_no, int char_no)
> -{
> -  Action a(Action::ACTION_CHARACTER_SET_PHYSICS);
> -  Character::StoreCharacter(&a, team_no, char_no);
> -  Network::GetInstance()->SendActionToAll(a);
> -}
> -
> -uint last_time = 0;
> -
> -// Send active character information over the network (it's totally stupid 
> to send it locally ;-)
> -void SendActiveCharacterInfo(bool can_be_dropped)
> -{
> -  uint current_time = Time::GetInstance()->Read();
> -
> -  if (!can_be_dropped || last_time + 100 < Time::GetInstance()->Read()) {
> -    last_time = current_time;
> -    SendCharacterInfo(ActiveCharacter().GetTeamIndex(), 
> ActiveCharacter().GetCharacterIndex());
> -  }
> -}
> -
> -// ########################################################
> -
>  static void Action_Weapon_Shoot (Action *a)
>  {
>    if (Game::GetInstance()->ReadState() != Game::PLAYING)
> @@ -952,28 +888,6 @@ void WORMUX_DisconnectHost(DistantComputer& host)
>      Network::GetInstance()->SendActionToAll(a); // host is already removed 
> from the list
>    }
>  }
> -
> -static void Action_Explosion (Action *a)
> -{
> -  ExplosiveWeaponConfig config;
> -  MSG_DEBUG("action_handler","-> Begin");
> -
> -  Point2i pos = a->PopPoint2i();
> -  config.explosion_range = a->PopInt();
> -  config.particle_range = a->PopInt();
> -  config.damage = a->PopInt();
> -  config.blast_range = a->PopInt();
> -  config.blast_force = a->PopInt();
> -  std::string son = a->PopString();
> -  bool fire_particle = !!a->PopInt();
> -  ParticleEngine::ESmokeStyle smoke = 
> (ParticleEngine::ESmokeStyle)a->PopInt();
> -  std::string unique_id = a->PopString();
> -
> -  ApplyExplosion_common(pos, config, son, fire_particle, smoke, unique_id);
> -
> -  MSG_DEBUG("action_handler","<- End");
> -}
> -
>  // ########################################################
>  // ########################################################
>  // ########################################################
> @@ -1020,9 +934,6 @@ void Action_Handler_Init()
>    ActionHandler::GetInstance()->Register (Action::ACTION_CHARACTER_JUMP, 
> "CHARACTER_jump", &Action_Character_Jump);
>    ActionHandler::GetInstance()->Register 
> (Action::ACTION_CHARACTER_HIGH_JUMP, "CHARACTER_super_jump", 
> &Action_Character_HighJump);
>    ActionHandler::GetInstance()->Register 
> (Action::ACTION_CHARACTER_BACK_JUMP, "CHARACTER_back_jump", 
> &Action_Character_BackJump);
> -
> -  ActionHandler::GetInstance()->Register 
> (Action::ACTION_CHARACTER_SET_PHYSICS, "CHARACTER_set_physics", 
> &Action_Character_SetPhysics);
> -
>    // ########################################################
>    // Using Weapon
>    ActionHandler::GetInstance()->Register (Action::ACTION_WEAPON_SHOOT, 
> "WEAPON_shoot", &Action_Weapon_Shoot);
> @@ -1043,8 +954,6 @@ void Action_Handler_Init()
>    ActionHandler::GetInstance()->Register (Action::ACTION_DROP_BONUS_BOX, 
> "BONUSBOX_drop_box", &Action_DropBonusBox);
>    // ########################################################
>    ActionHandler::GetInstance()->Register (Action::ACTION_NETWORK_PING, 
> "NETWORK_ping", &Action_Network_Ping);
> -
> -  ActionHandler::GetInstance()->Register (Action::ACTION_EXPLOSION, 
> "explosion", &Action_Explosion);
>    ActionHandler::GetInstance()->Register 
> (Action::ACTION_NETWORK_RANDOM_INIT, "NETWORK_random_init", 
> &Action_Network_RandomInit);
>    ActionHandler::GetInstance()->Register 
> (Action::ACTION_NETWORK_VERIFY_RANDOM_SYNC, "NETWORK_verify_random_sync", 
> &Action_Network_VerifyRandomSync);
>    ActionHandler::GetInstance()->Register 
> (Action::ACTION_INFO_CLIENT_DISCONNECT, "INFO_client_disconnect", 
> &Action_Info_ClientDisconnect);
> @@ -1137,10 +1046,3 @@ void ActionHandler::NewAction(Action* a, bool 
> repeat_to_network)
>    Menu::WakeUpOnCallback();
>  }
>  
> -void ActionHandler::NewActionActiveCharacter(Action* a)
> -{
> -  ASSERT(ActiveTeam().IsLocal() || ActiveTeam().IsLocalAI());
> -  SendActiveCharacterInfo();
> -  NewAction(a);
> -}
> -
> diff --git a/src/include/action_handler.h b/src/include/action_handler.h
> index d4447e1..077ad69 100644
> --- a/src/include/action_handler.h
> +++ b/src/include/action_handler.h
> @@ -53,14 +53,6 @@ void Action_Handler_Init();
>  
>  // TODO: Move it in an object !
>  
> -// Send character information over the network (it's totally stupid to send 
> it locally ;-)
> -void SendCharacterInfo(int team_no, int char_no);
> -void SendActiveCharacterInfo(bool can_be_dropped = false);
> -
> -// Send character information + an action over the network
> -// WARNING: it does not post the action in local queue!!
> -void SendActiveCharacterAction(const Action& a);
> -
>  void SendGameMode();
>  void SyncCharacters();
>  
> diff --git a/src/interface/man_machine_interface.cpp 
> b/src/interface/man_machine_interface.cpp
> index d72a3a8..bc480fa 100644
> --- a/src/interface/man_machine_interface.cpp
> +++ b/src/interface/man_machine_interface.cpp
> @@ -269,7 +269,6 @@ void ManMachineInterface::HandleKeyReleased(const Key_t 
> &key)
>        ObjBox* current_box = Game::GetInstance()->GetCurrentBox();
>        if (current_box != NULL) {
>          Action * a = new Action(Action::ACTION_DROP_BONUS_BOX);
> -        current_box->StoreValue(a);
>          ActionHandler::GetInstance()->NewAction(a);
>        }
>      } else if (Game::GetInstance()->ReadState() == Game::PLAYING &&
> @@ -426,15 +425,15 @@ void ManMachineInterface::HandleKeyReleased(const Key_t 
> &key)
>        {
>          if (GameMode::GetInstance()->AllowCharacterSelection()) {
>            SDLMod mod = SDL_GetModState();
> -       Action * change_character = new 
> Action(Action::ACTION_PLAYER_CHANGE_CHARACTER);
> -       Character::StoreActiveCharacter(change_character);
>            if (mod & KMOD_CTRL) {
>              ActiveTeam().PreviousCharacter();
>            } else {
>              ActiveTeam().NextCharacter();
>            }
> -       Character::StoreActiveCharacter(change_character);
> -       ActionHandler::GetInstance()->NewAction(change_character);
> +          Action * next_character = new 
> Action(Action::ACTION_PLAYER_CHANGE_CHARACTER);
> +          uint next_character_index = ActiveCharacter().GetCharacterIndex();
> +          next_character->Push((int)next_character_index);
> +          ActionHandler::GetInstance()->NewAction(next_character);
>          }
>        }
>        return;
> diff --git a/src/interface/mouse.cpp b/src/interface/mouse.cpp
> index c1305a7..98a6c6d 100644
> --- a/src/interface/mouse.cpp
> +++ b/src/interface/mouse.cpp
> @@ -118,13 +118,12 @@ void Mouse::ActionLeftClic(bool) const
>      }
>  
>      if (character_found) {
> -      Action * next_character = new 
> Action(Action::ACTION_PLAYER_CHANGE_CHARACTER);
> -      Character::StoreActiveCharacter(next_character);
> -
>        while ( &(*it) != &ActiveCharacter() )
>          ActiveTeam().NextCharacter ();
>  
> -      Character::StoreActiveCharacter(next_character);
> +      Action * next_character = new 
> Action(Action::ACTION_PLAYER_CHANGE_CHARACTER);
> +      uint next_character_index = (*it).GetCharacterIndex();
> +      next_character->Push((int)next_character_index);
>        ActionHandler::GetInstance()->NewAction(next_character);
>  
>        return;
> diff --git a/src/object/bonus_box.cpp b/src/object/bonus_box.cpp
> index f4b47ce..a1ceec7 100644
> --- a/src/object/bonus_box.cpp
> +++ b/src/object/bonus_box.cpp
> @@ -177,19 +177,7 @@ void BonusBox::LoadXml(const xmlNode* object)
>    ASSERT(total_probability != 0.0);
>  }
>  
> -void BonusBox::GetValueFromAction(Action * a)
> -{
> -  ObjBox::GetValueFromAction(a);
> -  weapon_num = (uint)(a->PopInt());
> -}
> -
>  void BonusBox::Randomize()
>  {
>    PickRandomWeapon();
>  }
> -
> -void BonusBox::StoreValue(Action * a)
> -{
> -  ObjBox::StoreValue(a);
> -  a->Push(int(weapon_num));
> -}
> diff --git a/src/object/bonus_box.h b/src/object/bonus_box.h
> index 6f48962..69c33d2 100644
> --- a/src/object/bonus_box.h
> +++ b/src/object/bonus_box.h
> @@ -57,8 +57,6 @@ class BonusBox : public ObjBox
>  
>      void ApplyBonus(Character *);
>      void Randomize();
> -    void GetValueFromAction(Action *);
> -    void StoreValue(Action *);
>  };
>  
>  
> //-----------------------------------------------------------------------------
> diff --git a/src/object/medkit.cpp b/src/object/medkit.cpp
> index 3913754..805ae34 100644
> --- a/src/object/medkit.cpp
> +++ b/src/object/medkit.cpp
> @@ -90,15 +90,3 @@ void Medkit::LoadXml(const xmlNode*  object)
>    if (!r)
>      nbr_health = 24;
>  }
> -
> -void Medkit::GetValueFromAction(Action * a)
> -{
> -  ObjBox::GetValueFromAction(a);
> -  nbr_health = a->PopInt();
> -}
> -
> -void Medkit::StoreValue(Action * a)
> -{
> -  ObjBox::StoreValue(a);
> -  a->Push(nbr_health);
> -}
> diff --git a/src/object/medkit.h b/src/object/medkit.h
> index 4612b2e..92d6499 100644
> --- a/src/object/medkit.h
> +++ b/src/object/medkit.h
> @@ -44,8 +44,6 @@ class Medkit : public ObjBox//public PhysicalObj
>  
>      static void LoadXml(const xmlNode * object);
>      void ApplyBonus(Character *);
> -    void GetValueFromAction(Action *);
> -    void StoreValue(Action *);
>  };
>  
>  
> //-----------------------------------------------------------------------------
> diff --git a/src/object/objbox.cpp b/src/object/objbox.cpp
> index 659dbc9..2ca5b18 100644
> --- a/src/object/objbox.cpp
> +++ b/src/object/objbox.cpp
> @@ -159,22 +159,6 @@ void ObjBox::SignalGhostState(bool /*was_already_dead*/)
>    Explode();
>  }
>  
> -void ObjBox::GetValueFromAction(Action * a)
> -{
> -  PhysicalObj::GetValueFromAction(a);
> -  start_life_points = a->PopInt();
> -  SetXY(a->PopPoint2d());
> -  SetSpeedXY(a->PopPoint2d());
> -}
> -
> -void ObjBox::StoreValue(Action *a)
> -{
> -  PhysicalObj::StoreValue(a);
> -  a->Push(start_life_points);
> -  a->Push(GetPosition());
> -  a->Push(GetSpeed());
> -}
> -
>  
> //-----------------------------------------------------------------------------
>  
> //-----------------------------------------------------------------------------
>  // Static methods
> diff --git a/src/object/objbox.h b/src/object/objbox.h
> index d52c1a0..36c64e4 100644
> --- a/src/object/objbox.h
> +++ b/src/object/objbox.h
> @@ -53,8 +53,6 @@ class ObjBox : public PhysicalObj //it would be nice to 
> name this "Box", but tha
>      void Draw();
>      virtual void Refresh();
>      virtual void Randomize() {};
> -    virtual void GetValueFromAction(Action *);
> -    virtual void StoreValue(Action *);
>      virtual void ApplyBonus(Character *) {};
>  
>    protected:
> diff --git a/src/object/physical_obj.cpp b/src/object/physical_obj.cpp
> index 83738cc..f1885da 100644
> --- a/src/object/physical_obj.cpp
> +++ b/src/object/physical_obj.cpp
> @@ -132,55 +132,6 @@ void PhysicalObj::SetSize(const Point2i &newSize)
>    SetPhysSize( (double)newSize.x / PIXEL_PER_METER, 
> (double)newSize.y/PIXEL_PER_METER );
>  }
>  
> -void PhysicalObj::StoreValue(Action *a)
> -{
> -  Physics::StoreValue(a);
> -  a->Push(m_collides_with_ground);
> -  a->Push(m_collides_with_characters);
> -  a->Push(m_collides_with_objects);
> -  a->Push(m_rebound_position);
> -  a->Push((int)m_minimum_overlapse_time);
> -  a->Push(m_ignore_movements);
> -  a->Push(m_is_character);
> -  a->Push(m_test_left);
> -  a->Push(m_test_right);
> -  a->Push(m_test_top);
> -  a->Push(m_test_bottom);
> -  a->Push(m_width);
> -  a->Push(m_height);
> -  a->Push(m_alive);
> -  a->Push(m_energy);
> -  a->Push(m_allow_negative_y);
> -}
> -
> -void PhysicalObj::GetValueFromAction(Action *a)
> -{
> -  Physics::GetValueFromAction(a);
> -  m_collides_with_ground     = !!a->PopInt();
> -  m_collides_with_characters = !!a->PopInt();
> -  m_collides_with_objects    = !!a->PopInt();
> -  m_rebound_position         = a->PopPoint2i();
> -  m_minimum_overlapse_time   = (uint)a->PopInt();
> -  m_ignore_movements         = !!a->PopInt();
> -  m_is_character             = !!a->PopInt();
> -  m_test_left                = a->PopInt();
> -  m_test_right               = a->PopInt();
> -  m_test_top                 = a->PopInt();
> -  m_test_bottom              = a->PopInt();
> -  m_width                    = a->PopInt();
> -  m_height                   = a->PopInt();
> -  m_alive                    = (alive_t)a->PopInt();
> -  m_energy                   = a->PopInt();
> -  m_allow_negative_y         = !!a->PopInt();
> -
> -  ASSERT(m_test_left >= 0);
> -  ASSERT(m_test_right >= 0);
> -  ASSERT(m_test_top >= 0);
> -  ASSERT(m_test_bottom >= 0);
> -  ASSERT(m_width >= 0);
> -  ASSERT(m_height >= 0);
> -}
> -
>  void PhysicalObj::SetOverlappingObject(PhysicalObj* obj, int timeout)
>  {
>    m_minimum_overlapse_time = 0;
> diff --git a/src/object/physical_obj.h b/src/object/physical_obj.h
> index f2674f1..d0da305 100644
> --- a/src/object/physical_obj.h
> +++ b/src/object/physical_obj.h
> @@ -105,10 +105,6 @@ public:
>    double GetYdouble() const;
>    const Point2d GetPosition() const { return Point2d(GetXdouble(), 
> GetYdouble()) ;};
>  
> -  // Used to sync value across network
> -  virtual void GetValueFromAction(Action *);
> -  virtual void StoreValue(Action *);
> -
>    // Set/Get size
>    void SetSize(const Point2i &newSize);
>    int GetWidth() const { return m_width; };
> diff --git a/src/object/physics.cpp b/src/object/physics.cpp
> index c5ae5c2..5cedb8b 100644
> --- a/src/object/physics.cpp
> +++ b/src/object/physics.cpp
> @@ -144,59 +144,6 @@ void Physics::GetSpeed(double &norm, double &angle) const
>    }
>  }
>  
> -
> -void Physics::StoreValue(Action *a)
> -{
> -  a->Push((int)m_motion_type);
> -  a->Push(m_pos_x);
> -  a->Push(m_pos_y);
> -  a->Push(m_extern_force);
> -  a->Push((int)m_last_move);
> -  a->Push(m_phys_width);
> -  a->Push(m_phys_height);
> -  a->Push(m_fix_point_gnd);
> -  a->Push(m_fix_point_dxy);
> -  a->Push(m_rope_angle);
> -  a->Push(m_rope_length);
> -  a->Push(m_rope_elasticity);
> -  a->Push(m_elasticity_damping);
> -  a->Push(m_balancing_damping);
> -  a->Push(m_elasticity_off);
> -
> -  MSG_DEBUG( "physic.sync", "%s now - x0:%f, x1:%f, x2:%f - y0:%f, y1:%f, 
> y2:%f - extern_force: %f, %f",
> -          typeid(*this).name(),
> -             m_pos_x.x0, m_pos_x.x1, m_pos_x.x2,
> -             m_pos_y.x0, m_pos_y.x1, m_pos_y.x2,
> -             m_extern_force.x, m_extern_force.y);
> -}
> -
> -void Physics::GetValueFromAction(Action *a)
> -{
> -  m_motion_type        = (MotionType_t)a->PopInt();
> -  m_pos_x              = a->PopEulerVector();
> -  m_pos_y              = a->PopEulerVector();
> -  m_extern_force       = a->PopPoint2d();
> -  m_last_move          = (uint)a->PopInt();
> -  m_phys_width         = a->PopDouble();
> -  m_phys_height        = a->PopDouble();
> -  m_fix_point_gnd      = a->PopPoint2d();
> -  m_fix_point_dxy      = a->PopPoint2d();
> -  m_rope_angle         = a->PopEulerVector();
> -  m_rope_length        = a->PopEulerVector();
> -  m_rope_elasticity    = a->PopDouble();
> -  m_elasticity_damping = a->PopDouble();
> -  m_balancing_damping  = a->PopDouble();
> -  m_elasticity_off     = !!a->PopInt();
> -
> -  ASSERT(Time::GetInstance()->Read() >= m_last_move);
> -
> -  MSG_DEBUG( "physic.sync", "%s now - x0:%f, x1:%f, x2:%f - y0:%f, y1:%f, 
> y2:%f - extern_force: %f, %f",
> -          typeid(*this).name(),
> -             m_pos_x.x0, m_pos_x.x1, m_pos_x.x2,
> -             m_pos_y.x0, m_pos_y.x1, m_pos_y.x2,
> -             m_extern_force.x, m_extern_force.y);
> -}
> -
>  void Physics::SetExternForceXY (const Point2d& vector)
>  {
>    bool was_moving = IsMoving();
> diff --git a/src/object/physics.h b/src/object/physics.h
> index 61e965f..113395a 100644
> --- a/src/object/physics.h
> +++ b/src/object/physics.h
> @@ -106,10 +106,6 @@ public:
>    void SetAlignParticleState(bool state) { m_align_particle_state = state; }
>    bool GetAlignParticleState(void) const { return m_align_particle_state; }
>  
> -  // Used to sync value across network
> -  virtual void GetValueFromAction(Action *);
> -  virtual void StoreValue(Action *);
> -
>    // Reset the physics constants (mass, air_resistance...) to the default 
> values in the cfg
>    void ResetConstants() { *((ObjectConfig*)this) = m_cfg; };
>  
> diff --git a/src/team/teams_list.cpp b/src/team/teams_list.cpp
> index 7c0303d..4f8779e 100644
> --- a/src/team/teams_list.cpp
> +++ b/src/team/teams_list.cpp
> @@ -65,7 +65,6 @@ void TeamsList::NextTeam ()
>    ActiveTeam().NextCharacter(true);
>  
>    Action a(Action::ACTION_GAMELOOP_NEXT_TEAM, next->GetId());
> -  Character::StoreActiveCharacter(&a);
>    Network::GetInstance()->SendActionToAll(a);
>  
>    printf("\nPlaying character : %i %s\n", 
> ActiveCharacter().GetCharacterIndex(), ActiveCharacter().GetName().c_str());
> diff --git a/src/weapon/explosion.cpp b/src/weapon/explosion.cpp
> index 1877471..e831ce7 100644
> --- a/src/weapon/explosion.cpp
> +++ b/src/weapon/explosion.cpp
> @@ -43,13 +43,12 @@
>  
>  Profile *weapons_res_profile = NULL;
>  
> -void ApplyExplosion_common (const Point2i &pos,
> -                            const ExplosiveWeaponConfig &config,
> -                            const std::string& son,
> -                            bool fire_particle,
> -                            ParticleEngine::ESmokeStyle smoke,
> -                            std::string network_id
> -                            )
> +void ApplyExplosion (const Point2i &pos,
> +                     const ExplosiveWeaponConfig &config,
> +                     const std::string& son,
> +                     bool fire_particle,
> +                     ParticleEngine::ESmokeStyle smoke
> +                     )
>  {
>    MSG_DEBUG("explosion", "explosion range : %i", config.explosion_range);
>  
> @@ -146,11 +145,6 @@ void ApplyExplosion_common (const Point2i &pos,
>     {
>       PhysicalObj *obj = *it;
>  
> -     if (obj->GetUniqueId() == network_id) {
> -       MSG_DEBUG("explosion", "!! skip blast for object %s", 
> network_id.c_str());
> -       continue; // hack to fix bug #8529
> -     }
> -
>       if (obj->CollidesWithGround() && !obj->IsGhost())
>       {
>         double distance = pos.Distance(obj->GetCenter());
> @@ -185,7 +179,6 @@ void ApplyExplosion_common (const Point2i &pos,
>  
>           ASSERT( obj->GetMass() != 0.0);
>  
> -      MSG_DEBUG("explosion", "!! blasting object %s", network_id.c_str());
>           obj->AddSpeed (force / obj->GetMass(), angle);
>         }
>       }
> @@ -209,73 +202,3 @@ void ApplyExplosion_common (const Point2i &pos,
>    };
>  }
>  
> -void ApplyExplosion_master (const Point2i &pos,
> -                            const ExplosiveWeaponConfig &config,
> -                            const std::string& son,
> -                            bool fire_particle,
> -                            ParticleEngine::ESmokeStyle smoke,
> -                            std::string network_id
> -                            )
> -{
> -  ActionHandler* action_handler = ActionHandler::GetInstance();
> -
> -  TeamsList::iterator
> -    it=GetTeamsList().playing_list.begin(),
> -    end=GetTeamsList().playing_list.end();
> -
> -  Action a_characters_info(Action::ACTION_CHARACTER_SET_PHYSICS);
> -
> -  for (int team_no = 0; it != end; ++it, ++team_no)
> -  {
> -    Team& team = **it;
> -    Team::iterator
> -        tit = team.begin(),
> -        tend = team.end();
> -
> -    for (int char_no = 0; tit != tend; ++tit, ++char_no)
> -    {
> -      Character &character = *tit;
> -
> -      double distance = pos.Distance( character.GetCenter());
> -
> -      // If the character is in the explosion range, apply damage on it !
> -      if (distance <= config.explosion_range || distance < 
> config.blast_range)
> -      {
> -        // clients : Place characters
> -     Character::StoreCharacter(&a_characters_info, team_no, char_no);
> -      }
> -    }
> -  }
> -  // send characters infos on network
> -  Network::GetInstance()->SendActionToAll(a_characters_info);
> -
> -  Action* a = new Action(Action::ACTION_EXPLOSION);
> -  a->Push(pos);
> -  a->Push((int)config.explosion_range);
> -  a->Push((int)config.particle_range);
> -  a->Push((int)config.damage);
> -  a->Push((int)config.blast_range);
> -  a->Push((int)config.blast_force);
> -  a->Push(son);
> -  a->Push(fire_particle);
> -  a->Push(smoke);
> -  ASSERT(network_id.size()>0);
> -  a->Push(network_id);
> -
> -  action_handler->NewAction(a);
> -}
> -
> -
> -void ApplyExplosion (const Point2i &pos,
> -                     const ExplosiveWeaponConfig &config,
> -                     const std::string& son,
> -                     bool fire_particle,
> -                     ParticleEngine::ESmokeStyle smoke,
> -                     std::string network_id
> -                     )
> -{
> -  if (Network::GetInstance()->IsLocal())
> -    ApplyExplosion_common(pos, config, son, fire_particle, smoke, 
> network_id);
> -  else if (Network::GetInstance()->IsTurnMaster())
> -    ApplyExplosion_master(pos, config, son, fire_particle, smoke, 
> network_id);
> -}
> diff --git a/src/weapon/explosion.h b/src/weapon/explosion.h
> index 6cb3b7c..f6ceeff 100644
> --- a/src/weapon/explosion.h
> +++ b/src/weapon/explosion.h
> @@ -32,18 +32,9 @@ void ApplyExplosion(const Point2i &pos,
>                      const ExplosiveWeaponConfig &config,
>                      const std::string& son="weapon/explosion",
>                      bool fire_particle = true,
> -                    ParticleEngine::ESmokeStyle smoke = 
> ParticleEngine::BigESmoke,
> -                    std::string network_id = "LOCAL" // Useful only on 
> network : this is used to know that we should not apply blast and damage to 
> the projectile which has created the explosion (bugfix #8529)
> +                    ParticleEngine::ESmokeStyle smoke = 
> ParticleEngine::BigESmoke
>                      );
>  
> -void ApplyExplosion_common (const Point2i &pos,
> -                            const ExplosiveWeaponConfig &config,
> -                            const std::string& son,
> -                            bool fire_particle,
> -                            ParticleEngine::ESmokeStyle smoke,
> -                            std::string network_id
> -                           );
> -
>  extern Profile *weapons_res_profile;
>  
>  #endif //WEAPON_TOOLS_H
> diff --git a/src/weapon/grapple.cpp b/src/weapon/grapple.cpp
> index a120c35..32138e9 100644
> --- a/src/weapon/grapple.cpp
> +++ b/src/weapon/grapple.cpp
> @@ -416,11 +416,10 @@ void Grapple::Refresh()
>    if (!ActiveTeam().IsLocal() && !ActiveTeam().IsLocalAI())
>      return;
>  
> -if (IsInUse() && !m_attaching)
> +  if (IsInUse() && !m_attaching)
>    {
>      ActiveCharacter().SetMovement("ninja-rope");
>      ActiveCharacter().UpdatePosition();
> -    SendActiveCharacterInfo(true);
>    }
>  }
>  
> diff --git a/src/weapon/jetpack.cpp b/src/weapon/jetpack.cpp
> index 48c0843..3f092cd 100644
> --- a/src/weapon/jetpack.cpp
> +++ b/src/weapon/jetpack.cpp
> @@ -75,7 +75,6 @@ void JetPack::Refresh()
>      F.y = m_y_force ;
>  
>      ActiveCharacter().SetExternForceXY(F);
> -    SendActiveCharacterInfo(true);
>  
>      if (!F.IsNull())
>      {
> diff --git a/src/weapon/parachute.cpp b/src/weapon/parachute.cpp
> index c0619ea..f394d1f 100644
> --- a/src/weapon/parachute.cpp
> +++ b/src/weapon/parachute.cpp
> @@ -149,11 +149,10 @@ void Parachute::Refresh()
>      }
>    }
>    // If parachute is open => character can move a little to the left or to 
> the right
> -  if (open && Network::GetInstance()->IsTurnMaster()) {
> +  if (open) {
>      ActiveCharacter().SetExternForce(m_x_strength.x_extern, 0.0);
>      if (m_x_strength.changing) {
>        m_x_strength.changing = false;
> -      SendActiveCharacterInfo(false);
>      }
>    }
>  }
> diff --git a/src/weapon/suicide.cpp b/src/weapon/suicide.cpp
> index 3877003..4ed9bc5 100644
> --- a/src/weapon/suicide.cpp
> +++ b/src/weapon/suicide.cpp
> @@ -55,7 +55,6 @@ void Suicide::Refresh()
>      ActiveCharacter().DisableDeathExplosion();
>      ActiveCharacter().body->MakeParticles(ActiveCharacter().GetPosition());
>      ActiveCharacter().SetEnergy(0); // Die!
> -    SendActiveCharacterInfo();
>      ApplyExplosion(ActiveCharacter().GetCenter(),cfg());
>    }
>  }
> diff --git a/src/weapon/weapon.cpp b/src/weapon/weapon.cpp
> index 68de2fc..75d4e8f 100644
> --- a/src/weapon/weapon.cpp
> +++ b/src/weapon/weapon.cpp
> @@ -251,7 +251,7 @@ void Weapon::NewActionWeaponShoot() const
>    Action* a_shoot = new Action(Action::ACTION_WEAPON_SHOOT,
>                                 m_strength,
>                                 ActiveCharacter().GetAbsFiringAngle());
> -  ActionHandler::GetInstance()->NewActionActiveCharacter(a_shoot);
> +  ActionHandler::GetInstance()->NewAction(a_shoot);
>  }
>  
>  void Weapon::NewActionWeaponStopUse() const
> @@ -259,7 +259,7 @@ void Weapon::NewActionWeaponStopUse() const
>    ASSERT(ActiveTeam().IsLocal() || ActiveTeam().IsLocalAI());
>  
>    Action* a = new Action(Action::ACTION_WEAPON_STOP_USE);
> -  ActionHandler::GetInstance()->NewActionActiveCharacter(a);
> +  ActionHandler::GetInstance()->NewAction(a);
>  }
>  
>  void Weapon::PrepareShoot(double strength, double angle)
> diff --git a/src/weapon/weapon_launcher.cpp b/src/weapon/weapon_launcher.cpp
> index fec13c8..cccb8ec 100644
> --- a/src/weapon/weapon_launcher.cpp
> +++ b/src/weapon/weapon_launcher.cpp
> @@ -107,7 +107,7 @@ void WeaponBullet::Refresh()
>  void WeaponBullet::DoExplosion()
>  {
>    Point2i pos = GetCenter();
> -  ApplyExplosion(pos, cfg, "", false, ParticleEngine::LittleESmoke, 
> GetUniqueId());
> +  ApplyExplosion(pos, cfg, "", false, ParticleEngine::LittleESmoke);
>  }
>  
> //-----------------------------------------------------------------------------
>  
> @@ -351,7 +351,7 @@ void WeaponProjectile::SignalExplosion()
>  void WeaponProjectile::DoExplosion()
>  {
>    Point2i pos = GetCenter();
> -  ApplyExplosion(pos, cfg, "weapon/explosion", true, 
> ParticleEngine::BigESmoke, GetUniqueId());
> +  ApplyExplosion(pos, cfg, "weapon/explosion", true, 
> ParticleEngine::BigESmoke);
>  }
>  
>  void WeaponProjectile::IncrementTimeOut()
>   


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

Répondre à