--- a/hedgewars/uFLGameConfig.pas Sun Dec 06 20:07:35 2015 +0300
+++ b/hedgewars/uFLGameConfig.pas Sun Dec 06 20:20:09 2015 +0300
@@ -239,9 +239,9 @@
procedure tryRemoveTeam(teamName: PChar); cdecl;
-var msg: shortstring;
- i: Longword;
+var i: Longword;
tn: shortstring;
+ isLocal: boolean;
begin
with currentConfig do
begin
@@ -253,6 +253,11 @@
// team not found???
if (i > 7) then exit;
+ isLocal:= not teams[i].extDriven;
+
+ if isConnected and not isLocal then
+ exit; // we cannot remove this team
+
while (i < 7) and (teams[i + 1].hogsNumber > 0) do
begin
teams[i]:= teams[i + 1];
@@ -262,10 +267,11 @@
teams[i].hogsNumber:= 0
end;
- msg:= teamName;
-
- sendUI(mtRemovePlayingTeam, @msg[1], length(msg));
- sendUI(mtAddTeam, @msg[1], length(msg))
+ sendUI(mtRemovePlayingTeam, @tn[1], length(tn));
+ if isConnected then
+ removeTeam(tn);
+ if isLocal then
+ sendUI(mtAddTeam, @tn[1], length(tn))
end;
--- a/hedgewars/uFLNet.pas Sun Dec 06 20:07:35 2015 +0300
+++ b/hedgewars/uFLNet.pas Sun Dec 06 20:20:09 2015 +0300
@@ -163,7 +163,7 @@
procedure handler__UNKNOWN_;
begin
- writeln('[NET] Unknown cmd');
+ //writeln('[NET] Unknown cmd');
handleTail();
state.l:= 0
end;
@@ -294,7 +294,7 @@
if commands[state.l] < 0 then
begin
state.cmd:= net2cmd[-10 - commands[state.l]];
- writeln('[NET] ', state.cmd);
+ //writeln('[NET] ', state.cmd);
handlers[-10 - commands[state.l]]();
state.l:= 0
end
--- a/hedgewars/uFLTeams.pas Sun Dec 06 20:07:35 2015 +0300
+++ b/hedgewars/uFLTeams.pas Sun Dec 06 20:20:09 2015 +0300
@@ -11,6 +11,7 @@
function teamByName(s: shortstring): PTeam;
procedure sendTeam(var team: TTeam);
+procedure removeTeam(teamName: shortstring);
implementation
uses uFLUtils, uFLIPC, uPhysFSLayer, uFLData, uFLNet;
@@ -211,4 +212,10 @@
end;
end;
+procedure removeTeam(teamName: shortstring);
+begin
+ sendNetLn('REMOVE_TEAM');
+ sendNet(teamName)
+end;
+
end.