src/include/action_handler.h File Reference

#include <SDL_mutex.h>
#include <map>
#include <list>
#include "action.h"
#include "base.h"

Include dependency graph for action_handler.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ActionHandler

Functions

ActionBuildActionSendCharacterPhysics (int team_no, int char_no)
void SendGameMode ()
void SyncCharacters ()


Function Documentation

Action* BuildActionSendCharacterPhysics ( int  team_no,
int  char_no 
)

Definition at line 169 of file action_handler.cpp.

00170 {
00171   Action* a = new Action(Action::ACTION_SET_CHARACTER_PHYSICS);
00172   a->StoreCharacter(team_no, char_no);
00173   return a;
00174 }

Here is the caller graph for this function:

void SendGameMode (  ) 

Definition at line 282 of file action_handler.cpp.

00283 {
00284   assert(network.IsServer());
00285   Action a(Action::ACTION_SET_GAME_MODE);
00286   a.Push((int)GameMode::GetInstance()->max_characters);
00287   a.Push((int)GameMode::GetInstance()->max_teams);
00288   a.Push((int)GameMode::GetInstance()->duration_turn);
00289   a.Push((int)GameMode::GetInstance()->duration_exchange_player);
00290   a.Push((int)GameMode::GetInstance()->duration_before_death_mode);
00291   a.Push(GameMode::GetInstance()->gravity);
00292   a.Push(GameMode::GetInstance()->safe_fall);
00293   a.Push(GameMode::GetInstance()->damage_per_fall_unit);
00294   a.Push((int)GameMode::GetInstance()->duration_move_player);
00295   a.Push(GameMode::GetInstance()->allow_character_selection);
00296   a.Push((int)GameMode::GetInstance()->character.init_energy);
00297   a.Push((int)GameMode::GetInstance()->character.max_energy);
00298   a.Push((int)GameMode::GetInstance()->character.mass);
00299   a.Push(GameMode::GetInstance()->character.air_resist_factor);
00300   a.Push((int)GameMode::GetInstance()->character.jump_strength);
00301   a.Push(GameMode::GetInstance()->character.jump_angle);
00302   a.Push((int)GameMode::GetInstance()->character.super_jump_strength);
00303   a.Push(GameMode::GetInstance()->character.super_jump_angle);
00304   a.Push((int)GameMode::GetInstance()->character.back_jump_strength);
00305   a.Push(GameMode::GetInstance()->character.back_jump_angle);
00306   network.SendAction(&a);
00307 }

Here is the call graph for this function:

Here is the caller graph for this function:

void SyncCharacters (  ) 

Definition at line 63 of file action_handler.cpp.

00064 {
00065   assert(network.IsServer());
00066   ActionHandler* action_handler = ActionHandler::GetInstance();
00067 
00068   Action a_begin_sync(Action::ACTION_SYNC_BEGIN);
00069   network.SendAction(&a_begin_sync);
00070   TeamsList::iterator
00071     it=teams_list.playing_list.begin(),
00072     end=teams_list.playing_list.end();
00073 
00074   for (int team_no = 0; it != end; ++it, ++team_no)
00075   {
00076     Team& team = **it;
00077     Team::iterator
00078         tit = team.begin(),
00079         tend = team.end();
00080 
00081     for (int char_no = 0; tit != tend; ++tit, ++char_no)
00082     {
00083       // Sync the character's energy
00084       Action* a = new Action(Action::ACTION_SET_CHARACTER_ENERGY);
00085       a->Push(team_no);
00086       a->Push(char_no);
00087       a->Push((int)(*tit).GetEnergy());
00088       action_handler->NewAction(a);
00089       // Sync the character's position
00090       a = BuildActionSendCharacterPhysics(team_no, char_no);
00091       action_handler->NewAction(a);
00092     }
00093   }
00094   Action a_sync_end(Action::ACTION_SYNC_END);
00095   network.SendAction(&a_sync_end);
00096 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Mon Jan 1 13:18:38 2007 for Wormux by  doxygen 1.4.7