From 03e65c78d1bc08bdaee86cf09a4dd8735b6a9fdd Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 12 Oct 2008 16:51:32 +0000 Subject: [FIX] Fleshing out Signet more [DEL] Unused top-level directories git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@275 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- signet/Room.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'signet/Room.cpp') diff --git a/signet/Room.cpp b/signet/Room.cpp index 2ed9732c..461ad437 100644 --- a/signet/Room.cpp +++ b/signet/Room.cpp @@ -18,28 +18,47 @@ // Header include #include "Room.h" +// Signet includes +#include "Table.h" + Signet::Room::Room(const QString& name, QObject* parent) : - QObject(parent), + ConnectionHandler(parent), m_name(name) { } -bool Signet::Room::addClient(Client* client) +QString Signet::Room::type() const +{ + return "room"; +} + +QString Signet::Room::name() const { - // TODO: Estabish a connection with the client + return m_name; } void Signet::Room::createTable(const QString& table) { - // TODO: Create a table + if (m_tables.contains(table)) + return; + m_tables[table] = new Table(table, this); } void Signet::Room::closeTable(const QString& table) { - // TODO: Close a table + if (m_tables.contains(table)) + { + delete m_tables[table]; + m_tables.remove(table); + } } bool Signet::Room::joinTable(Client* client, const QString& tableName) { - // TODO: Add a client to the table + if (!m_tables.contains(tableName)) + createTable(tableName); + if (!m_tables[tableName]->addClient(client)) + { + // TODO: Let the client know about the error. + } } -- cgit