Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1858 in orxonox.OLD for orxonox/trunk/core/world.cc


Ignore:
Timestamp:
May 5, 2004, 7:33:27 PM (21 years ago)
Author:
patrick
Message:

orxonox/trunk/core: world draw function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/core/world.cc

    r1856 r1858  
    2424
    2525
    26 
     26/**
     27   \brief Create a new World
     28   
     29   This creates a new empty world!
     30*/
    2731World::World () {
    2832  lastPlayer = null;
     33  lastNPC = null;
    2934}
    3035
     
    5762
    5863
     64/**
     65   \brief Remove Player
     66   \param player A reference to the new npc object
     67   
     68   Remove a new Player to the game.
     69*/
     70bool World::removePlayer(Player* player) {
     71  cout << "World::removeNPC not implemented yet" << endl;
     72}
     73
     74
     75/**
     76   \brief Add Non-Player-Character
     77   \param player A reference to the new npc object
     78   
     79   Add a new Non-Player-Character to the game. Player has to be initialised previously
     80*/
     81bool World::addNPC(NPC* npc)
     82{
     83  npcList* listMember = new npcList;
     84  listMember->npc = npc;
     85  if ( lastNPC != null )
     86    {
     87      listMember->number = lastNPC->number + 1;
     88      listMember->next = lastNPC;
     89    }
     90  else
     91    {
     92      listMember->number = 0;
     93      listMember->next = null;
     94    }
     95  lastNPC = listMember;
     96}
     97
     98
     99/**
     100   \brief Remove Non-Player-Character
     101   \param player A reference to the new npc object
     102   
     103   Remove a new Non-Player-Character to the game.
     104*/
     105bool World::removeNPC(NPC* npc) {
     106  cout << "World::removeNPC not implemented yet" << endl;
     107}
     108
     109
     110
     111/**
     112   \brief Draws the World and all Objects contained
     113   
     114   Calls the draw function of all: Objects, Players, Environement
     115*/
     116void World::drawWorld(void)
     117{
     118  playerList* tmpPlayer = lastPlayer;
     119  Player* player = tmpPlayer->player;
     120  while( tmpPlayer != null )
     121    {
     122      (*tmpPlayer->player).drawPlayer();
     123      tmpPlayer = tmpPlayer->next;
     124    }
     125  npcList* tmpNPC = lastNPC;
     126  while( tmpNPC != null )
     127    {
     128      (*tmpNPC->npc).drawNPC();
     129      tmpNPC = tmpNPC->next;
     130    }
     131}
     132
     133
     134/**
     135   \brief Updates the world and all its objects
     136   
     137   Calculates the new state of the world. User-input and AI of
     138   the enemies are accounted for.
     139*/
     140void World::updateWorld(void)
     141{
     142 
     143
     144}
     145
     146
    59147
    60148/**
     
    63151   testing, testing, testing...
    64152*/
    65 void World::testThaTest()
     153void World::testThaTest(void)
    66154{
    67155  cout << "World::testThaTest() called" << endl;
     
    75163    }
    76164
     165  /* test addNPC */
     166  cout << "addNPC test..." << endl;
     167  npcList* nl = lastNPC;
     168  while ( nl != null )
     169    {
     170      cout << "npc " << nl->number << " was found" << endl;
     171      nl = nl->next;
     172    }
     173
     174  /* test drawWorld() */
     175  cout << "drawWorld()..." << endl;
     176  drawWorld();
     177
    77178  cout << "World::testThaTest() finished" << endl;
    78179}
    79 
    80 bool World::removePlayer(Player* player) {}
    81 
    82 bool World::addNPC(NPC* npc) {}
    83 bool World::removeNPC(NPC* npc) {}
Note: See TracChangeset for help on using the changeset viewer.