home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / borland / cb / setup / cbuilder / data.z / OPTIONS.CPP < prev    next >
C/C++ Source or Header  |  1997-02-28  |  2KB  |  42 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "options.h"
  10. #include "swatmain.h"
  11. //---------------------------------------------------------------------
  12. #pragma resource "*.dfm"
  13. TOptionsDlg *OptionsDlg;
  14. //--------------------------------------------------------------------- 
  15. __fastcall TOptionsDlg::TOptionsDlg(TComponent* AOwner)
  16.   : TForm(AOwner)
  17. {
  18. }
  19. //---------------------------------------------------------------------
  20. void __fastcall TOptionsDlg::FormShow(TObject *Sender)
  21. {
  22.     char timebuf[6];
  23.  
  24.     SpeedSet->Position = SpeedSet->Max + 1 - SwatForm->LiveTime;
  25.     PopulationSet->Position = SwatForm->Frequence;
  26.     GameTimeSet->Text = itoa(SwatForm->GameTime, timebuf, 10);
  27. }
  28. //---------------------------------------------------------------------
  29. void __fastcall TOptionsDlg::OKBtnClick(TObject *Sender)
  30. {
  31.     SwatForm->LiveTime = SpeedSet->Max + 1 - SpeedSet->Position;
  32.     SwatForm->Frequence = PopulationSet->Position;
  33.     SwatForm->GameTime = atoi(GameTimeSet->Text.c_str());
  34.  
  35.     // limit the value of GameTime to a reasonable length
  36.     if (SwatForm->GameTime < 1)
  37.         SwatForm->GameTime = 150;
  38.     if (SwatForm->GameTime > 9999)
  39.         SwatForm->GameTime = 9999;
  40. }
  41. //---------------------------------------------------------------------
  42.