Skip to content
Merged
59 changes: 20 additions & 39 deletions DependentExtensions/Lobby2/Rooms/RoomsContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1224,20 +1224,15 @@ RoomsErrorCode PerGameRoomsContainer::SearchByFilter( RoomsParticipant* roomsPar
roomsTable.QueryTable(columnIndices,1,roomQuery->queries,roomQuery->numQueries,0,0,&resultTable);

roomsOutput.Clear(false, _FILE_AND_LINE_);
DataStructures::Page<unsigned, DataStructures::Table::Row*, _TABLE_BPLUS_TREE_ORDER> *cur = resultTable.GetRows().GetListHead();
int i;
const std::map<unsigned, DataStructures::Table::Row*> &resultRows = resultTable.GetRows();
Room *room;
while (cur)
for (std::map<unsigned, DataStructures::Table::Row*>::const_iterator it = resultRows.begin(); it != resultRows.end(); ++it)
{
for (i=0; i < cur->size; i++)
{
// Put all the pointers in the roomSort list, filtering out those you cannot join (full, or no public and you are not invited)
room = (Room*) cur->data[i]->cells[0]->ptr;
if ( (onlyJoinable==false || room->ParticipantCanJoinRoom(roomsParticipant, false, true)==PCJRR_SUCCESS) &&
room->IsHiddenToParticipant(roomsParticipant)==false)
roomsOutput.Insert(room,room,true, _FILE_AND_LINE_ );
}
cur=cur->next;
// Put all the pointers in the roomSort list, filtering out those you cannot join (full, or no public and you are not invited)
room = (Room*) it->second->cells[0]->ptr;
if ( (onlyJoinable==false || room->ParticipantCanJoinRoom(roomsParticipant, false, true)==PCJRR_SUCCESS) &&
room->IsHiddenToParticipant(roomsParticipant)==false)
roomsOutput.Insert(room,room,true, _FILE_AND_LINE_ );
}
return REC_SUCCESS;
}
Expand Down Expand Up @@ -1271,19 +1266,15 @@ void PerGameRoomsContainer::RoomPrioritySort( RoomsParticipant* roomsParticipant
roomsTable.QueryTable(columnIndices,1,roomQuery->queries,roomQuery->numQueries,0,0,&resultTable);

roomsOutput.Clear(false, _FILE_AND_LINE_);
DataStructures::Page<unsigned, DataStructures::Table::Row*, _TABLE_BPLUS_TREE_ORDER> *cur = resultTable.GetRows().GetListHead();
const std::map<unsigned, DataStructures::Table::Row*> &resultRows = resultTable.GetRows();
Room *room;
while (cur)
for (std::map<unsigned, DataStructures::Table::Row*>::const_iterator it = resultRows.begin(); it != resultRows.end(); ++it)
{
for (i=0; i < cur->size; i++)
{
// Put all the pointers in the roomSort list, filtering out those you cannot join (full, or no public and you are not invited)
room = (Room*) cur->data[i]->cells[0]->ptr;
if (room->ParticipantCanJoinRoom(roomsParticipant, false, true)==PCJRR_SUCCESS &&
room->IsHiddenToParticipant(roomsParticipant)==false)
roomsOutput.Insert(room,room,true, _FILE_AND_LINE_ );
}
cur=cur->next;
// Put all the pointers in the roomSort list, filtering out those you cannot join (full, or no public and you are not invited)
room = (Room*) it->second->cells[0]->ptr;
if (room->ParticipantCanJoinRoom(roomsParticipant, false, true)==PCJRR_SUCCESS &&
room->IsHiddenToParticipant(roomsParticipant)==false)
roomsOutput.Insert(room,room,true, _FILE_AND_LINE_ );
}
}
Room* PerGameRoomsContainer::GetRoomByLobbyRoomID(RoomID lobbyRoomID)
Expand All @@ -1310,27 +1301,17 @@ Room * PerGameRoomsContainer::GetRoomByName(MafiaNet::RakString roomName)
}
void PerGameRoomsContainer::GetAllRooms(DataStructures::List<Room*> &rooms)
{
DataStructures::Page<unsigned, DataStructures::Table::Row*, _TABLE_BPLUS_TREE_ORDER> *cur = roomsTable.GetRows().GetListHead();
int i;
const std::map<unsigned, DataStructures::Table::Row*> &allRows = roomsTable.GetRows();
rooms.Clear(false, _FILE_AND_LINE_);
while (cur)
{
for (i=0; i < cur->size; i++)
rooms.Insert((Room*)cur->data[i]->cells[DefaultRoomColumns::TC_LOBBY_ROOM_PTR]->ptr, _FILE_AND_LINE_ );
cur=cur->next;
}
for (std::map<unsigned, DataStructures::Table::Row*>::const_iterator it = allRows.begin(); it != allRows.end(); ++it)
rooms.Insert((Room*)it->second->cells[DefaultRoomColumns::TC_LOBBY_ROOM_PTR]->ptr, _FILE_AND_LINE_ );
}
void PerGameRoomsContainer::GetRoomNames(DataStructures::List<MafiaNet::RakString> &roomNames)
{
DataStructures::Page<unsigned, DataStructures::Table::Row*, _TABLE_BPLUS_TREE_ORDER> *cur = roomsTable.GetRows().GetListHead();
int i;
const std::map<unsigned, DataStructures::Table::Row*> &nameRows = roomsTable.GetRows();
roomNames.Clear(false, _FILE_AND_LINE_);
while (cur)
{
for (i=0; i < cur->size; i++)
roomNames.Insert(MafiaNet::RakString(cur->data[i]->cells[DefaultRoomColumns::TC_ROOM_NAME]->c), _FILE_AND_LINE_ );
cur=cur->next;
}
for (std::map<unsigned, DataStructures::Table::Row*>::const_iterator it = nameRows.begin(); it != nameRows.end(); ++it)
roomNames.Insert(MafiaNet::RakString(it->second->cells[DefaultRoomColumns::TC_ROOM_NAME]->c), _FILE_AND_LINE_ );
}

