Subversion Repositories plumbers

Rev

Rev 20 | Rev 22 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 20 Rev 21
Line 244... Line 244...
244
  end;
244
  end;
245
end;
245
end;
246
 
246
 
247
procedure TMainForm.FormDestroy(Sender: TObject);
247
procedure TMainForm.FormDestroy(Sender: TObject);
248
begin
248
begin
249
  FreeAndNil(Game);
249
  if Assigned(Game) then FreeAndNil(Game);
250
 
250
 
251
  // Without this, some audio drivers could crash if you press ESC to end the game.
251
  // Without this, some audio drivers could crash if you press ESC to end the game.
252
  // (VPC 2007 with Win95; cpsman.dll crashes sometimes)
252
  // (VPC 2007 with Win95; cpsman.dll crashes sometimes)
253
  PlaySound(nil, hinstance, 0);
253
  PlaySound(nil, hinstance, 0);
254
  FreeAndNil(csCancelSceneRequest);
254
  FreeAndNil(csCancelSceneRequest);
255
  if Assigned(Game) then FreeAndNil(Game);
-
 
256
end;
255
end;
257
 
256
 
258
procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word;
257
procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word;
259
  Shift: TShiftState);
258
  Shift: TShiftState);
260
begin
259
begin
Line 372... Line 371...
372
    Game.WaitCallback := cbWait;
371
    Game.WaitCallback := cbWait;
373
    Game.SetHotspotCallback := cbSetHotspot;
372
    Game.SetHotspotCallback := cbSetHotspot;
374
    Game.ClearHotspotsCallback := cbClearHotspots;
373
    Game.ClearHotspotsCallback := cbClearHotspots;
375
    Game.Run;
374
    Game.Run;
376
  except
375
  except
-
 
376
    on E: EAbort do
-
 
377
    begin
-
 
378
      Close;
-
 
379
    end;
377
    on E: Exception do
380
    on E: Exception do
378
    begin
381
    begin
379
      MessageDlg(E.Message, mtError, [mbOK], 0);
382
      MessageDlg(E.Message, mtError, [mbOK], 0);
380
      Close;
383
      Close;
381
    end;
384
    end;