fixed erroneus handling of many players with no peer existing at same time
authorPerttu Ahola <celeron55@gmail.com>
Mon, 17 Jan 2011 22:27:14 +0000 (00:27 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 17 Jan 2011 22:27:14 +0000 (00:27 +0200)
src/environment.cpp
src/environment.h

index 17b98acd1a14a29ff3d1beebe63a459d4f432b14..6d987e3c2d1d650df046182e7549c72950e00dc1 100644 (file)
@@ -194,7 +194,8 @@ void Environment::addPlayer(Player *player)
 #ifndef SERVER
        assert(player->isLocal() == false || getLocalPlayer() == NULL);
 #endif
-       assert(getPlayer(player->peer_id) == NULL);
+       if(player->peer_id != 0)
+               assert(getPlayer(player->peer_id) == NULL);
        m_players.push_back(player);
 }
 
index 03f366b473d10b3609b656249ddc04396ec00479..fa7253170b49779fa2af3e7a6538f566211e5781 100644 (file)
@@ -73,6 +73,8 @@ public:
 
 private:
        Map *m_map;
+       // peer_ids in here should be unique, except that there may be
+       // many 0s
        core::list<Player*> m_players;
        // Debug output goes here
        std::ostream &m_dout;