Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6989 was 6989, checked in by bensch, 18 years ago

trunk: story entity work.

File size: 2.0 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
[6404]21#include "factory.h"
[6139]22#include "load_param.h"
[6498]23#include "shell_command.h"
[6139]24
[6409]25#include "network_manager.h"
[6139]26
[6409]27
[6404]28using namespace std;
[6366]29
30
[6498]31//! Register a command to print some multiplayer world infos
32SHELL_COMMAND(debug, MultiPlayerWorld, debug);
33
34
[6358]35//! This creates a Factory to fabricate a MultiPlayerWorld
[6361]36CREATE_FACTORY(MultiPlayerWorld, CL_MULTI_PLAYER_WORLD);
[6139]37
[6361]38
[6358]39MultiPlayerWorld::MultiPlayerWorld(const TiXmlElement* root)
[6989]40  : GameWorld()
[6139]41{
[6402]42  this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld");
43
[6408]44  this->dataTank = new MultiPlayerWorldData();
45
[6139]46  this->loadParams(root);
47}
48
[6361]49
[6139]50/**
[6358]51 *  remove the MultiPlayerWorld from memory
[6345]52 *
53 *  delete everything explicitly, that isn't contained in the parenting tree!
54 *  things contained in the tree are deleted automaticaly
[6139]55 */
[6358]56MultiPlayerWorld::~MultiPlayerWorld ()
[6139]57{
[6358]58  PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n");
[6408]59  if( this->dataTank)
60    delete this->dataTank;
[6361]61}
[6139]62
63
64/**
[6358]65 * loads the parameters of a MultiPlayerWorld from an XML-element
[6139]66 * @param root the XML-element to load from
67 */
[6358]68void MultiPlayerWorld::loadParams(const TiXmlElement* root)
[6139]69{
[6512]70  GameWorld::loadParams(root);
[6139]71
[6358]72  PRINTF(4)("Creating a MultiPlayerWorld\n");
73}
[6139]74
[6366]75
[6409]76/**
77 *  synchronizes the network since this is a network world
78 *
79 * this function overrides the synchrinize from the GameWorld
80 */
81void MultiPlayerWorld::synchronize()
82{
83  NetworkManager::getInstance()->synchronize();
84}
[6366]85
[6498]86
87/**
88 * some debug ouptut - shell command
89 */
90void MultiPlayerWorld::debug()
91{
92  ((MultiPlayerWorldData*)this->dataTank)->debug();
[6512]93}
Note: See TracBrowser for help on using the repository browser.