Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 11, 2006, 5:06:43 PM (18 years ago)
Author:
patrick
Message:

network: playable creation fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/story_entities/multi_player_world_data.cc

    r6466 r6493  
    160160        }
    161161      }
    162       else if( !strcmp( element->Value(), "SpaceShip"))       /// FIXME it is not said to be a SpaceShip
    163       {
    164         BaseObject* created = NetworkGameManager::getInstance()->createEntity(element);
    165         if( created != NULL )
    166           PRINTF(1)("Created a %s: %s (%8.u)\n", created->getClassName(), created->getName(), created->getLeafClassID());
    167         else
    168           PRINTF(1)("MultiPlayerWorld: could not create this entity\n");
    169       }
    170162      element = element->NextSiblingElement();
     163
    171164
    172165      glmis->step();
     
    174167    }
    175168
    176 
    177     /* create a Player */
    178     this->localPlayer = new Player();
    179 //     Playable* playable;
    180 //     const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
    181 //     assert( playableList != NULL);
    182 //
    183 //     if (playableList != NULL)
    184 //     {
    185 //       playable = dynamic_cast<Playable*>(playableList->front());
    186 //       this->localPlayer->setControllable(playable);
    187 //     }
     169    if( NetworkManager::getInstance()->isGameServer())
     170    {
     171      this->localPlayer = new Player();
     172      State::setPlayer(this->localPlayer);
     173
     174      Playable* playable;
     175      const std::list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
     176      assert( playableList != NULL);
     177
     178      if (playableList != NULL)
     179      {
     180        playable = dynamic_cast<Playable*>(playableList->front());
     181        this->localPlayer->setControllable(playable);
     182      }
     183    }
     184    else
     185    {
     186      /* create a Player */
     187      this->localPlayer = new Player();
     188      State::setPlayer(this->localPlayer);
     189    }
     190
    188191
    189192    /* init the pnode tree */
Note: See TracChangeset for help on using the changeset viewer.