Отправляет email-рассылки с помощью сервиса Sendsay

[prg] ошибка в коде. помогите пожалуйста решить

привет подписчикам
возникла такая проблема
в игре миля за милей увеличил дистанцию
и после запуска возникает такая ошибка
OnToys
Ошибка выполнения скрипта:
Undeclared identifier: 'DestroyControls'
15:16
ОК
помогите пожалуйста решить эту проблему
код смотрите ниже
{Mile-by-mile copiright (C)2013 Ivan Sebekin LLC www.OnToys.Net}

Uses 'Units\Server-funcs.pas';

Var
lDistance : TLabel = Nil;
cbDistance : TCombobox = Nil;
lNumDeck : TLabel = Nil;
cbNumDeck : TCombobox = Nil;
cPairToPair : TCheckbox = Nil;
cAntiProtection : TCheckbox = Nil;
tmPlay : TTimer = Nil;
players : array[1..maxPlayers] of cardinal;

Procedure Victory(pl : TPlayer; const giveup : boolean = false);
var
m, d, v, p : integer;
Begin
if assigned(pl) and beginGroshGive then
Begin
if not conPairToPair then
Begin
if not giveup then
begin // нормальное окончание (никто не сдался):
for p := 1 to game.countPlayers do
if p = pl.index then
GroshGiveTo(players[p], 100)
else
GroshGiveTo(players[p], 0);
end else
begin // кто-то сдался:
m := 100 div (game.countPlayers-1);
d := 100 - (m * (game.countPlayers-1));
for p := 1 to game.countPlayers do
if p = pl.index then
GroshGiveTo(players[p], 0)
else begin
GroshGiveTo(players[p], m+d);
d := 0;
end;
end;
end else
begin // пара-на-пару:
m := (pl.index+1) mod 2;
v := 100 div (game.countPlayers div 2);
d := 100 - (v * (game.countPlayers div 2));
for p := 1 to game.countPlayers do
if ((((p + 1) mod 2) = m) and (not giveup)) or ((((p + 1) mod 2) <> m)
and giveup) then
Begin
GroshGiveTo(players[p], v+d);
d := 0;
end else
GroshGiveTo(players[p], 0);
end;
EndGroshGive;
end;
End;

Procedure GiveUpSuccess(player : TPlayer);
Begin
Victory(player, true);
gs := gsGiveUp;
ActivePlayer := Player;
SynchronizeGame;
game.activePlayer := activePlayer;
End;

Procedure SynchronizeConfig(const index : integer = toAll);
Begin
SendCommand(index, comSynchronizeConfig, conDistance +
(BoolToByte(conPairToPair) shl 16) + (BoolToByte(conWithAntiProtection)
shl 17), globNumDeck);
End;

Procedure SynchronizeGame(const index : integer = toAll);
Begin
if globNumDeck>0 then
SendCommand(index, comSynchronizeGame, gs,
DeckToStr(Deck)+'/'+DeckToStr(DeckOut), CompressPlayerParams,
PlayerToInteger(lastPlayer) + (lastCard shl 4) +
(BoolToByte(lastExecute) shl 9))
else
SendCommand(index, comSynchronizeGame, gs, Deck2ToStr(Deck2,
cntdeck2)+'/'+Deck2ToStr(DeckOut2, cntdeckout2), CompressPlayerParams,
PlayerToInteger(lastPlayer) + (lastCard shl 4) +
(BoolToByte(lastExecute) shl 9));
End;

Procedure CardDropped(pl, lpl : TPlayer; const cardindex : integer);
var
b : boolean;
Begin
if (pl<>game.activePlayer) then exit;
b := false;
if not pl.isMy then
Begin // обработка хода:
lastCard := Fetch(pl.hand[cardindex]);
SendCommand(-pl.index, comCardOut, activePlayer.index, cardindex);
OutCard(activePlayer, cardindex);
lastPlayer := lpl;
lastExecute := CheckExecute(lastPlayer, lastCard);
if not lastExecute then lastPlayer := activePlayer;
if ((lastCard in [(sProtStop)..(sProtLimit)]) and lastExecute) or
((game.countPlayers=2) and (lastCard = sSkip)) then activePlayer :=
activePlayer
else if lastCard<>sSkip then activePlayer := NextPlayer(activePlayer)
else activePlayer := NextPlayer(NextPlayer(activePlayer));
b := true;
End else
SendCommand(toAll, comCardOut, pl.index, cardindex);

