--- a/QTfrontend/model/roomslistmodel.cpp Fri Nov 15 14:41:36 2013 -0500
+++ b/QTfrontend/model/roomslistmodel.cpp Mon Nov 18 00:44:30 2013 +0400
@@ -30,7 +30,7 @@
RoomsListModel::RoomsListModel(QObject *parent) :
QAbstractTableModel(parent),
- c_nColumns(8)
+ c_nColumns(9)
{
m_headerData =
QStringList()
@@ -40,6 +40,7 @@
<< tr("T")
<< tr("Owner")
<< tr("Map")
+ << tr("Script")
<< tr("Rules")
<< tr("Weapons");
--- a/QTfrontend/net/newnetclient.cpp Fri Nov 15 14:41:36 2013 -0500
+++ b/QTfrontend/net/newnetclient.cpp Mon Nov 18 00:44:30 2013 +0400
@@ -311,14 +311,12 @@
if (lst[0] == "ROOMS")
{
- if(lst.size() % 8 != 1)
+ if(lst.size() % 9 != 1)
{
qWarning("Net: Malformed ROOMS message");
return;
}
- QStringList tmp = lst;
- tmp.removeFirst();
- m_roomsListModel->setRoomsList(tmp);
+ m_roomsListModel->setRoomsList(lst.mid(1));
if (m_private_game == false && m_nick_registered == false)
{
emit NickNotRegistered(mynick);
@@ -406,7 +404,7 @@
return;
}
- if (lst[0] == "CLIENT_FLAGS")
+ if (lst[0] == "CLIENT_FLAGS" || lst[0] == "CF")
{
if(lst.size() < 3 || lst[1].size() < 2)
{
@@ -527,7 +525,7 @@
return;
}
- if(lst[0] == "ROOM" && lst.size() == 10 && lst[1] == "ADD")
+ if(lst[0] == "ROOM" && lst.size() == 11 && lst[1] == "ADD")
{
QStringList tmp = lst;
tmp.removeFirst();
@@ -537,7 +535,7 @@
return;
}
- if(lst[0] == "ROOM" && lst.size() == 11 && lst[1] == "UPD")
+ if(lst[0] == "ROOM" && lst.size() == 12 && lst[1] == "UPD")
{
QStringList tmp = lst;
tmp.removeFirst();
@@ -627,12 +625,6 @@
return;
}
- if (lst[0] == "ADMIN_ACCESS")
- {
- // obsolete, see +a client flag
- return;
- }
-
if(lst[0] == "JOINING")
{
if(lst.size() < 2)
@@ -818,17 +810,6 @@
m_playersModel->playerLeftRoom(lst[1]);
return;
}
-
- // obsolete
- if (lst[0] == "ROOM_CONTROL_ACCESS")
- {
- if (lst.size() < 2)
- {
- qWarning("Net: Bad ROOM_CONTROL_ACCESS message");
- return;
- }
- return;
- }
}
qWarning() << "Net: Unknown message or wrong state:" << lst;
--- a/QTfrontend/ui/page/pageroomslist.cpp Fri Nov 15 14:41:36 2013 -0500
+++ b/QTfrontend/ui/page/pageroomslist.cpp Mon Nov 18 00:44:30 2013 +0400
@@ -169,38 +169,9 @@
stateMenu->addAction(showGamesInProgress);
btnState->setMenu(stateMenu);
- // Rules dropdown
-
- CBRules = new QComboBox(this);
- CBRules->setStyleSheet("QComboBox { border-top-left-radius: 0px; border-bottom-left-radius: 0px; border-left-width: 2px; }");
-
- QLabel * ruleLabel = new QLabel(tr("Rules:"), this);
- ruleLabel->setFixedHeight(CBRules->height());
- ruleLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- ruleLabel->setStyleSheet("border: solid; border-width: 3px; border-right-width: 0px; border-color: #ffcc00; border-top-left-radius: 10px; border-bottom-left-radius: 10px; background-color: rgba(13, 5, 68, 70%);");
-
- filterLayout->addWidget(ruleLabel);
- filterLayout->addWidget(CBRules);
- filterLayout->addSpacing(filterSpacing);
-
- // Weapons dropdown
-
- CBWeapons = new QComboBox(this);
- CBWeapons->setStyleSheet("QComboBox { border-top-left-radius: 0px; border-bottom-left-radius: 0px; border-left-width: 2px; }");
-
- QLabel * weaponLabel = new QLabel(tr("Weapons:"), this);
- weaponLabel->setFixedHeight(CBWeapons->height());
- weaponLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- weaponLabel->setStyleSheet("border: solid; border-width: 3px; border-right-width: 0px; border-color: #ffcc00; border-top-left-radius: 10px; border-bottom-left-radius: 10px; background-color: rgba(13, 5, 68, 70%);");
-
- filterLayout->addWidget(weaponLabel);
- filterLayout->addWidget(CBWeapons);
- filterLayout->addSpacing(filterSpacing);
-
// Clear filters button
BtnClear = addButton(tr("Clear filters"), filterLayout, 0);
- weaponLabel->setFixedHeight(CBWeapons->height());
BtnClear->setStyleSheet("padding: 4px;");
// Lobby chat
@@ -208,8 +179,6 @@
chatWidget = new HWChatWidget(this, false);
m_splitter->addWidget(chatWidget);
- CBRules->addItem(QComboBox::tr("Any"));
-
return pageLayout;
}
@@ -238,8 +207,6 @@
connect(roomsList, SIGNAL(clicked (const QModelIndex &)), searchText, SLOT(setFocus()));
connect(showGamesInLobby, SIGNAL(triggered()), this, SLOT(onFilterChanged()));
connect(showGamesInProgress, SIGNAL(triggered()), this, SLOT(onFilterChanged()));
- connect(CBRules, SIGNAL(currentIndexChanged (int)), this, SLOT(onFilterChanged()));
- connect(CBWeapons, SIGNAL(currentIndexChanged (int)), this, SLOT(onFilterChanged()));
connect(searchText, SIGNAL(textChanged (const QString &)), this, SLOT(onFilterChanged()));
connect(this, SIGNAL(askJoinConfirmation (const QString &)), this, SLOT(onJoinConfirmation(const QString &)), Qt::QueuedConnection);
@@ -273,22 +240,8 @@
{
roomsModel = NULL;
stateFilteredModel = NULL;
- schemeFilteredModel = NULL;
- weaponsFilteredModel = NULL;
initPage();
-
- // not the most elegant solution but it works
- ammoSchemeModel = new AmmoSchemeModel(this, NULL);
- for (int i = 0; i < ammoSchemeModel->predefSchemesNames.count(); i++)
- CBRules->addItem(ammoSchemeModel->predefSchemesNames.at(i).toAscii().constData());
-
- CBWeapons->addItem(QComboBox::tr("Any"));
- for (int i = 0; i < cDefaultAmmos.count(); i++)
- {
- QPair<QString,QString> ammo = cDefaultAmmos.at(i);
- CBWeapons->addItem(ammo.first.toAscii().constData());
- }
}
@@ -582,8 +535,6 @@
{
showGamesInLobby->setChecked(true);
showGamesInProgress->setChecked(true);
- CBRules->setCurrentIndex(0);
- CBWeapons->setCurrentIndex(0);
searchText->clear();
searchText->setFocus();
}
@@ -628,25 +579,15 @@
roomsModel->sort(RoomsListModel::StateColumn, Qt::AscendingOrder);
stateFilteredModel = new QSortFilterProxyModel(this);
- schemeFilteredModel = new QSortFilterProxyModel(this);
- weaponsFilteredModel = new QSortFilterProxyModel(this);
stateFilteredModel->setDynamicSortFilter(true);
- schemeFilteredModel->setDynamicSortFilter(true);
- weaponsFilteredModel->setDynamicSortFilter(true);
roomsModel->setFilterKeyColumn(-1); // search in all columns
stateFilteredModel->setFilterKeyColumn(RoomsListModel::StateColumn);
- schemeFilteredModel->setFilterKeyColumn(RoomsListModel::SchemeColumn);
- weaponsFilteredModel->setFilterKeyColumn(RoomsListModel::WeaponsColumn);
roomsModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
- schemeFilteredModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
- weaponsFilteredModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
- schemeFilteredModel->setSourceModel(stateFilteredModel);
- weaponsFilteredModel->setSourceModel(schemeFilteredModel);
- roomsModel->setSourceModel(weaponsFilteredModel);
+ roomsModel->setSourceModel(stateFilteredModel);
// let the table view display the last model in the filter chain
roomsList->setModel(roomsModel);
@@ -660,8 +601,6 @@
stateFilteredModel->setSourceModel(model);
- roomsList->hideColumn(RoomsListModel::StateColumn);
-
QHeaderView * h = roomsList->horizontalHeader();
h->setSortIndicatorShown(true);
@@ -678,6 +617,8 @@
h->resizeSection(RoomsListModel::WeaponsColumn, 100);
}
+ // hide column used for filtering
+ roomsList->hideColumn(RoomsListModel::StateColumn);
// save header state on change
connect(roomsList->horizontalHeader(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)),
@@ -714,29 +655,17 @@
if (roomsModel == NULL)
return;
- roomsModel->setFilterWildcard(QString("*%1*").arg(searchText->text()));
+ roomsModel->setFilterFixedString(searchText->text());
bool stateLobby = showGamesInLobby->isChecked();
bool stateProgress = showGamesInProgress->isChecked();
if (stateLobby && stateProgress)
- stateFilteredModel->setFilterWildcard("*"); // "any"
+ stateFilteredModel->setFilterFixedString(QString()); // "any"
else if (stateLobby != stateProgress)
stateFilteredModel->setFilterFixedString(QString(stateProgress));
else
stateFilteredModel->setFilterFixedString(QString("none")); // Basically, none.
-
- if (CBRules->currentIndex() == 0)
- schemeFilteredModel->setFilterWildcard("*"); // "any"
- else
- schemeFilteredModel->setFilterWildcard(
- QString("*%1*").arg(CBRules->currentText()));
-
- if (CBWeapons->currentIndex() == 0)
- weaponsFilteredModel->setFilterWildcard("*"); // "any"
- else
- weaponsFilteredModel->setFilterWildcard(
- QString("*%1*").arg(CBWeapons->currentText()));
}
void PageRoomsList::setSettings(QSettings *settings)
--- a/QTfrontend/ui/page/pageroomslist.h Fri Nov 15 14:41:36 2013 -0500
+++ b/QTfrontend/ui/page/pageroomslist.h Mon Nov 18 00:44:30 2013 +0400
@@ -57,8 +57,6 @@
QPushButton * BtnAdmin;
QPushButton * BtnClear;
QComboBox * CBState;
- QComboBox * CBRules;
- QComboBox * CBWeapons;
HWChatWidget * chatWidget;
QLabel * lblCount;
@@ -98,8 +96,6 @@
QSettings * m_gameSettings;
QSortFilterProxyModel * roomsModel;
QSortFilterProxyModel * stateFilteredModel;
- QSortFilterProxyModel * schemeFilteredModel;
- QSortFilterProxyModel * weaponsFilteredModel;
QAction * showGamesInLobby;
QAction * showGamesInProgress;
QSplitter * m_splitter;
--- a/gameServer/Actions.hs Fri Nov 15 14:41:36 2013 -0500
+++ b/gameServer/Actions.hs Mon Nov 18 00:44:30 2013 +0400
@@ -242,7 +242,7 @@
newRoom' <- io $ room'sM rnc id ri
chans <- liftM (map sendChan) $! sameProtoClientsS proto
- processAction $ AnswerClients chans ("ROOM" : "UPD" : oldRoomName : roomInfo (nick newMaster) newRoom')
+ processAction $ AnswerClients chans ("ROOM" : "UPD" : oldRoomName : roomInfo proto(nick newMaster) newRoom')
processAction (AddRoom roomName roomPassword) = do
@@ -265,7 +265,7 @@
chans <- liftM (map sendChan) $! sameProtoClientsS proto
mapM_ processAction [
- AnswerClients chans ("ROOM" : "ADD" : roomInfo n rm{playersIn = 1})
+ AnswerClients chans ("ROOM" : "ADD" : roomInfo proto n rm{playersIn = 1})
]
@@ -294,7 +294,7 @@
rm <- io $ room'sM rnc id ri
n <- io $ client'sM rnc nick (masterID rm)
chans <- liftM (map sendChan) $! sameProtoClientsS proto
- processAction $ AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo n rm)
+ processAction $ AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo proto n rm)
processAction UnreadyRoomClients = do
--- a/gameServer/Consts.hs Fri Nov 15 14:41:36 2013 -0500
+++ b/gameServer/Consts.hs Mon Nov 18 00:44:30 2013 +0400
@@ -4,4 +4,4 @@
import qualified Data.ByteString.Char8 as B
serverVersion :: B.ByteString
-serverVersion = "1"
+serverVersion = "2"
--- a/gameServer/HWProtoInRoomState.hs Fri Nov 15 14:41:36 2013 -0500
+++ b/gameServer/HWProtoInRoomState.hs Mon Nov 18 00:44:30 2013 +0400
@@ -294,7 +294,7 @@
[Warning $ loc "Room with such name already exists"]
else
[ModifyRoom roomUpdate,
- AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo (nick cl) (roomUpdate rm))]
+ AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo (clientProto cl) (nick cl) (roomUpdate rm))]
where
roomUpdate r = r{name = newName}
--- a/gameServer/HWProtoLobbyState.hs Fri Nov 15 14:41:36 2013 -0500
+++ b/gameServer/HWProtoLobbyState.hs Mon Nov 18 00:44:30 2013 +0400
@@ -21,7 +21,7 @@
(ci, irnc) <- ask
let cl = irnc `client` ci
rooms <- allRoomInfos
- let roomsInfoList = concatMap (\r -> roomInfo (nick $ irnc `client` masterID r) r) . filter (\r -> (roomProto r == clientProto cl))
+ let roomsInfoList = concatMap (\r -> roomInfo (clientProto cl) (nick $ irnc `client` masterID r) r) . filter (\r -> (roomProto r == clientProto cl))
return [AnswerClients [sendChan cl] ("ROOMS" : roomsInfoList rooms)]
--- a/gameServer/Utils.hs Fri Nov 15 14:41:36 2013 -0500
+++ b/gameServer/Utils.hs Mon Nov 18 00:44:30 2013 +0400
@@ -125,8 +125,9 @@
upperCase :: B.ByteString -> B.ByteString
upperCase = UTF8.fromString . map Char.toUpper . UTF8.toString
-roomInfo :: B.ByteString -> RoomInfo -> [B.ByteString]
-roomInfo n r = [
+roomInfo :: Word16 -> B.ByteString -> RoomInfo -> [B.ByteString]
+roomInfo p n r
+ | p < 46 = [
showB $ isJust $ gameInfo r,
name r,
showB $ playersIn r,
@@ -136,7 +137,17 @@
head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
head (Map.findWithDefault ["Default"] "AMMO" (params r))
]
-
+ | otherwise = [
+ showB $ isJust $ gameInfo r,
+ name r,
+ showB $ playersIn r,
+ showB $ length $ teams r,
+ n,
+ Map.findWithDefault "+rnd+" "MAP" (mapParams r),
+ head (Map.findWithDefault ["Normal"] "SCRIPT" (params r)),
+ head (Map.findWithDefault ["Default"] "SCHEME" (params r)),
+ head (Map.findWithDefault ["Default"] "AMMO" (params r))
+ ]
answerFullConfigParams ::
ClientInfo