home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
cb
/
setup
/
cbuilder
/
data.z
/
OPTIONS.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-28
|
2KB
|
42 lines
//----------------------------------------------------------------------------
//Borland C++Builder
//Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.
//----------------------------------------------------------------------------
//---------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "options.h"
#include "swatmain.h"
//---------------------------------------------------------------------
#pragma resource "*.dfm"
TOptionsDlg *OptionsDlg;
//---------------------------------------------------------------------
__fastcall TOptionsDlg::TOptionsDlg(TComponent* AOwner)
: TForm(AOwner)
{
}
//---------------------------------------------------------------------
void __fastcall TOptionsDlg::FormShow(TObject *Sender)
{
char timebuf[6];
SpeedSet->Position = SpeedSet->Max + 1 - SwatForm->LiveTime;
PopulationSet->Position = SwatForm->Frequence;
GameTimeSet->Text = itoa(SwatForm->GameTime, timebuf, 10);
}
//---------------------------------------------------------------------
void __fastcall TOptionsDlg::OKBtnClick(TObject *Sender)
{
SwatForm->LiveTime = SpeedSet->Max + 1 - SpeedSet->Position;
SwatForm->Frequence = PopulationSet->Position;
SwatForm->GameTime = atoi(GameTimeSet->Text.c_str());
// limit the value of GameTime to a reasonable length
if (SwatForm->GameTime < 1)
SwatForm->GameTime = 150;
if (SwatForm->GameTime > 9999)
SwatForm->GameTime = 9999;
}
//---------------------------------------------------------------------