gs := gsPlay;

if (not GameOver) and b and assigned(activePlayer) then
Begin
SendCommand(-pl.index, comGetCardFromDeck, activePlayer.index);
GetCardFromDeck(activePlayer);
End else
if assigned(activePlayer) then
SendCommand(toAll, comGetCardFromDeck, activePlayer.index);
SynchronizeGame(-pl.index);
game.activePlayer := activePlayer;
if activePlayer.isVirtual then game.computerRepeat;
if (gs and gsMask) = gsOver then
Victory(FindVictoryPlayer);
End;

Procedure DeckInit;
var
i, d, c : integer;
Begin
SetLength(DeckOut, 0);
if not conWithAntiProtection then c := 104 else c := 105;
SetLength(Deck, c*globNumDeck);

for d := 1 to globNumDeck do
begin
for i := 1 to 10 do
Begin
Deck[(d-1)*c+(i-1)*3] := s25;
Deck[(d-1)*c+(i-1)*3+1] := s50;
Deck[(d-1)*c+(i-1)*3+2] := s75;
end;
For i := 1 to 12 do
Deck[(d-1)*c+29+i] := s100;
For i := 1 to 4 do
Deck[(d-1)*c+41+i] := s200;
for i := 1 to 4 do
Begin
deck[(d-1)*c+(i-1)*6+46] := sStart;
deck[(d-1)*c+(i-1)*6+47] := sBenzine;
deck[(d-1)*c+(i-1)*6+48] := sAntiCrash;
deck[(d-1)*c+(i-1)*6+49] := sAntiTurn;
deck[(d-1)*c+(i-1)*6+50] := sTruc;
deck[(d-1)*c+(i-1)*6+51] := sAntiLimit;
End;
for i := 1 to 2 do
Begin
deck[(d-1)*c+(i-1)*6+70] := sStop;
deck[(d-1)*c+(i-1)*6+71] := sBenzineOut;
deck[(d-1)*c+(i-1)*6+72] := sCrash;
deck[(d-1)*c+(i-1)*6+73] := sTurn;
deck[(d-1)*c+(i-1)*6+74] := sTrucOut;
deck[(d-1)*c+(i-1)*6+75] := sLimit;
End;
Deck[(d-1)*c+82] := sProtStop;
Deck[(d-1)*c+83] := sProtBenzine;
Deck[(d-1)*c+84] := sProtCrash;
Deck[(d-1)*c+85] := sProtTurn;
Deck[(d-1)*c+86] := sProtTruc;
Deck[(d-1)*c+87] := sProtLimit;
for i := 1 to 10 do
Deck[(d-1)*c+i+87] := sSkip;
for i := 1 to 6 do
deck[(d-1)*c+97+i] := sStart;
if conWithAntiProtection then
Deck[(d-1)*c+104] := sAntiProtection;
end;
End;

Procedure StartGameEvent;
Var
c, p : integer;
Begin
with TINIFile.Create(Game.Path+'mile-by-mile.ini') do
try
WriteInteger('Main', 'Distance', cbDistance.itemIndex);
WriteInteger('Main', 'NumDeck', cbNumDeck.itemIndex);
WriteBool('Main', 'PairToPair', cPairToPair.Checked);
WriteBool('Main', 'WithAntiProtection', cAntiProtection.Checked);
finally
free;
end;
cbDistance.Enabled := False;
cbNumDeck.Enabled := False;
cPairToPair.Enabled := False;
cAntiProtection.Enabled := False;

globNumDeck := cbNumDeck.itemindex;
case cbDistance.itemIndex of
1 : conDistance := 2000;
2 : conDistance := 3000;
3 : conDistance := 4000;
4 : conDistance := 5000;
5 : conDistance := 6000;
6 : conDistance := 7000;
7 : conDistance := 8000;
8 : conDistance := 9000;
9 : conDistance := 10000;
else conDistance := 1000;
end;

conPairToPair := cPairToPair.Checked;
if conPairToPair and (not (game.CountPlayers in [4,6,8,10])) then
conPairToPair := False;
conWithAntiProtection := cAntiProtection.Checked;

