Remove deprecated stuff
authorunc0rr
Sun, 05 Oct 2008 16:35:46 +0000
changeset 1302 4290ba4a14ca
parent 1301 c6fe8a4bfd34
child 1303 f90bf2276639
Remove deprecated stuff
QTfrontend/netconnectedclient.cpp
QTfrontend/netconnectedclient.h
QTfrontend/newnetclient.cpp
misc/fbsd-port/Makefile
misc/fbsd-port/distinfo
misc/fbsd-port/pkg-descr
misc/fbsd-port/pkg-plist
netserver/HWProto.hs
netserver/newhwserv.hs
--- a/QTfrontend/netconnectedclient.cpp	Mon Sep 29 22:14:23 2008 +0000
+++ b/QTfrontend/netconnectedclient.cpp	Sun Oct 05 16:35:46 2008 +0000
@@ -175,6 +175,12 @@
 	  qWarning("Net server: 'ADDTEAM' message: rejecting");
 	  return; // reject command
     }
+    if (netIDbyTeamName(tmp[0]) > 0)
+    {
+	  qWarning("Net server: 'ADDTEAM' message: rejecting (have team with same name)");
+	  return; // reject command
+
+    }
     int toAdd=maxAdd < 4 ? maxAdd : 4;
     m_hwserver->hhnum+=toAdd;
 qDebug() << "to add = " << toAdd << "m_hwserver->hhnum = " << m_hwserver->hhnum;
@@ -229,16 +235,21 @@
   m_hwserver->sendOthers(this, lst.join(QString(delimeter)));
 }
 
