RoboCatPtr Server::GetCatForPlayer( int inPlayerId ) { //run through the objects till we find the cat... //it would be nice if we kept a pointer to the cat on the clientproxy //but then we'd have to clean it up when the cat died, etc. //this will work for now until it's a perf issue const auto& gameObjects = World::sInstance->GetGameObjects(); for( int i = 0, c = gameObjects.size(); i < c; ++i ) { GameObjectPtr go = gameObjects[ i ]; RoboCat* cat = go->GetAsCat(); if( cat && cat->GetPlayerId() == inPlayerId ) { return std::static_pointer_cast< RoboCat >( go ); } } return nullptr; }