- Another way of defining official server
- Rope has walking bug fixed, and works similar for the last rope too
--- a/gameServer/Opts.hs Sun Apr 12 06:01:17 2009 +0000
+++ b/gameServer/Opts.hs Sun Apr 12 12:50:43 2009 +0000
@@ -13,10 +13,7 @@
options :: [OptDescr (ServerInfo -> ServerInfo)]
options = [
Option ['p'] ["port"] (ReqArg readListenPort "PORT") "listen on PORT",
- Option ['d'] ["dedicated"] (ReqArg readDedicated "BOOL") "start as dedicated (True or False)",
- Option [] ["db-login"] (ReqArg readDbLogin "STRING") "database access login",
- Option [] ["db-password"] (ReqArg readDbPassword "STRING") "database access password",
- Option [] ["db-host"] (ReqArg readDbHost "STRING") "database host"
+ Option ['d'] ["dedicated"] (ReqArg readDedicated "BOOL") "start as dedicated (True or False)"
]
readListenPort,
--- a/gameServer/Utils.hs Sun Apr 12 06:01:17 2009 +0000
+++ b/gameServer/Utils.hs Sun Apr 12 12:50:43 2009 +0000
@@ -8,6 +8,7 @@
import qualified Data.IntMap as IntMap
import Numeric
import Network.Socket
+import System.IO
import qualified Data.List as List
-------------------------------------------------
import qualified Codec.Binary.Base64 as Base64
@@ -68,3 +69,8 @@
protoNumber2ver 26 = "0.9.11-dev"
protoNumber2ver _ = "Unknown"
+askFromConsole :: String -> IO String
+askFromConsole msg = do
+ putStr msg
+ hFlush stdout
+ getLine
--- a/gameServer/hedgewars-server.hs Sun Apr 12 06:01:17 2009 +0000
+++ b/gameServer/hedgewars-server.hs Sun Apr 12 12:50:43 2009 +0000
@@ -13,6 +13,7 @@
import CoreTypes
import OfficialServer.DBInteraction
import ServerCore
+import Utils
#if !defined(mingw32_HOST_OS)
@@ -34,8 +35,17 @@
stats <- atomically $ newTMVar (StatisticsInfo 0 0)
dbQueriesChan <- newChan
coreChan <- newChan
- serverInfo <- getOpts $ newServerInfo stats coreChan dbQueriesChan
+ serverInfo' <- getOpts $ newServerInfo stats coreChan dbQueriesChan
+#if defined(OFFICIAL_SERVER)
+ dbHost' <- askFromConsole "DB host: "
+ dbLogin' <- askFromConsole "login: "
+ dbPassword' <- askFromConsole "password: "
+ let serverInfo = serverInfo'{dbHost = dbHost', dbLogin = dbLogin', dbPassword = dbPassword'}
+#else
+ let serverInfo = serverInfo'
+#endif
+
bracket
(Network.listenOn $ Network.PortNumber $ listenPort serverInfo)
(sClose)
--- a/hedgewars/GSHandlers.inc Sun Apr 12 06:01:17 2009 +0000
+++ b/hedgewars/GSHandlers.inc Sun Apr 12 12:50:43 2009 +0000
@@ -683,6 +683,9 @@
begin
Gear^.X:= HHGear^.X;
Gear^.Y:= HHGear^.Y;
+
+ ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope);
+
Gear^.dX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX);
Gear^.dY:= -AngleCos(HHGear^.Angle);
Gear^.Friction:= _450;
@@ -850,7 +853,7 @@
if (Gear^.Message and gm_Attack) <> 0 then
if (Gear^.State and gsttmpFlag) <> 0 then
with PHedgehog(Gear^.Hedgehog)^ do
- if Ammo^[CurSlot, CurAmmo].AmmoType = amRope then
+ if Ammo^[CurSlot, CurAmmo].AmmoType <> amParachute then
WaitCollision
else
DeleteMe
@@ -869,9 +872,9 @@
if (Gear^.State and gstAttacked) = 0 then
begin
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
- ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
Gear^.State:= Gear^.State or gstAttacked
- end
+ end;
+ ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^)
end;
begin
--- a/hedgewars/HHHandlers.inc Sun Apr 12 06:01:17 2009 +0000
+++ b/hedgewars/HHHandlers.inc Sun Apr 12 12:50:43 2009 +0000
@@ -274,7 +274,7 @@
begin
Gear^.Message:= gm_Destroy;
case Gear^.Pos of
- posCaseUtility,
+ posCaseUtility,
posCaseAmmo: begin
a:= TAmmoType(Gear^.State);
AddAmmo(PHedgehog(HH^.Hedgehog)^, a);
--- a/hedgewars/uAmmos.pas Sun Apr 12 06:01:17 2009 +0000
+++ b/hedgewars/uAmmos.pas Sun Apr 12 12:50:43 2009 +0000
@@ -27,7 +27,7 @@
function HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
procedure OnUsedAmmo(var Hedgehog: THedgehog);
-procedure ApplyAngleBounds(var Hedgehog: THedgehog);
+procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog);
procedure SetWeapon(weap: TAmmoType);
@@ -180,23 +180,22 @@
HHHasAmmo:= false
end;
-procedure ApplyAngleBounds(var Hedgehog: THedgehog);
+procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
begin
with Hedgehog do
- with Ammo^[CurSlot, CurAmmo] do
+ begin
+ CurMinAngle:= Ammoz[AmmoType].minAngle;
+ if Ammoz[AmmoType].maxAngle <> 0 then
+ CurMaxAngle:= Ammoz[AmmoType].maxAngle
+ else
+ CurMaxAngle:= cMaxAngle;
+
+ with Hedgehog.Gear^ do
begin
- CurMinAngle:= Ammoz[AmmoType].minAngle;
- if Ammoz[AmmoType].maxAngle <> 0 then
- CurMaxAngle:= Ammoz[AmmoType].maxAngle
- else
- CurMaxAngle:= cMaxAngle;
-
- with Hedgehog.Gear^ do
- begin
- if Angle < CurMinAngle then Angle:= CurMinAngle;
- if Angle > CurMaxAngle then Angle:= CurMaxAngle;
- end
+ if Angle < CurMinAngle then Angle:= CurMinAngle;
+ if Angle > CurMaxAngle then Angle:= CurMaxAngle;
end
+ end
end;
procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
@@ -213,7 +212,7 @@
while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot)
end;
- ApplyAngleBounds(Hedgehog);
+ ApplyAngleBounds(Hedgehog, Ammo^[CurSlot, CurAmmo].AmmoType);
with Ammo^[CurSlot, CurAmmo] do
begin
--- a/hedgewars/uGears.pas Sun Apr 12 06:01:17 2009 +0000
+++ b/hedgewars/uGears.pas Sun Apr 12 12:50:43 2009 +0000
@@ -106,6 +106,8 @@
procedure HedgehogChAngle(Gear: PGear); forward;
procedure ShotgunShot(Gear: PGear); forward;
procedure PickUp(HH, Gear: PGear); forward;
+procedure HHSetWeapon(Gear: PGear); forward;
+
{$INCLUDE GSHandlers.inc}
{$INCLUDE HHHandlers.inc}