unsigned int PerGameRoomsContainer::GetQuickJoinIndex(RoomsParticipant* roomsParticipant)
Expand Down
6 changes: 1 addition & 5 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,10 @@ set(MAFIANET_HEADERS
include/mafianet/directory_delta_transfer.h
include/mafianet/dr_sha1.h
include/mafianet/ds_binary_search_tree.h
include/mafianet/ds_bplus_tree.h
include/mafianet/ds_byte_pool.h
include/mafianet/ds_byte_queue.h
include/mafianet/ds_hash.h
include/mafianet/ds_heap.h
include/mafianet/weighted_heap.h
include/mafianet/ds_huffman_encoding_tree.h
include/mafianet/ds_huffman_encoding_tree_factory.h
include/mafianet/ds_huffman_encoding_tree_node.h
Expand All @@ -169,15 +168,12 @@ set(MAFIANET_HEADERS
include/mafianet/ds_map.h
include/mafianet/ds_memory_pool.h
include/mafianet/ds_multilist.h
include/mafianet/ds_ordered_channel_heap.h
include/mafianet/ds_ordered_list.h
include/mafianet/ds_queue.h
include/mafianet/ds_queue_linked_list.h
include/mafianet/ds_range_list.h
include/mafianet/ds_table.h
include/mafianet/ds_threadsafe_allocating_queue.h
include/mafianet/ds_tree.h
include/mafianet/ds_weighted_graph.h
include/mafianet/dyn_dns.h
include/mafianet/email_sender.h
include/mafianet/empty_header.h
Expand Down
2 changes: 1 addition & 1 deletion Source/include/mafianet/connection_graph2.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "mafianet/types.h"
#include "mafianet/plugin_interface2.h"
#include "mafianet/ds_list.h"
#include "mafianet/ds_weighted_graph.h"
#include "mafianet/ds_ordered_list.h"
#include "mafianet/get_time.h"
#include "mafianet/export.h"

Expand Down
Loading
Loading