- Keep track of room name so correct name is displayed when you become room admin
authorunc0rr
Tue, 25 Sep 2012 22:45:40 +0400
changeset 7710 fd5bcbd698a5
parent 7709 631852904cee
child 7711 98b56578b9ba
- Keep track of room name so correct name is displayed when you become room admin - Don't rename rooms if client is > 0.9.17
QTfrontend/hwform.cpp
QTfrontend/net/newnetclient.cpp
gameServer/Actions.hs
--- a/QTfrontend/hwform.cpp	Tue Sep 25 02:57:03 2012 +0200
+++ b/QTfrontend/hwform.cpp	Tue Sep 25 22:45:40 2012 +0400
@@ -1518,10 +1518,12 @@
         // disconnect connections first to ensure their inexistance and not to connect twice
         ui.pageNetGame->BtnStart->disconnect(hwnet);
         ui.pageNetGame->BtnUpdate->disconnect(hwnet);
-        ui.pageNetGame->setRoomName(hwnet->getRoom());
         ui.pageNetGame->restrictJoins->disconnect(hwnet);
         ui.pageNetGame->restrictTeamAdds->disconnect(hwnet);
         ui.pageNetGame->disconnect(hwnet, SLOT(updateRoomName(const QString&)));
+
+        ui.pageNetGame->setRoomName(hwnet->getRoom());
+
         connect(ui.pageNetGame->BtnStart, SIGNAL(clicked()), hwnet, SLOT(startGame()));
         connect(ui.pageNetGame, SIGNAL(askForUpdateRoomName(const QString &)), hwnet, SLOT(updateRoomName(const QString &)));
         connect(ui.pageNetGame->restrictJoins, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictJoins()));
--- a/QTfrontend/net/newnetclient.cpp	Tue Sep 25 02:57:03 2012 +0200
+++ b/QTfrontend/net/newnetclient.cpp	Tue Sep 25 22:45:40 2012 +0400
@@ -466,6 +466,11 @@
 
         QString roomName = tmp.takeFirst();
         m_roomsListModel->updateRoom(roomName, tmp);
+
+        // keep track of room name so correct name is displayed when you become room admin
+        if(myroom == roomName)
+            myroom = roomName;
+
         return;
     }
 
--- a/gameServer/Actions.hs	Tue Sep 25 02:57:03 2012 +0200
+++ b/gameServer/Actions.hs	Tue Sep 25 22:45:40 2012 +0400
@@ -237,8 +237,10 @@
                 }) ri
         moveClientToLobby rnc ci
 
+
 processAction ChangeMaster = do
     (Just ci) <- gets clientIndex
+    proto <- client's clientProto
     ri <- clientRoomA
     rnc <- gets roomsClients
     newMasterId <- liftM (head . filter (/= ci)) . io $ roomClientsIndicesM rnc ri
@@ -246,7 +248,7 @@
     oldRoomName <- io $ room'sM rnc name ri
     oldMaster <- client's nick
     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
-    let newRoomName = nick newMaster
+    let newRoomName = if proto < 42 then nick newMaster else oldRoomName
     mapM_ processAction [
         ModifyRoom (\r -> r{masterID = newMasterId, name = newRoomName, isRestrictedJoins = False, isRestrictedTeams = False})
         , ModifyClient2 newMasterId (\c -> c{isMaster = True})
@@ -259,7 +261,7 @@
     proto <- client's clientProto
     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 newRoomName newRoom)
 
 
 processAction (AddRoom roomName roomPassword) = do