La parte del sorteo concluye en este procedimiento:
Código Delphi
[-]procedure TForm5.Button1Click(Sender: TObject);
var
Puesto: TipoPuesto; Cola1,Cola2: TipoCola;
i, fil, col: TipoPos;
Eq1: TipoRegEquipo1;
RDC, RDC2: TipoRegColaD;
begin
AbrirMe (Me);
for Puesto:=1 to _ultimo do
begin
Repartir (Me,Eq1,Puesto);
AbrirCola(Cola);
Decolar (Cola);
for i:=1 to _RangoSup do begin case i of
1: begin
CapturarInfo1 (Equipo1,i,Eq1);
RDC.LocalClave:= Eq1.Clave;
RDC.EquipoLocal:= Eq1.Pais;
end;
2: begin
CapturarInfo1(Equipo1,i,Eq1);
RDC.VisitanteClave:= Eq1.Clave;
RDC.EquipoVisitante:= Eq1.Pais;
Encolar(Cola,RDC);
end;
3: begin
Decolar (Cola);
CapturarInfo1 (Equipo1,i,Eq1);
RDC.LocalClave:= Eq1.Clave;
RDC.EquipoLocal:= Eq1.Pais;
end;
4: begin
CapturarInfo1 (Equipo1,i,Eq1);
RDC.VisitanteClave:= Eq1.Clave;
RDC.EquipoVisitante:= Eq1.Pais;
end;
end;
end;
Decolar (Cola1);
Decolar (Cola2);
for i:=1 to _RangoSup do begin if i=1 then
begin
CapturarInfo1 (Equipo1,i,Eq1);
RDC.LocalClave:= Eq1.Clave;
RDC.EquipoLocal:= Eq1.Pais;
end
else
if i=2
then
begin
CapturarInfo1(Equipo1,i,Eq1);
RDC2.LocalClave:= Eq1.Clave;
RDC2.EquipoLocal:= Eq1.Pais;
end
else
if i=3 then
begin
CapturarInfo1 (Equipo1,i,Eq1);
RDC.VisitanteClave:= Eq1.Clave;
RDC2.VisitanteClave:= Eq1.Clave;
RDC.EquipoVisitante:= Eq1.Pais;
RDC2.EquipoVisitante:= Eq1.Pais;
end
else
begin
Encolar(Cola1,RDC);
Encolar(Cola2,RDC2);
end;
end;
Decolar (Cola1);
Decolar (Cola2);
i:= 4;
while i>=_RangoInf do begin if i=4
then begin
CapturarInfo1 (Equipo1,i,Eq1);
RDC.LocalClave:= Eq1.Clave;
RDC2.LocalClave:= Eq1.Clave;
RDC.EquipoLocal:= Eq1.Pais;
RDC2.EquipoLocal:= Eq1.Pais;
end
else
if i=2
then
begin
CapturarInfo1(Equipo1,i,Eq1);
RDC.VisitanteClave:= Eq1.Clave;
RDC.EquipoVisitante:= Eq1.Pais;
end
else
if i=1
then
begin
CapturarInfo1(Equipo1,i,Eq1);
RDC2.VisitanteClave:= Eq1.Clave;
RDC2.EquipoVisitante:= Eq1.Pais;
end;
i:= i-1;
end;
Encolar (Cola1,RDC);
Encolar (Cola2,RDC2);
end;
StringGrid1.Cells[0, 0]:= 'Local';
StringGrid1.Cells[1, 0]:= 'Visitante';
StringGrid2.Cells[0, 0]:= 'Local';
StringGrid2.Cells[1, 0]:= 'Visitante';
StringGrid3.Cells[0, 0]:= 'Local';
StringGrid3.Cells[1, 0]:= 'Visitante';
StringGrid4.Cells[0, 0]:= 'Local';
StringGrid4.Cells[1, 0]:= 'Visitante';
StringGrid5.Cells[0, 0]:= 'Local';
StringGrid5.Cells[1, 0]:= 'Visitante';
StringGrid6.Cells[0, 0]:= 'Local';
StringGrid6.Cells[1, 0]:= 'Visitante';
StringGrid7.Cells[0, 0]:= 'Local';
StringGrid7.Cells[1, 0]:= 'Visitante';
StringGrid8.Cells[0, 0]:= 'Local';
StringGrid8.Cells[1, 0]:= 'Visitante';
i:=1;
Fil:=1;
while i<=8 do
begin
Decolar (Cola);
case i of
1: begin
while fil<= Ultimo(Cola) do
begin
col:= 0;
while col<=1 do
begin
if col= 0
then
Stringgrid1.Cells[col,fil]:= RDC.EquipoLocal
else
Stringgrid1.Cells[col,fil]:= RDC.EquipoVisitante;
col:= col+1;
end;
fil:=fil+1;
end;
end;
2: begin
while fil<= Ultimo(Cola) do
begin
col:= 0;
while col<=1 do
begin
if col= 0
then
Stringgrid2.Cells[col,fil]:= RDC.EquipoLocal
else
Stringgrid2.Cells[col,fil]:= RDC.EquipoVisitante;
col:= col+1;
end;
fil:=fil+1;
end;
end;
3: begin
while fil<= Ultimo(Cola) do
begin
col:= 0;
while col<=1 do
begin
if col= 0
then
Stringgrid3.Cells[col,fil]:= RDC.EquipoLocal
else
Stringgrid3.Cells[col,fil]:= RDC.EquipoVisitante;
col:= col+1;
end;
fil:=fil+1;
end;
end;
4: begin
while fil<= Ultimo(Cola) do
begin
col:= 0;
while col<=1 do
begin
if col= 0
then
Stringgrid4.Cells[col,fil]:= RDC.EquipoLocal
else
Stringgrid4.Cells[col,fil]:= RDC.EquipoVisitante;
col:= col+1;
end;
fil:=fil+1;
end;
end;
5: begin
while fil<= Ultimo(Cola) do
begin
col:= 0;
while col<=1 do
begin
if col= 0
then
Stringgrid5.Cells[col,fil]:= RDC.EquipoLocal
else
Stringgrid5.Cells[col,fil]:= RDC.EquipoVisitante;
col:= col+1;
end;
fil:=fil+1;
end;
end;
6: begin
while fil<= Ultimo(Cola) do
begin
col:= 0;
while col<=1 do
begin
if col= 0
then
Stringgrid6.Cells[col,fil]:= RDC.EquipoLocal
else
Stringgrid6.Cells[col,fil]:= RDC.EquipoVisitante;
col:= col+1;
end;
fil:=fil+1;
end;
end;
7: begin
while fil<= Ultimo(Cola) do
begin
col:= 0;
while col<=1 do
begin
if col= 0
then
Stringgrid7.Cells[col,fil]:= RDC.EquipoLocal
else
Stringgrid7.Cells[col,fil]:= RDC.EquipoVisitante;
col:= col+1;
end;
fil:=fil+1;
end;
end;
8: begin
while fil<= Ultimo(Cola) do
begin
col:= 0;
while col<=1 do
begin
if col= 0
then
Stringgrid8.Cells[col,fil]:= RDC.EquipoLocal
else
Stringgrid8.Cells[col,fil]:= RDC.EquipoVisitante;
col:= col+1;
end;
fil:=fil+1;
end;
end;
end;
RDC.PuntosLocal:=0;
RDC.PuntosVisitante:=0;
Encolar (Cola,RDC);
i:= i+1;
end;
Edit1.Clear;
Edit1.SetFocus;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
Edit5.Clear;
Edit6.Clear;
Edit7.Clear;
Edit8.Clear;
Edit9.Clear;
Edit10.Clear;
Edit11.Clear;
Edit12.Clear;
Edit13.Clear;
Edit14.Clear;
Edit15.Clear;
Edit16.Clear;
Edit17.Clear;
Edit18.Clear;
Edit19.Clear;
Edit20.Clear;
Edit21.Clear;
Edit22.Clear;
Edit23.Clear;
Edit24.Clear;
Edit25.Clear;
Edit26.Clear;
Edit27.Clear;
Edit28.Clear;
Edit29.Clear;
Edit30.Clear;
Edit31.Clear;
Edit32.Clear;
Edit33.Clear;
Edit34.Clear;
Edit35.Clear;
Edit36.Clear;
Edit37.Clear;
Edit38.Clear;
Edit39.Clear;
Edit40.Clear;
Edit41.Clear;
Edit42.Clear;
Edit43.Clear;
Edit44.Clear;
Edit45.Clear;
Edit46.Clear;
Edit47.Clear;
Edit48.Clear;
Edit49.Clear;
Edit50.Clear;
Edit51.Clear;
Edit52.Clear;
Edit53.Clear;
Edit54.Clear;
Edit55.Clear;
Edit56.Clear;
Edit57.Clear;
Edit58.Clear;
Edit59.Clear;
Edit60.Clear;
Edit61.Clear;
Edit62.Clear;
Edit63.Clear;
Edit64.Clear;
CerrarMe (Me);
CerrarCola(Cola);
end;
Hay también un BuscarPuesto, que acá se los mando aparte:
Código Delphi
[-]function BuscarPuesto(Var Me:TipoMe;Torneo_anterior:TipoPuesto;Var PosAnterior:TipoPosicion):Boolean;
Var
Enc,Corte:Boolean;
RC:TipoRegControl;
RD:TipoRegDatos;
Primero:Tipoposicion;
Begin
Seek(Me.C,_Nulo);
Read(Me.C,RC);
Enc:=False;
Corte:=False;
PosAnterior:=_PosNula;
Primero:=RC.Primero;
While (Not Enc) and (Not Corte) and (Primero<>_PosNula) do
Begin
Seek(Me.D,Primero);
Read(Me.D,RD);
If (RD.Puesto_Anterior= Torneo_anterior) Then
Enc:=True
else
If RD.Puesto_Anterior > Torneo_anterior then
Corte:=True
else
Begin
PosAnterior:=Primero;
Primero:=RD.Enlace;
End;
End;
BuscarPuesto:=Enc;
End;
El problema ahora es que hay que cargar los goles, que lo hace el usuario. Y ahí caí en la cuenta que nose si se esta haciendo bien, porque no tengo la posibilidad de saber que grupo (archivo) estoy manipulando, porque no están encadenados..
Desde ya muchas gracias!!! =)