void FriendsListDialog::slot_popupTalk(void) { Talk * talk; talk = connection->getTalk(popup_playerlisting); if(talk) talk->updatePlayerListing(); }
void FriendsListDialog::slot_playersDoubleClickedWatches(const QModelIndex & index) { PlayerListing * opponent = watchesListModel->playerListingFromIndex(index); Talk * talk = room->getTalk(opponent); if(talk) talk->updatePlayerListing(); }
void FriendsListDialog::slot_playersDoubleClickedWatches(const QModelIndex & index) { //QModelIndex translated = playerSortProxy->mapToSource(index); PlayerListing * opponent = watchesListModel->playerListingFromIndex(index); Talk * talk; talk = connection->getTalk(opponent); if(talk) talk->updatePlayerListing(); }
/* This isn't really just a "sendStats" function anymore, that's * done by the talk object I think and... well its ugly, responsibilities * are crossed, etc.. FIXME */ void Room::sendStatsRequest(PlayerListing & opponent) { Talk * talk; /* Whenever a talk window is opened, we want stats. This * means its easier to create the talk window and let it * always create stats, then send out stats messages * that generate talk windows */ /* This is a little weird now...almost like we're just asking * for an update on the references */ talk = connection->getTalk(&opponent); //connection->sendStatsRequest(opponent); /* This is really only for ORO, and let's see if it works but... */ if(talk) talk->updatePlayerListing(); }
void Room::recvPlayerListing(PlayerListing * player) { if(!player->online) { #ifdef VIEWTESTDEBUG if(player->name == "REMOVEMENOTAPLAYER") { int i; delete player; player = 0; do { i = rand() % players; } while(!(player = playerListingIDRegistry->getIfEntry(i))); player->online = false; } #endif //VIEWTESTDEBUG removed_player[player] = player->playing; #ifdef PLAYERLISTING_ISSUES qDebug("Removing player %s %p on attached game %d", player->name.toLatin1().constData(), player, player->playing); #endif //PLAYERLISTING_ISSUES /* To prevent crashes due to GameListing link to PlayerListing * FIXME */ if(player->playing) { /* FIXME, something should clear this when games end */ GameListing * g = getGameListing(player->playing); if(g) { if(g->black == player) { g->black = 0; g->_black_name = player->name; g->_black_rank = player->rank; } else if(g->white == player) { g->white = 0; g->_white_name = player->name; g->_white_rank = player->rank; } } } if(player->observing) { /* FIXME remove this check, room_list should be sufficient */ /* FIXME, something should clear this when games end */ BoardDispatch * b = connection->getIfBoardDispatch(player->observing); if(b) { #ifdef PLAYERLISTING_ISSUES qDebug("Removing player %s on observing game %d", player->name.toLatin1().constData(), player->observing); #endif //PLAYERLISTING_ISSUES b->recvObserver(player, false); } if(player->dialog_opened) connection->closeTalk(player); } std::vector<unsigned short>::iterator room_listit = player->room_list.begin(); while(room_listit != player->room_list.end()) { BoardDispatch * boarddispatch = connection->getIfBoardDispatch(*room_listit); if(boarddispatch) boarddispatch->recvObserver(player, false); else player->room_list.erase(room_listit); room_listit = player->room_list.begin(); } if(player->friendWatchType != PlayerListing::none) connection->getAndSetFriendWatchType(*player); //removes } PlayerListing * registered_player = 0; if(player->online) connection->getAndSetFriendWatchType(*player); if(connection->playerTrackingByID()) { if(player->online) registered_player = playerListModel->getEntry(player->id, player); else playerListModel->deleteEntry(player->id); } else { if(player->online) registered_player = playerListModel->getEntry(player->name, player); else playerListModel->deleteEntry(player->name); } if(registered_player && player->online) { /* FIXME consider changing name of getEntry with the object? * so that its more clear that it returns a new stored object * based on the one passed. (i.e., looking it up if * alread there)*/ if(player->dialog_opened) { Talk * t = connection->getIfTalk(player); if(t) t->updatePlayerListing(); else qDebug("dialog_opened flag set but no talk dialog"); } } /* This is just for those listing bugs... its weird...remove it * soon */ if(registered_player && player->online) { std::map<PlayerListing *, unsigned short>::iterator it; it = removed_player.find(registered_player); if(it != removed_player.end()) removed_player.erase(it); } }