File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Core/GameEngine/Source/GameNetwork Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -1137,14 +1137,23 @@ LANGameInfo * LANAPI::LookupGameByListOffset( Int offset )
11371137
11381138LANGameInfo * LANAPI::LookupGameByHost ( UnsignedInt hostIP )
11391139{
1140- LANGameInfo* theGame = m_games;
1140+ LANGameInfo *latestGame = m_games;
1141+ LANGameInfo *theGame = m_games;
11411142
1142- while (theGame && theGame->getHostIP () != hostIP)
1143+ // search through games to find the last game from the host in case there are multiple
1144+ while (theGame)
11431145 {
1146+ if (theGame->getHostIP () == hostIP && theGame->getLastHeard () > latestGame->getLastHeard ())
1147+ latestGame = theGame;
1148+
11441149 theGame = theGame->getNext ();
11451150 }
11461151
1147- return theGame; // NULL means we didn't find anything.
1152+ // sanity check to verify if latest game actually exists and belongs to the host
1153+ if (latestGame && latestGame->getHostIP () == hostIP)
1154+ return latestGame;
1155+
1156+ return NULL ;
11481157}
11491158
11501159void LANAPI::removeGame ( LANGameInfo *game )
You can’t perform that action at this time.
0 commit comments