HRESULT CADsSearch::GetColumn(CString &sCol, CStringList &sList ) { LPWSTR pszAttrName; ADS_SEARCH_COLUMN col; HRESULT hr; USES_CONVERSION; CString s; pszAttrName = T2OLE(sCol); hr = m_pSearch->GetColumn( m_hSearch, pszAttrName, &col ); if ( !SUCCEEDED(hr) ) { return hr; } hr = FormatColumn( &col, sList ); m_pSearch->FreeColumn( &col ); return hr; }
/* ======================== idMenuScreen_Shell_Leaderboards::RefreshLeaderboard ======================== */ void idMenuScreen_Shell_Leaderboards::RefreshLeaderboard() { if ( refreshWhenMasterIsOnline ) { SetLeaderboardIndex(); refreshWhenMasterIsOnline = false; } if ( !refreshLeaderboard ) { return; } refreshLeaderboard = false; bool upArrow = false; bool downArrow = false; int focusIndex = -1; idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > lbListings; if ( !lbCache->IsLoadingNewLeaderboard() && lbCache->GetErrorCode() == LEADERBOARD_DISPLAY_ERROR_NONE ) { for ( int addIndex = 0; addIndex < MAX_STAT_LISTINGS; ++addIndex ) { idList< idStr > values; int index = lbCache->GetRowOffset() + addIndex; const idLeaderboardCallback::row_t * row = lbCache->GetLeaderboardRow( index ); // If this row is not in the cache, this will kick off a request if ( row != NULL ) { values.Append( va( "%i", (int)row->rank ) ); values.Append( row->name ); values.Append( FormatColumn( &lbCache->GetLeaderboard()->columnDefs[0], row->columns[0] ).ToString() ); } if ( lbCache->GetEntryIndex() == addIndex ) { focusIndex = addIndex; } lbListings.Append( values ); } if ( lbCache->GetRowOffset() != 0 ) { upArrow = true; } if ( ( lbCache->GetRowOffset() + MAX_STAT_LISTINGS ) < lbCache->GetNumRowsInLeaderboard() ) { downArrow = true; } } if ( lbHeading != NULL ) { lbHeading->SetText( leaderboards[ lbIndex ].name ); lbHeading->SetStrokeInfo( true, 0.75f, 1.75f ); } if ( focusIndex >= 0 ) { options->SetFocusIndex( focusIndex ); } if ( btnPageDwn != NULL && btnPageDwn->GetSprite() != NULL ) { btnPageDwn->GetSprite()->SetVisible( downArrow ); } if ( btnPageUp != NULL && btnPageUp->GetSprite() != NULL ) { btnPageUp->GetSprite()->SetVisible( upArrow ); } options->SetListData( lbListings ); Update(); const char * leaderboardErrorStrings[] = { "", "#str_online_leaderboards_error_failed", // failed "", // not online - players are just taken back to multiplayer menu "#str_online_leaderboards_error_not_ranked", // not ranked }; compile_time_assert( sizeof( leaderboardErrorStrings ) / sizeof( leaderboardErrorStrings[0] ) == LEADERBOARD_DISPLAY_ERROR_MAX ); bool isLoading = lbCache->IsLoadingNewLeaderboard(); idStr error = leaderboardErrorStrings[ lbCache->GetErrorCode() ]; if ( isLoading ) { ShowMessage( true, "#str_online_loading", true ); } else { if ( !error.IsEmpty() ) { ShowMessage( true, error, false ); } else { if ( lbCache->GetNumRowsInLeaderboard() > 0 ) { ShowMessage( false, "", false ); } else { ShowMessage( true, "#str_online_leaderboards_no_data", false ); } } } }