1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799
|
unit CevoMapMain;
{***********************************************************
Project: C-evo External Map Generator
Copyright: 1999-2024 P Blackman
License: GPLv3+
Code for main interface form.
***********************************************************}
interface
uses
LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Spin, ComCtrls, Buttons, CevoMapFile, LCLTranslator;
type
{ TFrmInterface }
TFrmInterface = class(TForm)
BtnLoadTemplate: TButton;
BtnSaveTemplate: TButton;
Image1: TImage;
LabelNSR1: TLabel;
LabelNSR2: TLabel;
LabelEmail: TLabel;
LblResource: TLabel;
LabelLnd: TLabel;
LabelSmooth: TLabel;
LblBias: TLabel;
LblGain: TLabel;
PnlResource: TPanel;
PnlTemp: TPanel;
RG_Resource: TRadioGroup;
SaveDialog1: TSaveDialog;
SaveDialog2: TSaveDialog;
OpenDialog1: TOpenDialog;
OpenDialog2: TOpenDialog;
PanelMain: TPanel;
PageControl1: TPageControl;
SE_Resource: TSpinEdit;
TS_FileControl: TTabSheet;
TS_LandMass: TTabSheet;
TS_Weather: TTabSheet;
PanelStats: TPanel;
LabelStatsOcean: TLabel;
LabelStatsMountain: TLabel;
LabelStatsGrass: TLabel;
LabelStatsDesert: TLabel;
LabelStatsHill: TLabel;
LabelStatsForest: TLabel;
LabelStatsPrairie: TLabel;
LabelStatsSwamp: TLabel;
LabelStatsTundra: TLabel;
LabelStatsGlacier: TLabel;
LabelStatsRiver: TLabel;
EditStatsOcean: TEdit;
EditStatsMountain: TEdit;
EditStatsGrass: TEdit;
EditStatsDesert: TEdit;
EditStatsHill: TEdit;
EditStatsForest: TEdit;
EditStatsSwamp: TEdit;
EditStatsPrairie: TEdit;
EditStatsTundra: TEdit;
EditStatsGlacier: TEdit;
EditStatsRiver: TEdit;
PanelBodies: TPanel;
PanelMapShape: TPanel;
RG_LandMass: TRadioGroup;
PanelOceanLevel: TPanel;
LabelSeaLevel: TLabel;
SE_OceanLevel: TSpinEdit;
RG_Mountains: TRadioGroup;
PnlStatus: TPanel;
LblStatus: TLabel;
RG_Size: TRadioGroup;
RG_Age: TRadioGroup;
SpinPanelSize: TPanel;
SpinLabelSize: TLabel;
SpinPanelErosion: TPanel;
LabelErosion: TLabel;
SpinDim: TSpinEdit;
SpinWave: TSpinEdit;
PanelGo: TPanel;
MultiLineBtn1: TButton;
Button1: TButton;
PanelSize: TPanel;
SpinHeight: TSpinEdit;
Label1: TLabel;
SpinWidth: TSpinEdit;
Label2: TLabel;
LabelSize: TLabel;
LabelArea: TLabel;
RG_MapSize: TRadioGroup;
PanelFiles: TPanel;
BtnSave: TBitBtn;
BtnLoad: TBitBtn;
LabelFiles: TLabel;
PanelCitySquares: TPanel;
LabelCitySquares: TLabel;
LabelCitySquares2: TLabel;
PanelLandButons: TPanel;
ButtonLandDefault: TButton;
CheckBoxRandomLand: TCheckBox;
PanelWeatherButtons: TPanel;
ButtonDefaultWeather: TButton;
CheckBoxRandomWeather: TCheckBox;
PanelPoles: TPanel;
LabelPoles: TLabel;
RG_RainPoles: TRadioGroup;
PanelPolesRain: TPanel;
TabSheetAboiut: TTabSheet;
PanelAboutName: TPanel;
PanelVersion: TPanel;
VersionLabel1: TLabel;
VersionLabel2: TLabel;
VersionLabel3: TLabel;
VersionLabel4: TLabel;
VersionLabel5: TLabel;
Templates: TTabSheet;
TabSheetTemperature: TTabSheet;
PanelEquator: TPanel;
RG_TempEqu: TRadioGroup;
SpinPanelTemp: TPanel;
SE_EquTemp: TSpinEdit;
RG_RainEqu: TRadioGroup;
SpinPanelRain: TPanel;
RG_TempPoles: TRadioGroup;
PanelPolesTemp: TPanel;
SE_PolesTemp: TSpinEdit;
PanelTemerature2: TPanel;
ButtonDefaultTemp: TButton;
CheckBoxRandomTemp: TCheckBox;
PanelrainTune: TPanel;
PnlRivers: TPanel;
LabelRiver2: TLabel;
RG_Rivers: TRadioGroup;
PanelRainVarys: TPanel;
LabelRainVaries: TLabel;
SpinWaveRain: TSpinEdit;
Panelrainvariation: TPanel;
Labelrainvaryability: TLabel;
SpinGainRain: TSpinEdit;
LabelrainTune: TLabel;
PanelFineTemp: TPanel;
PanelTempVary: TPanel;
LabelTempSquares: TLabel;
SpinWaveTemp: TSpinEdit;
PanelTempvariability: TPanel;
LabelTempVariability: TLabel;
SpinGainTemp: TSpinEdit;
LabelTempMain: TLabel;
LabelTempFine: TLabel;
LabelAboutInfo: TLabel;
SpinPanelImageSize: TPanel;
SpinLabelImageSize: TLabel;
SpinEditImageSize: TSpinEdit;
LabelScroll: TLabel;
LabelThumbnail: TLabel;
LabelGen: TLabel;
ProgressBar1: TProgressBar;
SpinWater: TSpinEdit;
SE_RainEqu: TSpinEdit;
SE_PolesRain: TSpinEdit;
UD_Scroll: TUpDown;
PanelPerf: TPanel;
OP_Citysquares: TPanel;
OP_Area: TPanel;
LabelAuthor: TLabel;
PanelMountainLevel: TPanel;
Label5: TLabel;
SE_MountainLevel: TSpinEdit;
SpinDimTemp: TSpinEdit;
SpinDimRain: TSpinEdit;
SpinBias: TSpinEdit;
SpinGain: TSpinEdit;
procedure BtnLoadTemplateClick;
procedure BtnSaveTemplateClick;
procedure Button1Click;
procedure FormCreate;
procedure BtnSaveClick;
procedure RG_ResourceSelectionChanged(Sender: TObject);
procedure SE_ResourceChange(Sender: TObject);
procedure SpinHeightChange;
procedure SpinWidthChange;
procedure FormResize;
procedure MultiLineBtn1Click;
procedure BtnLoadClick;
procedure RG_LandMassChanged(Sender: TObject);
procedure RG_MountainsChanged(Sender: TObject);
procedure RG_AgeChanged(Sender: TObject);
procedure RG_SizeChanged(Sender: TObject);
procedure RG_TempEquatChanged(Sender: TObject);
procedure RG_TempPolesChanged(Sender: TObject);
procedure AdjustMapSize;
procedure ButtonLandDefaultClick;
procedure ButtonDefaultWeatherClick;
procedure RG_RainPolesChanged(Sender: TObject);
procedure RG_RainEquatChanged(Sender: TObject);
procedure RG_RiversChanged(Sender: TObject);
procedure SpinEditScrollChange;
procedure SpinEditImageSizeChange;
procedure ButtonDefaultTempClick;
procedure UD_ScrollClick(Sender: TObject);
private
procedure CopyTemplates;
protected
ResetNoise: Boolean;
procedure SaveTemplate (MyFilePath : String);
procedure LoadFile(var Mf: TMapFile; Filename: String);
procedure DisplayStats;
procedure ReDisplay;
procedure RandomCheck;
procedure DefaultLand;
procedure DefaultRain;
procedure DefaultTemp;
procedure MapDefaults;
procedure BuildMap;
procedure ResetScrollPosition;
procedure SetScrollEnable;
procedure Sizes;
procedure SpinEditHack (Var SE : TSpinEdit);
procedure CheckResourceWarning;
public
procedure CheckifLoadneeded;
end;
var
FrmInterface: TFrmInterface;
implementation uses INIFiles, FileUtil, MapTiles, ImageForm, CevoMap, Rivers, Settings;
{$R *.lfm}
const
Min_Map = 400;
Lacunarity = 1.9;
clOrange = TColor($00A5FF);
Old_LxMax = 100;
Old_LyMax = 96;
OldMapMax = Old_LxMax * Old_LyMax;
var MyMap: TMap;
procedure TFrmInterface.ResetScrollPosition;
begin
UD_Scroll.position := 0;
FrmImage.Scroll := 0;
end;
procedure TFrmInterface.SetScrollEnable;
begin
UD_Scroll.Enabled := True;
end;
procedure TFrmInterface.DisplayStats;
var Rivers: Integer;
Stats: tTerrainArray;
begin
FrmImage.Init(SpinWidth.Value, SpinHeight.Value, SpinEditImageSize.Value);
Rivers := 0;
Stats := MyMap.GetStats(Rivers);
EditStatsOcean.Text := IntToStr(Stats[Ocean]+Stats[Coast]) + '%';
EditStatsMountain.Text := IntToStr(Stats[Mountain]) + '%';
EditStatsGrass.Text := IntToStr(Stats[Grass]) + '%';
EditStatsDesert.Text := IntToStr(Stats[Desert]) + '%';
EditStatsHill.Text := IntToStr(Stats[Hills]) + '%';
EditStatsForest.Text := IntToStr(Stats[Forest]) + '%';
EditStatsPrairie.Text := IntToStr(Stats[Prairie]) + '%';
EditStatsSwamp.Text := IntToStr(Stats[Swamp]) + '%';
EditStatsTundra.Text := IntToStr(Stats[Tundra]) + '%';
EditStatsGlacier.Text := IntToStr(Stats[Glacier]) + '%';
EditStatsRiver.Text := IntToStr(Rivers) + '%';
if MyMap.CitySquares < 12 then
OP_CitySquares.color := clOrange
else
if MyMap.CitySquares < 27 then
OP_CitySquares.color := clYellow
else
OP_CitySquares.color := clBtnFace;
OP_CitySquares.Caption := IntToStr(MyMap.CitySquares);
end;
procedure TFrmInterface.RandomCheck;
begin
if CheckBoxRandomWeather.Checked then
begin
RG_RainEqu.ItemIndex := random(5);
RG_RainPoles.ItemIndex := random(5);
end;
if CheckBoxRandomTemp.Checked then
begin
{ Skew slightly towards cold pole/not equ}
RG_TempEqu.ItemIndex := random(4);
RG_TempPoles.ItemIndex := 1 + random(4);
end;
if CheckBoxRandomLand.Checked then
begin
RG_Size.ItemIndex := random(5);
RG_Age.ItemIndex := random(4);
RG_Mountains.ItemIndex := random(5);
RG_LandMass.ItemIndex := random(6);
end;
end;
procedure TFrmInterface.BuildMap;
var myrivers: trivers;
J, K: Integer;
C1, C2: Int64;
begin
lblstatus.color := clBtnface;
Screen.Cursor := CrHourGlass;
Progressbar1.position := 10;
RandomCheck;
if MyMap <> nil then
FreeAndNil (MyMap);
MyMap := TMap.Create(
SpinWidth.Value,
SpinHeight.Value,
SE_OceanLevel.Value,
SE_MountainLevel.Value);
LblStatus.Caption := 'Altitude';
LblStatus.update;
Progressbar1.position := 20;
C1 := GetTickCount64;
MyMap.GenMap(Altitude,
{ wavelength is double feature size }
{ ie. lake + island }
{but reduce slightly, as features seem too big }
1.9 * SpinWave.Value,
(SpinDim.Value) / 10,
Lacunarity,
SpinBias.Value,
SpinBias.Value,
SpinGain.Value,
ResetNoise);
LblStatus.Caption := 'Rainfall';
LblStatus.update;
Progressbar1.position := 30;
MyMap.GenMap(Rainfall,
SpinWaveRain.Value,
SpinDimRain.Value / 20,
Lacunarity,
SE_RainEqu.Value,
SE_PolesRain.Value,
SpinGainRain.Value,
False);
LblStatus.Caption := 'Temperature';
LblStatus.update;
Progressbar1.position := 40;
MyMap.GenMap(Temperature,
SpinWaveTemp.Value,
SpinDimTemp.Value / 20,
Lacunarity,
SE_EquTemp.Value,
SE_PolesTemp.Value,
SpinGainTemp.Value,
False);
{ Show performance so far }
C2 := GetTickCount64;
PanelPerf.Caption := IntToStr((C2 - C1));
with MyMap do
begin
ClearStats;
AltitudeSort;
AdjustSeaLevel;
AdjustMountainLevel;
CullSingleTileIslands;
end;
if SpinWater.Value > 0 then
begin
LblStatus.Caption := 'Rivers';
LblStatus.update;
Progressbar1.position := 50;
myrivers := trivers.Create(SpinWater.Value);
myrivers.loaddata(MyMap);
Progressbar1.position := 60;
LblStatus.Caption := 'Run Rivers';
myrivers.Generate;
Progressbar1.position := 70;
Myrivers.Free;
end;
LblStatus.Caption := 'Terrain';
LblStatus.update;
Progressbar1.position := 90;
MyMap.MakeTerrain (SE_Resource.Value);
LblStatus.Caption := 'OK';
LblStatus.update;
DisplayStats;
if SpinEditImageSize.Value > 0 then
{Show Thumbnail Image }
FrmImage.DisplayMap(MyMap, SpinEditImageSize.Value)
else
frmImage.Hide;
Progressbar1.position := 100;
Screen.Cursor := CrDefault;
end;
{ Same Layout }
procedure TFrmInterface.Button1Click;
begin
ResetNoise := False;
CheckBoxRandomLand.Checked := False;
BuildMap;
SetScrollEnable;
end;
{ New Layout }
procedure TFrmInterface.MultiLineBtn1Click;
begin
ResetNoise := True;
ResetScrollPosition;
BuildMap;
SetScrollEnable;
end;
// Lazarus 3.0 breaks SpinEdits for Qt5 (Issue #40725)
procedure TFrmInterface.SpinEditHack (Var SE : TSpinEdit);
begin
SE.ControlStyle := SE.ControlStyle - [csCaptureMouse];
end;
procedure TFrmInterface.FormCreate;
begin
Show;
{$ifdef LCLQT5}
SpinEditHack (SE_Resource);
SpinEditHack (SE_OceanLevel);
SpinEditHack (SpinDim);
SpinEditHack (SpinWave);
SpinEditHack (SpinHeight);
SpinEditHack (SpinWidth);
SpinEditHack (SE_EquTemp);
SpinEditHack (SE_PolesTemp);
SpinEditHack (SpinWaveRain);
SpinEditHack (SpinGainRain);
SpinEditHack (SpinWaveTemp);
SpinEditHack (SpinGainTemp);
SpinEditHack (SpinEditImageSize);
SpinEditHack (SpinWater);
SpinEditHack (SE_RainEqu);
SpinEditHack (SE_PolesRain);
SpinEditHack (SE_MountainLevel);
SpinEditHack (SpinDimTemp);
SpinEditHack (SpinDimRain);
SpinEditHack (SpinBias);
SpinEditHack (SpinGain);
{$endif}
end;
{ Save current map }
procedure TFrmInterface.BtnSaveClick;
var Mf: TMapFile;
begin
if MyMap = nil then
{ No map yet }
else
begin
Mf := TmapFile.Create;
Mf.Height := MyMap.Height;
Mf.Width := MyMap.Width;
Mf.SaveTileData(MyMap);
SaveDialog1.InitialDir := Mf.SavePath;
SaveDialog1.FileName := Mf.SaveFileName;
if (Mf.Height > Old_LyMax)
or (Mf.Width > Old_LxMax)
or (SE_Resource.Value <> -1) then
SaveDialog1.Title := 'Save C-evo Map, Distant Horizon only'
else
SaveDialog1.Title := 'Save C-evo Map';
if SaveDialog1.Execute then
Mf.SaveMFile(SaveDialog1.filename);
Mf.Free;
end;
end;
procedure TFrmInterface.CheckResourceWarning;
begin
if SE_Resource.Value = -1 then
begin
labelNSR1.color := clBtnFace;
labelNSR2.color := clBtnFace;
SE_Resource.Color := clBtnFace;
end
else
begin
// Highlight not valid unless Distant Horizon
labelNSR1.color := clYellow;
labelNSR2.color := clYellow;
labelNSR1.transparent := False;
labelNSR2.transparent := False;
SE_Resource.Color := clYellow;
end;
end;
procedure TFrmInterface.SE_ResourceChange(Sender: TObject);
begin
CheckResourceWarning;
end;
{ Load file from name, may be called from button or by file association }
procedure TFrmInterface.LoadFile(var Mf: TMapFile; Filename: String);
begin
if Mf.OpenMFile(filename) then
if Mf.LoadFromFile then
begin
ResetScrollPosition;
{ Order is critical here because of side efects of on change events }
Spinwidth.Value := Mf.Width;
Spinheight.Value := Mf.Height;
if MyMap <> nil then
FreeandNil (MyMap);
MyMap := TMap.Create(
Mf.Width,
Mf.Height,
SE_OceanLevel.Value,
SE_MountainLevel.Value);
Mf.LoadMapdata(MyMap);
DisplayStats;
FrmImage.Caption := ' ' + ExtractFileName(Filename);
FrmImage.DisplayMap(MyMap, SpinEditImageSize.Value);
SetScrollEnable;
end;
end;
{ test command line, and load map if specified }
procedure TFrmInterface.CheckifLoadneeded;
var ll : string;
Mf: TMapFile;
begin
if ParamStr(1) = '' then
// Nothing to do
else
if (Length (ParamStr(1)) = 5)
and (Copy (ParamStr(1), 1,2) = '-l') then
begin
// language code
ll := Copy (ParamStr(1), 4,2);
SetDefaultLang(ll);
end
else
begin
// Map File ?
Mf := TmapFile.Create;
try
LoadFile(MF, ParamStr(1));
except
ShowMessage ('Failed to load map ' + ParamStr(1));
end;
Mf.Free;
end;
end;
{ Process Load Map button }
procedure TFrmInterface.BtnLoadClick;
var Mf: TMapFile;
begin
Mf := TmapFile.Create;
OpenDialog1.InitialDir := Mf.LoadPath;
if OpenDialog1.Execute then
LoadFile(MF, OpenDialog1.filename);
Mf.Free;
end;
procedure TFrmInterface.Sizes;
var Area : integer;
begin
Area := SpinHeight.Value * SpinWidth.Value;
IF SpinHeight.Value > Old_LyMax then
SpinHeight.Color := clYellow {Not valid in old versions}
Else
SpinHeight.Color := clBtnFace;
IF SpinWidth.Value > Old_LxMax then
SpinWidth.Color := clYellow {Not valid in old versions}
Else
SpinWidth.Color := clBtnFace;
If Area > OldMapMax then
Op_Area.Color := clYellow {Not valid in old versions}
Else
Op_Area.Color := clBtnFace;
Op_Area.Caption := IntToStr(Area);
end;
procedure TFrmInterface.SpinHeightChange;
begin
if SpinHeight.Value * SpinWidth.Value > MaxMap then
begin
SpinWidth.Value := MaxMap DIV SpinHeight.Value;
if Odd(SpinWidth.Value) then
SpinWidth.Value := PRED(SpinWidth.Value);
end
else if SpinHeight.Value * SpinWidth.Value < Min_Map then
begin
SpinWidth.Value := Round(Min_Map / SpinHeight.Value);
if Odd(SpinWidth.Value) then
SpinWidth.Value := SUCC(SpinWidth.Value);
end;
Sizes;
end;
procedure TFrmInterface.SpinWidthChange;
begin
if SpinHeight.Value * SpinWidth.Value > MaxMap then
begin
SpinHeight.Value := MaxMap DIV SpinWidth.Value;
if Odd(Spinheight.Value) then
Spinheight.Value := PRED(Spinheight.Value);
end
else if SpinHeight.Value * SpinWidth.Value < Min_Map then
begin
SpinHeight.Value := Round(Min_Map / SpinWidth.Value);
if Odd(Spinheight.Value) then
Spinheight.Value := SUCC(Spinheight.Value);
end;
Sizes;
end;
procedure TFrmInterface.AdjustMapSize;
begin
SpinHeight.Value := UpdateSetting(RG_MapSize.ItemIndex, sMapHeight);
SpinWidth.Value := UpdateSetting(RG_MapSize.ItemIndex, sMapWidth);
end;
{ Used as an initialisation point }
procedure TFrmInterface.FormResize;
begin
Caption := 'C-evo Map Generator v39';
MapDefaults;
Button1.Caption := 'Same' + LineEnding + 'Land';
MultiLineBtn1.Caption := 'New' + LineEnding + 'Land';
AdjustMapSize;
Sizes;
CopyTemplates;
CheckResourceWarning;
end;
procedure TFrmInterface.RG_LandMassChanged(Sender: TObject);
begin
SE_OceanLevel.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sLandMass);
end;
procedure TFrmInterface.RG_ResourceSelectionChanged(Sender: TObject);
begin
SE_Resource.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sResource);
CheckResourceWarning;
end;
procedure TFrmInterface.RG_MountainsChanged(Sender: TObject);
begin
SE_MountainLevel.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sMountains);
end;
procedure TFrmInterface.RG_AgeChanged(Sender: TObject);
begin
SpinDim.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sAge);
end;
procedure TFrmInterface.RG_SizeChanged(Sender: TObject);
begin
SpinWave.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sSize);
end;
procedure TFrmInterface.RG_RiversChanged(Sender: TObject);
begin
SpinWater.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sRivers);
end;
procedure TFrmInterface.RG_TempEquatChanged(Sender: TObject);
begin
SE_EquTemp.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sTempEqat);
end;
procedure TFrmInterface.RG_TempPolesChanged(Sender: TObject);
begin
SE_PolesTemp.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sTempPole);
end;
procedure TFrmInterface.RG_RainEquatChanged(Sender: TObject);
begin
SE_RainEqu.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sRain);
end;
procedure TFrmInterface.RG_RainPolesChanged(Sender: TObject);
begin
SE_PolesRain.Value := UpdateSetting((Sender AS TRadioGroup).ItemIndex, sRain);
end;
procedure TFrmInterface.ButtonLandDefaultClick;
begin
DefaultLand;
end;
procedure TFrmInterface.ButtonDefaultWeatherClick;
begin
DefaultRain;
end;
procedure TFrmInterface.ButtonDefaultTempClick;
begin
DefaultTemp;
end;
procedure TFrmInterface.redisplay;
begin
if (SpinEditImageSize.Value = 0)
OR (mymap = nil) then
{ Nothing to do }
else
begin
{ Scroll works backwards! }
FrmImage.Scroll := -UD_Scroll.position;
FrmImage.DisplayMap(MyMap, SpinEditImageSize.Value);
end;
end;
procedure TFrmInterface.SpinEditScrollChange;
begin
Redisplay;
end;
procedure TFrmInterface.SpinEditImageSizeChange;
begin
if SpinEditImageSize.Value = 0 then
FrmImage.hide
else if mymap <> nil then
begin
Redisplay;
end;
end;
procedure TFrmInterface.UD_ScrollClick(Sender: TObject);
begin
with Sender AS TUpDown do
if UD_Scroll.position > 0 then
if MyMap <> nil then
{ Wrap if position has gone positive }
UD_Scroll.position := UD_Scroll.position - Mymap.Width;
Redisplay;
end;
{$INCLUDE TemplateDefaults}
{$INCLUDE TemplateFiles}
end.
|