[Browser] Do not show "Unreachable" servers when ping filter is enabled

new-script-api
Koncord 7 years ago
parent 01a5196a92
commit ed75563a94

@ -15,11 +15,12 @@ bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &
QModelIndex plIndex = sourceModel()->index(sourceRow, ServerData::PLAYERS, sourceParent); QModelIndex plIndex = sourceModel()->index(sourceRow, ServerData::PLAYERS, sourceParent);
QModelIndex maxPlIndex = sourceModel()->index(sourceRow, ServerData::MAX_PLAYERS, sourceParent); QModelIndex maxPlIndex = sourceModel()->index(sourceRow, ServerData::MAX_PLAYERS, sourceParent);
int ping = sourceModel()->data(pingIndex).toInt(); bool pingOk;
int ping = sourceModel()->data(pingIndex).toInt(&pingOk);
int players = sourceModel()->data(plIndex).toInt(); int players = sourceModel()->data(plIndex).toInt();
int maxPlayers = sourceModel()->data(maxPlIndex).toInt(); int maxPlayers = sourceModel()->data(maxPlIndex).toInt();
if (maxPing > 0 && (ping == -1 || ping > maxPing)) if (maxPing > 0 && (ping == -1 || ping > maxPing || !pingOk))
return false; return false;
if (filterEmpty && players == 0) if (filterEmpty && players == 0)
return false; return false;

Loading…
Cancel
Save