+unsigned int HWConnectedClient::netIDbyTeamName(const QString& tname)
+{
+    qDebug() << "Check exist" << tname;
+
+	for(QList<QStringList>::iterator it=m_teamsCfg.begin(); it!=m_teamsCfg.end(); ++it)
+		if((*it)[0]==tname)
+			return (*it)[1].toUInt();
+
+	return 0;
+}
+
 unsigned int HWConnectedClient::removeTeam(const QString& tname)
 {
-	unsigned int netID=0;
-	for(QList<QStringList>::iterator it=m_teamsCfg.begin(); it!=m_teamsCfg.end(); ++it) {
-		if((*it)[0]==tname) {
-			netID=(*it)[1].toUInt();
-			m_teamsCfg.erase(it);
-			break;
-		}
-	}
+	unsigned int netID = netIDbyTeamName(tname);
+	
 	if (netID == 0)
 		qDebug() << QString("removeTeam: team '%1' not found").arg(tname);
 
--- a/QTfrontend/netconnectedclient.h	Mon Sep 29 22:14:23 2008 +0000
+++ b/QTfrontend/netconnectedclient.h	Sun Oct 05 16:35:46 2008 +0000
@@ -61,6 +61,8 @@
 
   QStringList cmdbuf;
 
+  unsigned int netIDbyTeamName(const QString& tname);
+
  signals:
   void HWClientDisconnected(HWConnectedClient* client);
 
--- a/QTfrontend/newnetclient.cpp	Mon Sep 29 22:14:23 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Sun Oct 05 16:35:46 2008 +0000
@@ -109,7 +109,7 @@
 
 void HWNewNet::RawSendNet(const QByteArray & buf)
 {
-qDebug() << "Client: " << buf;
+  qDebug() << "Client: " << buf;
   NetSocket.write(buf);
   NetSocket.write("\n\n", 2);
 }
@@ -144,26 +144,26 @@
 
 void HWNewNet::displayError(QAbstractSocket::SocketError socketError)
 {
-  switch (socketError) {
-  case QAbstractSocket::RemoteHostClosedError:
-    break;
-  case QAbstractSocket::HostNotFoundError:
-    QMessageBox::information(0, tr("Error"),
-			     tr("The host was not found. Please check the host name and port settings."));
-    break;
-  case QAbstractSocket::ConnectionRefusedError:
-    QMessageBox::information(0, tr("Error"),
-			     tr("Connection refused"));
-    break;
-  default:
-    QMessageBox::information(0, tr("Error"),
-			     NetSocket.errorString());
-  }
+	switch (socketError) {
+		case QAbstractSocket::RemoteHostClosedError:
+			break;
+		case QAbstractSocket::HostNotFoundError:
+			QMessageBox::information(0, tr("Error"),
+					tr("The host was not found. Please check the host name and port settings."));
+			break;
+		case QAbstractSocket::ConnectionRefusedError:
+			QMessageBox::information(0, tr("Error"),
+					tr("Connection refused"));
+			break;
+		default:
+			QMessageBox::information(0, tr("Error"),
+					NetSocket.errorString());
+		}
 }
 
 void HWNewNet::ParseCmd(const QStringList & lst)
 {
-qDebug() << "Server: " << lst;
+  qDebug() << "Server: " << lst;
 
   if(!lst.size())
   {
--- a/misc/fbsd-port/Makefile	Mon Sep 29 22:14:23 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Ports collection makefile for:  hedgewars
-# Date created:			  31 January 2008
-# Whom:				  Andrey Korotaev <unC0Rr@gmail.com>
-#
-# $FreeBSD$
-#
-
-PORTNAME=	hedgewars
-PORTVERSION=	0.9.2
-CATEGORIES=	games
-MASTER_SITES=	http://www.hedgewars.org/download/
-DISTNAME=	${PORTNAME}-src-${PORTVERSION}
-
-MAINTAINER=	unC0Rr@gmail.com
-COMMENT=	Free Worms-like turn based strategy game
-
-USE_BZIP2=	yes
-USE_SDL=	sdl image ttf mixer net
-USE_QT_VER=	4
-QT_COMPONENTS=	gui corelib network xml svg moc_build rcc_build
-
-BUILD_DEPENDS+=	fpc:${PORTSDIR}/lang/fpc \
-		${CMAKE}:${PORTSDIR}/devel/cmake
-
-WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
-
-CMAKE?=		${LOCALBASE}/bin/cmake
-CMAKE_ARGS=	-DCMAKE_INSTALL_PREFIX:PATH=${PREFIX} \
-		-DCMAKE_CXX_COMPILER:STRING="${CXX}" \
-		-DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}"
-
-do-configure:
-	cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} ${CMAKE} ${CMAKE_ARGS} .
-
-.include <bsd.port.mk>
--- a/misc/fbsd-port/distinfo	Mon Sep 29 22:14:23 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-MD5 (hedgewars-src-0.9.2.tar.bz2) = 5df47ec046bca92e48c1100eec7a7745
-SHA256 (hedgewars-src-0.9.2.tar.bz2) = a9a13e36ebeded37e3ad1b7c757d73ac4de13d6bf739ca33784a674f0ae90b7a
-SIZE (hedgewars-src-0.9.2.tar.bz2) = 4909748
--- a/misc/fbsd-port/pkg-descr	Mon Sep 29 22:14:23 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-Hedgewars is turn-based Worms-like strategy game.
-
-Each player controls a team of several hedgehogs. During the course of the game,
-players take turns with one of their hedgehogs. They then use whatever tools and
-weapons are available to attack and kill the opponents' hedgehogs, thereby
-winning the game. Hedgehogs may move around the terrain in a variety of ways,
-normally by walking and jumping but also by using particular tools such as the
-"Rope" or "Parachute", to move to otherwise inaccessible areas. Each turn is
-time-limited to ensure that players do not hold up the game with excessive
-thinking or moving. A large variety of tools and weapons are available for
-players during the game: Grenade, Cluster Bomb, Bazooka, UFO, Shotgun, Desert
-Eagle, Fire Punch, Baseball Bat, Dynamite, Mine, Rope, Pneumatic pick,
-Parachute.
-
-WWW: http://www.hedgewars.org/
--- a/misc/fbsd-port/pkg-plist	Mon Sep 29 22:14:23 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-bin/hedgewars
-bin/hwengine
-share/hedgewars/Data/Fonts/DejaVuSans.ttf
-share/hedgewars/Data/Forts/BarrelhouseL.png
-share/hedgewars/Data/Forts/BarrelhouseR.png
-share/hedgewars/Data/Forts/IslandL.png
-share/hedgewars/Data/Forts/IslandR.png
-share/hedgewars/Data/Graphics/AirBomb.png
-share/hedgewars/Data/Graphics/Airplane.png
-share/hedgewars/Data/Graphics/AmmoMenu/AmmoName.png
-share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png
-share/hedgewars/Data/Graphics/AmmoMenu/BrdrLines.png
-share/hedgewars/Data/Graphics/AmmoMenu/Selection.png
-share/hedgewars/Data/Graphics/AmmoMenu/Slot.png
-share/hedgewars/Data/Graphics/AmmoMenu/SlotKeys.png
-share/hedgewars/Data/Graphics/Arrow.png
-share/hedgewars/Data/Graphics/BigDigits.png
-share/hedgewars/Data/Graphics/BlueWater.png
-share/hedgewars/Data/Graphics/Bomb.png
-share/hedgewars/Data/Graphics/Case.png
-share/hedgewars/Data/Graphics/ClBomb.png
-share/hedgewars/Data/Graphics/ClParticle.png
-share/hedgewars/Data/Graphics/Clouds.png
-share/hedgewars/Data/Graphics/Console.png
-share/hedgewars/Data/Graphics/Crosshair.png
-share/hedgewars/Data/Graphics/Expl50.png
-share/hedgewars/Data/Graphics/Finger.png
-share/hedgewars/Data/Graphics/FirstAid.png
-share/hedgewars/Data/Graphics/Flame.png
-share/hedgewars/Data/Graphics/Frame.png
-share/hedgewars/Data/Graphics/Girder.png
-share/hedgewars/Data/Graphics/Graves/Bone.png
-share/hedgewars/Data/Graphics/Graves/Rip.png
-share/hedgewars/Data/Graphics/Graves/Simple.png
-share/hedgewars/Data/Graphics/Graves/coffin.png
-share/hedgewars/Data/Graphics/Grenade.png
-share/hedgewars/Data/Graphics/Hedgehog.png
-share/hedgewars/Data/Graphics/Lag.png
-share/hedgewars/Data/Graphics/MineOff.png
-share/hedgewars/Data/Graphics/MineOn.png
-share/hedgewars/Data/Graphics/Parachute.png
-share/hedgewars/Data/Graphics/Power.png
-share/hedgewars/Data/Graphics/PowerBar.png
-share/hedgewars/Data/Graphics/Progress.png
-share/hedgewars/Data/Graphics/RopeHook.png
-share/hedgewars/Data/Graphics/RopeNode.png
-share/hedgewars/Data/Graphics/SmokeTrace.png
-share/hedgewars/Data/Graphics/Switch.png
-share/hedgewars/Data/Graphics/Target.png
-share/hedgewars/Data/Graphics/Targetp.png
-share/hedgewars/Data/Graphics/UFO.png
-share/hedgewars/Data/Graphics/WindBar.png
-share/hedgewars/Data/Graphics/WindL.png
-share/hedgewars/Data/Graphics/WindR.png
-share/hedgewars/Data/Graphics/amAirplane.png
-share/hedgewars/Data/Graphics/amGirder.png
-share/hedgewars/Data/Graphics/dynamite.png
-share/hedgewars/Data/Graphics/hhMask.png
-share/hedgewars/Data/Graphics/thinking.png
-share/hedgewars/Data/Locale/en.txt
-share/hedgewars/Data/Locale/hedgewars_ru.qm
-share/hedgewars/Data/Locale/ru.txt
-share/hedgewars/Data/Maps/Volcano/map.16.png
-share/hedgewars/Data/Maps/Volcano/map.cfg
-share/hedgewars/Data/Maps/Volcano/map.png
-share/hedgewars/Data/Maps/cheese/map.16.png
-share/hedgewars/Data/Maps/cheese/map.cfg
-share/hedgewars/Data/Maps/cheese/map.png
-share/hedgewars/Data/Maps/mushrooms/map.16.png
-share/hedgewars/Data/Maps/mushrooms/map.cfg
-share/hedgewars/Data/Maps/mushrooms/map.png
-share/hedgewars/Data/Sounds/explosion.ogg
-share/hedgewars/Data/Sounds/graveimpact.ogg
-share/hedgewars/Data/Sounds/grenadeimpact.ogg
-share/hedgewars/Data/Sounds/gun.ogg
-share/hedgewars/Data/Sounds/minetick.ogg
-share/hedgewars/Data/Sounds/pickhammer.ogg
-share/hedgewars/Data/Sounds/shotgunfire.ogg
-share/hedgewars/Data/Sounds/shotgunreload.ogg
-share/hedgewars/Data/Sounds/splash.ogg
-share/hedgewars/Data/Sounds/throwpowerup.ogg
-share/hedgewars/Data/Sounds/throwrelease.ogg
-share/hedgewars/Data/Sounds/ufo.ogg
-share/hedgewars/Data/Themes/Volcano/Border.png
-share/hedgewars/Data/Themes/Volcano/LandTex.png
-share/hedgewars/Data/Themes/Volcano/Sky.png
-share/hedgewars/Data/Themes/Volcano/gr1.png
-share/hedgewars/Data/Themes/Volcano/horizont.png
-share/hedgewars/Data/Themes/Volcano/leaf1.png
-share/hedgewars/Data/Themes/Volcano/leaf2.png
-share/hedgewars/Data/Themes/Volcano/theme.cfg
-share/hedgewars/Data/Themes/Volcano/tree.png
-share/hedgewars/Data/Themes/avematan/Border.png
-share/hedgewars/Data/Themes/avematan/LandTex.png
-share/hedgewars/Data/Themes/avematan/Sky.png
-share/hedgewars/Data/Themes/avematan/a.png
-share/hedgewars/Data/Themes/avematan/e.png
-share/hedgewars/Data/Themes/avematan/horizont.png
-share/hedgewars/Data/Themes/avematan/inf.png
-share/hedgewars/Data/Themes/avematan/sqrt.png
-share/hedgewars/Data/Themes/avematan/theme.cfg
-share/hedgewars/Data/Themes/bubbles/Border.png
-share/hedgewars/Data/Themes/bubbles/LandTex.png
-share/hedgewars/Data/Themes/bubbles/Sky.png
-share/hedgewars/Data/Themes/bubbles/horizont.png
-share/hedgewars/Data/Themes/bubbles/round.png
-share/hedgewars/Data/Themes/bubbles/theme.cfg
-share/hedgewars/Data/Themes/cheese/Sky.png
-share/hedgewars/Data/Themes/cheese/horizont.png
-share/hedgewars/Data/Themes/cheese/theme.cfg
-share/hedgewars/Data/Themes/norsk/Border.png
-share/hedgewars/Data/Themes/norsk/LandTex.png
-share/hedgewars/Data/Themes/norsk/Sky.png
-share/hedgewars/Data/Themes/norsk/horizont.png
-share/hedgewars/Data/Themes/norsk/theme.cfg
-share/hedgewars/Data/Themes/norsk/tree.png
-share/hedgewars/Data/Themes/steel/01.png
-share/hedgewars/Data/Themes/steel/02.png
-share/hedgewars/Data/Themes/steel/Border.png
-share/hedgewars/Data/Themes/steel/Clouds.16.png
-share/hedgewars/Data/Themes/steel/Clouds.32.png
-share/hedgewars/Data/Themes/steel/LandTex.png
-share/hedgewars/Data/Themes/steel/Sky.16.png
-share/hedgewars/Data/Themes/steel/Sky.32.png
-share/hedgewars/Data/Themes/steel/horizont.png
-share/hedgewars/Data/Themes/steel/theme.cfg
-share/hedgewars/Data/Themes/themes.cfg
-share/hedgewars/Data/Themes/tibet/Border.png
-share/hedgewars/Data/Themes/tibet/LandTex.png
-share/hedgewars/Data/Themes/tibet/Sky.png
-share/hedgewars/Data/Themes/tibet/chha.png
-share/hedgewars/Data/Themes/tibet/horizont.png
-share/hedgewars/Data/Themes/tibet/ma.png
-share/hedgewars/Data/Themes/tibet/nga.png
-share/hedgewars/Data/Themes/tibet/sa.png
-share/hedgewars/Data/Themes/tibet/ta1.png
-share/hedgewars/Data/Themes/tibet/theme.cfg
-share/hedgewars/Data/Themes/wood/Border.png
-share/hedgewars/Data/Themes/wood/LandTex.png
-share/hedgewars/Data/Themes/wood/Sky.png
-share/hedgewars/Data/Themes/wood/gr1.png
-share/hedgewars/Data/Themes/wood/horizont.png
-share/hedgewars/Data/Themes/wood/leaf1.png
-share/hedgewars/Data/Themes/wood/leaf2.png
-share/hedgewars/Data/Themes/wood/theme.cfg
-share/hedgewars/Data/Themes/wood/tree.png
-share/hedgewars/Data/Themes/xtheme/Border.png
-share/hedgewars/Data/Themes/xtheme/LandTex.png
-share/hedgewars/Data/Themes/xtheme/Sky.png
-share/hedgewars/Data/Themes/xtheme/horizont.png
-share/hedgewars/Data/Themes/xtheme/plant1.png
-share/hedgewars/Data/Themes/xtheme/plant2.png
-share/hedgewars/Data/Themes/xtheme/plant3.png
-share/hedgewars/Data/Themes/xtheme/plant4.png
-share/hedgewars/Data/Themes/xtheme/theme.cfg
-share/hedgewars/Data/Trainings/001_Shotgun.txt
-share/hedgewars/Data/Trainings/002_Bazooka.txt
-@dirrm share/hedgewars/Data/Trainings
-@dirrm share/hedgewars/Data/Themes/xtheme
-@dirrm share/hedgewars/Data/Themes/wood
-@dirrm share/hedgewars/Data/Themes/tibet
-@dirrm share/hedgewars/Data/Themes/steel
-@dirrm share/hedgewars/Data/Themes/norsk
-@dirrm share/hedgewars/Data/Themes/cheese
-@dirrm share/hedgewars/Data/Themes/bubbles
-@dirrm share/hedgewars/Data/Themes/avematan
-@dirrm share/hedgewars/Data/Themes/Volcano
-@dirrm share/hedgewars/Data/Themes
-@dirrm share/hedgewars/Data/Sounds
-@dirrm share/hedgewars/Data/Maps/mushrooms
-@dirrm share/hedgewars/Data/Maps/cheese
-@dirrm share/hedgewars/Data/Maps/Volcano
-@dirrm share/hedgewars/Data/Maps
-@dirrm share/hedgewars/Data/Locale
-@dirrm share/hedgewars/Data/Graphics/Graves
-@dirrm share/hedgewars/Data/Graphics/AmmoMenu
-@dirrm share/hedgewars/Data/Graphics
-@dirrm share/hedgewars/Data/Forts
-@dirrm share/hedgewars/Data/Fonts
-@dirrm share/hedgewars/Data
-@dirrm share/hedgewars
--- a/netserver/HWProto.hs	Mon Sep 29 22:14:23 2008 +0000
+++ b/netserver/HWProto.hs	Sun Oct 05 16:35:46 2008 +0000
@@ -91,7 +91,7 @@
 handleCmd_inRoom client clients rooms ["CONFIG_PARAM", paramName, value1, value2] =
 	(noChangeClients, noChangeRooms, othersInRoom, ["CONFIG_PARAM", paramName, value1, value2])
 
-handleCmd_inRoom client clients rooms ["ADDTEAM:", teamName, teamColor, graveName, fortName, teamLevel, hh0, hh1, hh2, hh3, hh4, hh5, hh6, hh7] =
-	(noChangeClients, noChangeRooms, othersInRoom, ["TEAM_ACCEPTED", "1", teamName])
+handleCmd_inRoom client clients rooms ("ADDTEAM:" : teamName : teamColor : graveName : fortName : teamLevel : hhs) =
+	(noChangeClients, noChangeRooms, clientOnly, ["TEAM_ACCEPTED", teamName, "1"])
 
 handleCmd_inRoom _ _ _ _ = (noChangeClients, noChangeRooms, clientOnly, badCmd)
--- a/netserver/newhwserv.hs	Mon Sep 29 22:14:23 2008 +0000
+++ b/netserver/newhwserv.hs	Sun Oct 05 16:35:46 2008 +0000
@@ -42,9 +42,9 @@
 		Left ci -> do
 			mainLoop servSock acceptChan (ci:clients) rooms
 		Right (cmd, client) -> do
-			print ("> " ++ show cmd)
+			putStrLn ("> " ++ show cmd)
 			let (clientsFunc, roomsFunc, handlesFunc, answer) = handleCmd client clients rooms $ cmd
-			print ("< " ++ show answer)
+			putStrLn ("< " ++ show answer)
 
 			let mclients = clientsFunc clients
 			let mrooms = roomsFunc rooms