DEADSOFTWARE

Game: Use proper syntax of sets for game options instead of raw bitwise operations
[d2df-sdl.git] / src / game / g_netmsg.pas
index 1eb3683759c40e6a12ab9b30ba1855a50b4c0f18..a55a8a849d153a29ff46afd7b62f1b95f362d69f 100644 (file)
@@ -340,8 +340,8 @@ end;
 procedure MH_MalformedPacket(C: pTNetClient);
 begin
   g_Console_Add(_lc[I_NET_MSG] + _lc[I_NET_MSG_HOST_REJECT] +
-    _lc[I_NET_DISC_PROTOCOL]);
-  g_Net_Host_Kick(C^.ID, NET_DISC_PROTOCOL);
+    _lc[I_NET_DISC_BADMSG]);
+  g_Net_Host_Ban(C, True);
 end;
 
 procedure MH_RECV_Chat(C: pTNetClient; var M: TMsg);
@@ -418,9 +418,9 @@ begin
     Exit;
   end;
 
-  if g_Net_IsHostBanned(C^.Peer^.address.host) then
+  if g_Net_IsAddressBanned(C^.Peer^.address.host) then
   begin
-    if g_Net_IsHostBanned(C^.Peer^.address.host, True) then
+    if g_Net_IsAddressBanned(C^.Peer^.address.host, True) then
     begin
       g_Console_Add(_lc[I_NET_MSG] + _lc[I_NET_MSG_HOST_REJECT] +
         _lc[I_NET_DISC_BAN]);
@@ -462,7 +462,7 @@ begin
     WeapSwitchMode := WeapSwitch;
     SetWeaponPrefs(TmpPrefArray);
     SwitchToEmpty := SwitchEmpty;
-    SkipFist := SkipF;
+    SkipIronFist := SkipF;
     if (g_Force_Model_Get() <> 0) then
       SetModel(g_Forced_Model_GetName());
     Reset(True);
@@ -776,8 +776,8 @@ begin
   if (TmpSwEmpty <> Pl.SwitchToEmpty) then
     Pl.SwitchToEmpty := TmpSwEmpty;
 
-  if (TmpSkipF <> Pl.SkipFist) then
-    Pl.SkipFist := TmpSkipF;
+  if (TmpSkipF <> Pl.SkipIronFist) then
+    Pl.SkipIronFist := TmpSkipF;
 
   MH_SEND_PlayerSettings(Pl.UID, TmpModel);
 end;
@@ -989,7 +989,7 @@ begin
   NetOut.Write(gGameSettings.ScoreLimit);
   NetOut.Write(gGameSettings.TimeLimit);
   NetOut.Write(gGameSettings.MaxLives);
-  NetOut.Write(gGameSettings.Options);
+  NetOut.Write(LongWord(gGameSettings.Options));
   NetOut.Write(gTime);
 
   g_Net_Host_Send(ID, True);
@@ -1219,7 +1219,7 @@ begin
   NetOut.Write(gGameSettings.ScoreLimit);
   NetOut.Write(gGameSettings.TimeLimit);
   NetOut.Write(gGameSettings.MaxLives);
-  NetOut.Write(gGameSettings.Options);
+  NetOut.Write(LongWord(gGameSettings.Options));
 
   g_Net_Host_Send(ID, True);
 end;
@@ -1323,13 +1323,13 @@ begin
       NetOut.Write(FMaxAmmo[I]);
 
     for I := MR_SUIT to MR_MAX do
-      NetOut.Write(LongWord(FMegaRulez[I]));
+      NetOut.Write(LongWord(FPowerups[I]));
 
-    NetOut.Write(Byte(R_ITEM_BACKPACK in FRulez));
-    NetOut.Write(Byte(R_KEY_RED in FRulez));
-    NetOut.Write(Byte(R_KEY_GREEN in FRulez));
-    NetOut.Write(Byte(R_KEY_BLUE in FRulez));
-    NetOut.Write(Byte(R_BERSERK in FRulez));
+    NetOut.Write(Byte(R_ITEM_BACKPACK in FInventory));
+    NetOut.Write(Byte(R_KEY_RED in FInventory));
+    NetOut.Write(Byte(R_KEY_GREEN in FInventory));
+    NetOut.Write(Byte(R_KEY_BLUE in FInventory));
+    NetOut.Write(Byte(R_BERSERK in FInventory));
 
     NetOut.Write(Frags);
     NetOut.Write(Death);
@@ -2372,7 +2372,7 @@ begin
   gGameSettings.ScoreLimit := M.ReadWord();
   gGameSettings.TimeLimit := M.ReadWord();
   gGameSettings.MaxLives := M.ReadByte();
-  gGameSettings.Options := M.ReadLongWord();
+  gGameSettings.Options := TGameOptions(M.ReadLongWord());
 end;
 
 // PLAYER
@@ -2527,19 +2527,14 @@ begin
       FMaxAmmo[I] := M.ReadWord();
 
     for I := MR_SUIT to MR_MAX do
-      FMegaRulez[I] := M.ReadLongWord();
-
-    FRulez := [];
-    if (M.ReadByte() <> 0) then
-      FRulez := FRulez + [R_ITEM_BACKPACK];
-    if (M.ReadByte() <> 0) then
-      FRulez := FRulez + [R_KEY_RED];
-    if (M.ReadByte() <> 0) then
-      FRulez := FRulez + [R_KEY_GREEN];
-    if (M.ReadByte() <> 0) then
-      FRulez := FRulez + [R_KEY_BLUE];
-    if (M.ReadByte() <> 0) then
-      FRulez := FRulez + [R_BERSERK];
+      FPowerups[I] := M.ReadLongWord();
+
+    FInventory := [];
+    if (M.ReadByte() <> 0) then FInventory += [R_ITEM_BACKPACK];
+    if (M.ReadByte() <> 0) then FInventory += [R_KEY_RED];
+    if (M.ReadByte() <> 0) then FInventory += [R_KEY_GREEN];
+    if (M.ReadByte() <> 0) then FInventory += [R_KEY_BLUE];
+    if (M.ReadByte() <> 0) then FInventory += [R_BERSERK];
 
     Frags := M.ReadLongInt();
     Death := M.ReadLongInt();
@@ -3181,7 +3176,7 @@ begin
   for i := WP_FIRST to WP_LAST + 1 do
     NetOut.Write(gPlayer1Settings.WeaponPreferences[i]);
   NetOut.Write(gPlayer1Settings.SwitchToEmpty);
-  NetOut.Write(gPlayer1Settings.SkipFist);
+  NetOut.Write(gPlayer1Settings.SkipIronFist);
 
   g_Net_Client_Send(True);
 end;
@@ -3334,7 +3329,7 @@ begin
   for i := WP_FIRST to WP_LAST + 1 do
     NetOut.Write(gPlayer1Settings.WeaponPreferences[i]);
   NetOut.Write(gPlayer1Settings.SwitchToEmpty);
-  NetOut.Write(gPlayer1Settings.SkipFist);
+  NetOut.Write(gPlayer1Settings.SkipIronFist);
 
   g_Net_Client_Send(True);
 end;