GameUpdateCaption;
SynchronizeConfig;

if globNumDeck>0 then
Begin
DeckInit;
DeckShuffle(Deck, 6000 * globNumDeck);
end else
begin
globNumDeck := 1;
for p := 1 to game.countPlayers do
begin
DeckInit;
DeckShuffle(Deck, 6000);
for c := 0 to length(deck)-1 do deck2[p, c] := deck[c];
cntdeck2[p] := length(deck);
cntdeckout2[p] := 0;
end;
globNumDeck := 0;
SetLength(deck, 0);
end;

For p := 1 to game.countPlayers do
Begin
players[p] := game.player[p].id;
game.player[p].prop1 := stBenzine + stTruc + stNoCrash + stNoTurn +
stNoLimit;
game.player[p].prop2 := 0;
game.player[p].prop3 := 0;
game.player[p].prop4 := 0;
end;

gs := gsStart;
SynchronizeGame;
game.activePlayer := game.player[Trunc(random * game.countPlayers)+1];

for c := 1 to 6 do
For p := 1 to game.countPlayers do
SendCommand(toAll, comGetCardFromDeck, p);

for c := 1 to 6 do
For p := 1 to game.countPlayers do
GetCardFromDeck(game.player[p]);

tmPlay.Enabled := True;
tmGo.enabled := true;
board.setFocus;
End;

Procedure PlayTimerEvent(t : TTimer);
Begin
t.enabled := False;
case gs and gsMask of
gsStart : Begin
gs := gsPlay;
SynchronizeGame;
SendCommand(toAll, comGetCardFromDeck, game.activePlayerIndex);
GetCardFromDeck(game.activePlayer);
game.updateActivePlayer;
if game.activePlayer.isVirtual then game.computerRepeat;
End;
end;
End;

Procedure DestroyControls;
Begin
if assigned(tmPlay) then
Begin
tmPlay.enabled := False;
tmPlay.Free;
End;
if assigned(lDistance) then lDistance.Free;
if assigned(cbDistance) then cbDistance.Free;
if assigned(lNumDeck) then lNumDeck.Free;
if assigned(cbNumDeck) then cbNumDeck.Free;
if assigned(cPairToPair) then cPairToPair.Free;
if assigned(cAntiProtection) then cAntiProtection.Free;
End;

Procedure UpdateClientEvent(Player: TPlayer);
var p : integer;
Begin
if (assigned(Player)) and (not player.isMy) Then
Begin
SynchronizeConfig(player.index);
SynchronizeGame(player.index);
Game.UpdateActivePlayer(player.id);
end else
begin
BoardUpdate;
End;
End;

Procedure PlayerStatusChangeEvent(Player: TPlayer; s : TUserStatus);
Begin
if (assigned(Player)) and (not Player.isVirtual) Then
UpdateClientEvent(Player)
else if (assigned(player)) and (s = uPlayerClient) Then
Game.ComputerRepeat;
End;

Procedure CommandEvent(const player: TPlayer; const command : Integer;
const param1 : Variant = NULL; const param2 : Variant = NULL; const
param3 : Variant = NULL; const param4 : Variant = NULL; const param5 :
Variant = NULL);
Begin
case command of
comGiveUp : GiveUpSuccess(player);
comCardDropped :
if (param1>0) and (param1<=game.countPlayers) and (param2>=0) and
(param2<=game.countPlayers) and (param3>=0) and
(param3<game.player[param1].hand.count) then
CardDropped(game.player[param1], IntegerToPlayer(param2), param3);
end;
End;

Procedure ComputerEvent;
var
cardindex : integer;
Begin
if assigned(game.activePlayer) and game.activePlayer.isVirtual and ((gs
and gsMask) = gsPlay) then
Begin
cardindex := trunc(random*game.activePlayer.hand.count);
lastCard := fetch(game.activePlayer.hand[cardindex]);
if lastCard in
[sStart,s25,s50,s75,s100,s200,sBenzine,sAntiCrash,sAntiTurn,sTruc,sProtStop,sProtBenzine,sProtCrash,sProtTurn,sProtTruc,sProtLimit,sAntiLimit]
then lastPlayer := activePlayer
else begin
if (lastCard=sSkip) or conPairToPair or (game.countPlayers=2) then
lastPlayer := NextPlayer(activePlayer)
else begin // выпадающее меню:
while lastPlayer = game.activePlayer do lastPlayer :=
game.player[Trunc(random*game.countPlayers)+1];
end;
end;
CardDropped(game.activePlayer, lastPlayer, cardindex);
End;
End;

