summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--raetsel.lps115
-rw-r--r--raetselunit.inc8
-rw-r--r--raetselunit.pas36
3 files changed, 91 insertions, 68 deletions
diff --git a/raetsel.lps b/raetsel.lps
index aaeac78..3e553c1 100644
--- a/raetsel.lps
+++ b/raetsel.lps
@@ -40,19 +40,19 @@
<Unit3>
<Filename Value="raetselunit.pas"/>
<IsPartOfProject Value="True"/>
+ <IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
- <TopLine Value="500"/>
- <CursorPos X="8" Y="523"/>
+ <TopLine Value="515"/>
+ <CursorPos X="10" Y="540"/>
<UsageCount Value="47"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="raetselunit.inc"/>
<IsPartOfProject Value="True"/>
- <IsVisibleTab Value="True"/>
<EditorIndex Value="3"/>
- <TopLine Value="475"/>
- <CursorPos X="8" Y="487"/>
+ <TopLine Value="677"/>
+ <CursorPos X="32" Y="689"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit4>
@@ -93,8 +93,8 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
<EditorIndex Value="5"/>
- <TopLine Value="1044"/>
- <CursorPos X="34" Y="993"/>
+ <TopLine Value="44"/>
+ <CursorPos Y="76"/>
<UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit10>
@@ -130,123 +130,120 @@
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="raetselunit.inc"/>
- <Caret Line="674" TopLine="660"/>
+ <Caret Line="131" TopLine="108"/>
</Position1>
<Position2>
<Filename Value="raetselunit.inc"/>
- <Caret Line="679" TopLine="660"/>
+ <Caret Line="128" TopLine="108"/>
</Position2>
<Position3>
<Filename Value="raetselunit.inc"/>
- <Caret Line="681" TopLine="660"/>
+ <Caret Line="13" Column="31"/>
</Position3>
<Position4>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="684" Column="16" TopLine="660"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="346" Column="34" TopLine="344"/>
</Position4>
<Position5>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="93" TopLine="82"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="48" Column="27" TopLine="30"/>
</Position5>
<Position6>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="94" TopLine="82"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="271" Column="15" TopLine="239"/>
</Position6>
<Position7>
<Filename Value="raetselunit.inc"/>
- <Caret Line="95" TopLine="82"/>
+ <Caret Line="548" Column="50" TopLine="513"/>
</Position7>
<Position8>
<Filename Value="raetselunit.inc"/>
- <Caret Line="96" TopLine="82"/>
+ <Caret Line="556" Column="21" TopLine="554"/>
</Position8>
<Position9>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="128" TopLine="108"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="668" Column="22" TopLine="630"/>
</Position9>
<Position10>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="130" TopLine="108"/>
+ <Filename Value="raetselunit.pas"/>
</Position10>
<Position11>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="131" TopLine="108"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="48" Column="27" TopLine="15"/>
</Position11>
<Position12>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="128" TopLine="108"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="273" Column="4" TopLine="242"/>
</Position12>
<Position13>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="130" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
+ <Caret Line="76" Column="14" TopLine="44"/>
</Position13>
<Position14>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="131" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
+ <Caret Line="393" Column="21" TopLine="361"/>
</Position14>
<Position15>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="128" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
+ <Caret Line="443" Column="21" TopLine="410"/>
</Position15>
<Position16>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="130" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
+ <Caret Line="474" Column="21" TopLine="466"/>
</Position16>
<Position17>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="131" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
+ <Caret Line="483" Column="13" TopLine="466"/>
</Position17>
<Position18>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="128" TopLine="108"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="65" Column="6" TopLine="37"/>
</Position18>
<Position19>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="130" TopLine="108"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="45" Column="31" TopLine="38"/>
</Position19>
<Position20>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="131" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
+ <Caret Line="574" Column="28" TopLine="541"/>
</Position20>
<Position21>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="128" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
</Position21>
<Position22>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="130" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
+ <Caret Line="108" Column="31" TopLine="38"/>
</Position22>
<Position23>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="131" TopLine="108"/>
+ <Filename Value="ori_Unit1.pas"/>
</Position23>
<Position24>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="128" TopLine="108"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="531" Column="19" TopLine="504"/>
</Position24>
<Position25>
<Filename Value="raetselunit.inc"/>
- <Caret Line="130" TopLine="108"/>
+ <Caret Line="633" Column="42" TopLine="621"/>
</Position25>
<Position26>
<Filename Value="raetselunit.inc"/>
- <Caret Line="131" TopLine="108"/>
+ <Caret Line="11" Column="39"/>
</Position26>
<Position27>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="128" TopLine="108"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="66" Column="50" TopLine="109"/>
</Position27>
<Position28>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="130" Column="54" TopLine="137"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="67" Column="14" TopLine="47"/>
</Position28>
<Position29>
- <Filename Value="raetselunit.inc"/>
- <Caret Line="13" Column="31"/>
+ <Filename Value="raetselunit.pas"/>
+ <Caret Line="420" Column="22" TopLine="394"/>
</Position29>
<Position30>
<Filename Value="raetselunit.pas"/>
- <Caret Line="270" Column="35" TopLine="272"/>
+ <Caret Line="441" Column="14" TopLine="421"/>
</Position30>
</JumpHistory>
</ProjectSession>
diff --git a/raetselunit.inc b/raetselunit.inc
index 3176ade..b3eb1c5 100644
--- a/raetselunit.inc
+++ b/raetselunit.inc
@@ -653,7 +653,7 @@ begin
end;
{$IFDEF buchstaben}
if inhalt[J+dim*I]=0 then continue;
- Rand[dim+I]:=inhalt[J+dim*I];
+ Rand[3*dim+I]:=inhalt[J+dim*I];
break;
{$ENDIF}
{$IFDEF hochhaus}
@@ -673,7 +673,7 @@ end;
{$IFDEF relativeInhaltsAenderung}
// procedure tHochhausRaetsel.relativeInhaltsAenderung(diff: longint);
begin
- if (cursorPosition<0) or (cursorPosition>=dim*dim) then
+ if (cursorPosition<0) or (cursorPosition>=dim*dim) or startfeld[cursorPosition] then
exit;
{$IFDEF hochhaus}
if inhalt[cursorPosition]=-1 then
@@ -690,6 +690,10 @@ end;
{$IFDEF absoluteInhaltsAenderung}
// function tHochhausRaetsel.absoluteInhaltsAenderung(key: word): boolean;
begin
+ if (cursorPosition<0) or (cursorPosition>=dim*dim) or startfeld[cursorPosition] then begin
+ result:=false;
+ exit;
+ end;
result:=true;
{$IFDEF buchstaben}
if (key>=ord('A')) and (key<=min(ord('A')+groeszen[0]-1,ord('Z'))) then begin
diff --git a/raetselunit.pas b/raetselunit.pas
index 19306a8..e5a8cee 100644
--- a/raetselunit.pas
+++ b/raetselunit.pas
@@ -46,6 +46,7 @@ type
function passt(spalte,zeile: integer): boolean; dynamic; abstract;
function geloest: boolean; dynamic; abstract;
procedure randErzeugen; dynamic; abstract;
+ procedure startfelderFestlegen; dynamic; abstract;
public
constructor create(aOwner: tForm);
destructor destroy; override;
@@ -62,6 +63,8 @@ type
cursorPosition: longint;
zellGroesze: extended;
uebersetze: tAlphabetFunktion;
+ FeldFarben: array of tColor;
+ startfeld: array of boolean;
procedure anzSEsOnChange(sender: tObject);
procedure onKeyDown(sender: tObject; var key: word; shiftState: tShiftState); override;
procedure onMouseDown(sender: tObject; button: tMouseButton; shiftState: tShiftState; x,y: longint); override;
@@ -75,6 +78,7 @@ type
procedure relativeInhaltsAenderung(diff: longint); dynamic; abstract;
function absoluteInhaltsAenderung(key: word): boolean; dynamic; abstract;
procedure gesamtRaenderErzeugen; dynamic; abstract;
+ procedure startfelderfestlegen; override;
public
constructor create(aOwner: tForm; anzInhTypen: longint; alphabetFunktion: tAlphabetFunktion);
destructor destroy; override;
@@ -265,12 +269,14 @@ begin
end;
procedure tRaetsel.erzeugeOnClick(sender: tObject);
+var
+ i: longint;
begin
loeschen;
loesen(-1);
randErzeugen;
leeren;
- // TODO: Startfelder setzen
+ startFelderFestlegen;
zeichnen;
end;
@@ -411,6 +417,8 @@ begin
dim:=dim+groeszen[i];
end;
setlength(inhalt,dim*dim);
+ setlength(startfeld,dim*dim);
+ setlength(feldFarben,dim*dim);
setlength(rand,4*dim);
NSqrt:=round(sqrt(dim));
@@ -428,8 +436,11 @@ procedure tFelderRaetsel.loeschen;
var
i: longint;
begin
- for i:=0 to length(inhalt)-1 do
+ for i:=0 to length(inhalt)-1 do begin
inhalt[i]:=-1;
+ startFeld[i]:=true;
+ feldFarben[i]:=$000000;
+ end;
for i:=0 to length(rand)-1 do
rand[i]:=-1;
end;
@@ -519,16 +530,19 @@ var
begin
s:=uebersetze(i);
with zeichenflaeche.canvas do begin
- brush.color:=$FFFFFF - $181818*byte(diagonalenCB.checked and ((x=y) or (x+y=dim+1)));
+ brush.color:=$FFFFFF;
+ if (x>=0) and (y>=0) and (x<dim) and (y<dim) and (diagonalenCB.checked and ((x=y) or (x+y=dim+1))) then
+ brush.color:=brush.color - $181818;
if not passtZumZeichnen(x,y) then
font.color:=$0000FF
else if geloest then
font.color:=$007F00
-// else if startFeld[x+y*dim] then
-// font.color:=$7F7F7F
+ else if (x<0) or (y<0) or (x>=dim) or (y>=dim) then
+ font.color:=$000000
+ else if startFeld[x+y*dim] then
+ font.color:=$7F7F7F
else
- font.color:=$000000;
- // feldFarben[x+y*dim];
+ font.color:=feldFarben[x+y*dim];
br:=textWidth(s);
ho:=textHeight(s);
@@ -598,6 +612,14 @@ begin
schreibeZentriert(i mod dim,i div dim,inhalt[i]);
end;
+procedure tFelderRaetsel.startfelderfestlegen;
+var
+ i: longint;
+begin
+ for i:=0 to length(inhalt)-1 do
+ startfeld[i]:=inhalt[i]>=0;
+end;
+
{$DEFINE create}
constructor tHochhausRaetsel.create(aOwner: tForm);
{$DEFINE hochhaus}