Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/story_entities/multi_player_world.cc @ 8117

Last change on this file since 8117 was 8068, checked in by patrick, 18 years ago

trunk: merged the network branche back to trunk

File size: 3.4 KB
RevLine 
[6139]1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Patrick Boenzli
13*/
14
15#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD
16
[6409]17
[6358]18#include "multi_player_world.h"
[6404]19#include "multi_player_world_data.h"
[6139]20
[7193]21#include "util/loading/factory.h"
22#include "util/loading/load_param.h"
[6498]23#include "shell_command.h"
[6139]24
[8068]25#include "cd_engine.h"
26
[6409]27#include "network_manager.h"
[6139]28
[6409]29
[6404]30using namespace std;
[6366]31
32
[6498]33//! Register a command to print some multiplayer world infos
34SHELL_COMMAND(debug, MultiPlayerWorld, debug);
35
36
[6358]37//! This creates a Factory to fabricate a MultiPlayerWorld
[6361]38CREATE_FACTORY(MultiPlayerWorld, CL_MULTI_PLAYER_WORLD);
[6139]39
[6361]40
[6358]41MultiPlayerWorld::MultiPlayerWorld(const TiXmlElement* root)
[6989]42  : GameWorld()
[6139]43{
[6402]44  this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld");
45
[6408]46  this->dataTank = new MultiPlayerWorldData();
47
[6139]48  this->loadParams(root);
49}
50
[6361]51
[6139]52/**
[6358]53 *  remove the MultiPlayerWorld from memory
[6345]54 *
55 *  delete everything explicitly, that isn't contained in the parenting tree!
56 *  things contained in the tree are deleted automaticaly
[6139]57 */
[6358]58MultiPlayerWorld::~MultiPlayerWorld ()
[6139]59{
[6358]60  PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n");
[7287]61  if( this->dataTank)
62    delete this->dataTank;
[6361]63}
[6139]64
65
66/**
[6358]67 * loads the parameters of a MultiPlayerWorld from an XML-element
[6139]68 * @param root the XML-element to load from
69 */
[6358]70void MultiPlayerWorld::loadParams(const TiXmlElement* root)
[6139]71{
[6512]72  GameWorld::loadParams(root);
[6139]73
[6358]74  PRINTF(4)("Creating a MultiPlayerWorld\n");
75}
[6139]76
[6366]77
[6409]78/**
79 *  synchronizes the network since this is a network world
80 *
81 * this function overrides the synchrinize from the GameWorld
82 */
83void MultiPlayerWorld::synchronize()
84{
[7954]85  NetworkManager::getInstance()->synchronize(this->dtS);
[6409]86}
[6366]87
[6498]88
89/**
[8068]90 * kicks the CDEngine to detect the collisions between the object groups in the world
91 */
92void MultiPlayerWorld::collisionDetection()
93{
94  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS),
95    this->dataTank->objectManager->getObjectList(OM_PLAYERS));
96  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS),
97    this->dataTank->objectManager->getObjectList(OM_PLAYERS_PROJ));
98
99  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
100    this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
101  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
102    this->dataTank->objectManager->getObjectList(OM_GROUP_00_PROJ));
103  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
104    this->dataTank->objectManager->getObjectList(OM_GROUP_01));
105
106  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
107    this->dataTank->objectManager->getObjectList(OM_COMMON));
108  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
109    this->dataTank->objectManager->getObjectList(OM_COMMON));
110
111}
112
113
114/**
[6498]115 * some debug ouptut - shell command
116 */
117void MultiPlayerWorld::debug()
118{
119  ((MultiPlayerWorldData*)this->dataTank)->debug();
[6512]120}
Note: See TracBrowser for help on using the repository browser.