Update of /home/kde/kdegames/atlantik/libatlantikclient In directory office:/tmp/cvs-serv13838/libatlantikclient Modified Files: atlantik_network.cpp atlantik_network.h Log Message: monopd 0.6.0 API fixes, okayed by Will Andrews (#kde-freebsd) Index: atlantik_network.cpp =================================================================== RCS file: /home/kde/kdegames/atlantik/libatlantikclient/atlantik_network.cpp,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- atlantik_network.cpp 2002/09/11 03:49:59 1.61 +++ atlantik_network.cpp 2002/10/23 15:56:41 1.62 @@ -38,7 +38,7 @@ { m_atlanticCore = atlanticCore; m_parent = parent; - m_clientId = m_playerId = -1; + m_playerId = -1; QObject::connect(this, SIGNAL(readyRead()), this, SLOT(slotRead())); } @@ -270,31 +270,6 @@ } else if (e.tagName() == "display") { - QString caption = e.attributeNode(QString("name")).value(); - QString description = e.attributeNode(QString("description")).value(); - - if (caption.isEmpty() && description.isEmpty()) - emit displayDefault(); - else - { - emit displayText(caption, description); - - bool hasButtons = false; - for(QDomNode nButtons = n.firstChild() ; !nButtons.isNull() ; nButtons = nButtons.nextSibling() ) - { - QDomElement eButton = nButtons.toElement(); - if (!eButton.isNull() && eButton.tagName() == "button") - { - emit addCommandButton(eButton.attributeNode(QString("command")).value(), eButton.attributeNode(QString("caption")).value(), eButton.attributeNode(QString("enabled")).value().toInt()); - hasButtons = true; - } - } - if (!hasButtons) - emit addCloseButton(); - } - } - else if (e.tagName() == "estatedisplay") - { int estateId = -1; a = e.attributeNode(QString("estateid")); @@ -305,6 +280,8 @@ if ((estate = m_estates[a.value().toInt()])) { emit displayEstate(estate); + // TODO: merge into displayEstate, or statusbar + emit msgInfo(e.attributeNode(QString("text")).value()); bool hasButtons = false; for( QDomNode nButtons = n.firstChild() ; !nButtons.isNull() ; nButtons = nButtons.nextSibling() ) @@ -323,6 +300,8 @@ if (!hasButtons) emit addCloseButton(); } + else + displayDefault(); } } else if (e.tagName() == "updategamelist") @@ -362,22 +341,11 @@ if (!e_player.isNull() && e_player.tagName() == "player") { if (type=="del") - emit playerListDel(e_player.attributeNode(QString("clientid")).value()); + emit playerListDel(e_player.attributeNode(QString("playerid")).value()); else if (type=="edit") - emit playerListEdit(e_player.attributeNode(QString("clientid")).value(), e_player.attributeNode(QString("name")).value(), e_player.attributeNode(QString("host")).value()); + emit playerListEdit(e_player.attributeNode(QString("playerid")).value(), e_player.attributeNode(QString("name")).value(), e_player.attributeNode(QString("host")).value()); else if (type=="add" || type=="full") - { - int playerId = -1; - a = e_player.attributeNode(QString("playerid")); - if (!a.isNull()) - playerId = a.value().toInt(); - - a = e_player.attributeNode(QString("clientid")); - if (!a.isNull() && a.value().toInt() == m_clientId) - m_playerId = playerId; - emit playerListAdd(e_player.attributeNode(QString("clientid")).value(), e_player.attributeNode(QString("name")).value(), e_player.attributeNode(QString("host")).value()); - } } n_player = n_player.nextSibling(); } @@ -385,21 +353,14 @@ } else if (e.tagName() == "client") { - a = e.attributeNode(QString("clientid")); + a = e.attributeNode(QString("playerid")); if (!a.isNull()) { - m_clientId = a.value().toInt(); + m_playerId = a.value().toInt(); // TODO: move to Atlantik::slotNetworkConnected(), not needed on auto-join cmdGamesList(); } } - else if (e.tagName() == "newturn") - { - Player *player = m_playerMap[e.attributeNode(QString("player")).value().toInt()]; - if (player) - // Update *all* objects - m_atlanticCore->setCurrentTurn(player); - } else if (e.tagName() == "configupdate") { int gameId = -1; @@ -473,6 +434,10 @@ if (player && !a.isNull()) player->setMoney(a.value().toInt()); + a = e.attributeNode(QString("hasturn")); + if (player && !a.isNull()) + player->setHasTurn(a.value().toInt()); + // Update whether player can roll a = e.attributeNode(QString("can_roll")); if (player && !a.isNull()) @@ -520,21 +485,27 @@ } else if (e.tagName() == "estategroupupdate") { - a = e.attributeNode(QString("name")); + a = e.attributeNode(QString("estategroupid")); if (!a.isNull()) { + int groupId = a.value().toInt(); + EstateGroup *estateGroup; bool b_newEstateGroup = false; - if (!(estateGroup = m_estateGroups[a.value()])) + if (!(estateGroup = m_estateGroups[groupId])) { // Create EstateGroup object - estateGroup = m_atlanticCore->newEstateGroup(a.value()); - m_estateGroups[a.value()] = estateGroup; + estateGroup = m_atlanticCore->newEstateGroup(a.value().toInt()); + m_estateGroups[groupId] = estateGroup; b_newEstateGroup = true; } + a = e.attributeNode(QString("name")); + if (estateGroup && !a.isNull()) + estateGroup->setName(a.value()); + // Emit signal so GUI implementations can create view(s) // TODO: port to atlanticcore and create view there if (estateGroup) @@ -605,7 +576,7 @@ a = e.attributeNode(QString("group")); if (!a.isNull()) { - EstateGroup *estateGroup = m_estateGroups[a.value()]; + EstateGroup *estateGroup = m_estateGroups[a.value().toInt()]; if (estate) estate->setEstateGroup(estateGroup); } Index: atlantik_network.h =================================================================== RCS file: /home/kde/kdegames/atlantik/libatlantikclient/atlantik_network.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- atlantik_network.h 2002/09/11 03:46:37 1.32 +++ atlantik_network.h 2002/10/23 15:56:41 1.33 @@ -167,13 +167,13 @@ QObject *m_parent; QDomDocument msg; - int m_clientId, m_playerId; + int m_playerId; QMap m_playerMap; QMap m_playerRevMap; QMap m_playerLocationMap; QMap m_estates; - QMap m_estateGroups; + QMap m_estateGroups; QMap m_trades; QMap m_auctions; }; _______________________________________________ atlantik-cvs mailing list atlantik-cvs@mail.kde.org http://mail.kde.org/mailman/listinfo/atlantik-cvs