Procedure DistanceEnterEvent(cb : TCombobox);
Begin
Say(_distance);
End;

Procedure NumDeckEnterEvent(cb : TCombobox);
Begin
Say(_numdeck);
End;

Function BeforeStartEvent(const countPlayers : integer) : Boolean;
Begin
if game.countPlayers = 5 then
Begin
message(_no_5_players, 0);
result := false;
end else
if (game.countPlayers = 6) and (not cPairToPair.checked) then
Begin
Message(_no_6_players, 0);
result := false;
end else
if (game.countPlayers = 4) and (not cPairToPair.checked) then
Begin
Message(_no_4_players, 0);
result := false;
end else result := true;
end;

Procedure UpdateConfigGame(Sender : TObject);
Begin
case cbDistance.itemIndex of
1 : conDistance := 2000;
2 : conDistance := 3000;
3 : conDistance := 4000;
4 : conDistance := 5000;
5 : conDistance := 6000;
6 : conDistance := 7000;
7 : conDistance := 8000;
8 : conDistance := 9000;
9 : conDistance := 10000;
else conDistance := 1000;
end;
conPairToPair := cPairToPair.Checked;
conWithAntiProtection := cAntiProtection.Checked;
globNumDeck := cbNumDeck.itemindex;
game.UpdateGameInfo;
End;

var
inumdeck : byte;

Begin
Game.OnUpdate := @UpdateClientEvent;
Game.OnPlayerChangeStatus := @PlayerStatusChangeEvent;
Game.OnComputer := @ComputerEvent;
game.onBeforeStart := @BeforeStartEvent;

tmPlay := CreateTimer(5000, @PlayTimerEvent);
lDistance := CreateLabel(panel, _distance+':', 10, 10, 100, 13);
cbDistance := CreateCombobox(panel, 110, 10, 100, 21);
cbDistance.onChange := @UpdateConfigGame;
cbDistance.OnEnter := @DistanceEnterEvent;
cbDistance.items.add(Format(Lng(_of_miles, Declensions(1000, 1)),
['1000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(2000, 1)),
['2000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(3000, 1)),
['3000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(4000, 1)),
['4000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(5000, 1)),
['5000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(6000, 1)),
['6000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(7000, 1)),
['7000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(8000, 1)),
['8000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(9000, 1)),
['9000']));
cbDistance.items.add(Format(Lng(_of_miles, Declensions(10000, 1)),
['10000']));

lNumDeck := CreateLabel(panel, _numdeck+':', 10, 85, 100, 13);
cbNumDeck := CreateCombobox(panel, 110, 85, 100, 21);
cbNumDeck.onChange := @UpdateConfigGame;
cbNumDeck.OnEnter := @NumDeckEnterEvent;
cbNumDeck.items.add(_each_has_its_own);
for inumdeck := 1 to 5 do
cbNumDeck.items.add(format(lng(_ofdeck, Declensions(inumdeck, 1)),
[IntToStr(inumdeck)]));

cPairToPair := CreateCheckbox(panel, _pair_to_pair, 10, 35, 100, 21);
cPairToPair.onClick := @UpdateConfigGame;
cAntiProtection := CreateCheckbox(panel, _with_anti_protection, 10, 60,
100, 21);
cAntiProtection.onClick := @UpdateConfigGame;

with TINIFile.Create(Game.Path+'mile-by-mile.ini') do
try
cbDistance.itemIndex := ReadInteger('Main', 'Distance', 0);
cbNumDeck.itemIndex := ReadInteger('Main', 'NumDeck', 0);
cPairToPair.Checked := ReadBool('Main', 'PairToPair', False);
cAntiProtection.Checked := ReadBool('Main', 'WithAntiProtection', False);
finally
free;
end;
UpdateConfigGame(nil);
End.

с уважением Алексей

Ответить   Fri, 28 Oct 2016 16:27:25 +0300 (#3445444)