wollen 2 spielfelder machen mit andere auflösung diese ist 1680*1050.
in zeile 288 ist der fehler bitte um hilfe immer wenn ich das haus anklicke im baumenü
Spoiler anzeigen
#cs ----------------------------------------------
The Destroyed City /
#ce ---------------------------------------------
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <ArrayMore.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#include <Date.au3>
[/autoit] [autoit][/autoit] [autoit]#cs ----------------------------------------------
The Destroyed City /Spielfeld/
#ce ---------------------------------------------
If FileExists("") Then
Else
DirCreate("C:\Programme\The Destroyed City\images\Spielfeld\")
FileInstall("images\Spielfeld\header.jpg","C:\Programme\The Destroyed City\images\Spielfeld\header.jpg")
FileInstall("images\Spielfeld\spielfeld.jpg","C:\Programme\The Destroyed City\images\Spielfeld\spielfeld.jpg")
FileInstall("images\Spielfeld\menufeld.jpg","C:\Programme\The Destroyed City\images\Spielfeld\menufeld.jpg")
EndIf
#cs ----------------------------------------------
The Destroyed City /Spielfeld/
#ce ---------------------------------------------
FileDelete(@ScriptDir & "\Bau.ini")
[/autoit] [autoit][/autoit] [autoit]#Region ### START Koda GUI section ###
$hGui1=GUICreate("The Destroyed City",1500,900, 0, 0)
GUISetIcon("Images\Icon\1.ico")
GUISetBkColor(0xFFFFFF)
$bg1=GUICtrlCreatePic("C:\Programme\The Destroyed City\images\Spielfeld\header.jpg",0, 0, 1500, 90, BitOR($WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetCursor (-1, 0)
$Group1 = GUICtrlCreateGroup("Spiel:", 0, 90, 1250, 800)
$bg2=GUICtrlCreatePic(@ScriptDir & "\images\Spielfeld\Spielfeld.jpg",6, 103, 1238, 780)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Group2",1250, 90, 175, 800, -1, $WS_EX_TRANSPARENT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Tab1 = GUICtrlCreateTab(1250, 110, 172, 500)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Baummenü")
$BauHaus = GUICtrlCreateButton("(Not allowed)",1255, 130, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Haus.bmp", 0)
GUICtrlSetTip(-1, "Haus: | 10xHolz | 10xLehm | 5xEisen | 5xNahrung | 2xWerkzeuge | ")
$BauHolzfaller = GUICtrlCreateButton("(Not allowed)",1310, 130, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Holzfaller.bmp", 0)
GUICtrlSetTip(-1, "Holzfäller:40xHolz | 100xLehm | 50xEisen | 60xNahrung | 5xWerkzeuge | 2xBewohner ")
$BauErzmine = GUICtrlCreateButton("(Not allowed)", 1365, 130,50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Erzmine.bmp", 0)
GUICtrlSetTip(-1, "Erzmine: 100xHolz | 80xLehm | 30xEisen | 40xNahrung | 15xWerkzeuge | 3xBewohner | ")
$BauWeberei = GUICtrlCreateButton("(Not allowed)",1255, 180, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Webstube.bmp", 0)
GUICtrlSetTip(-1, "Webstube: 700xHolz | 360xLehm | 280xEisen | 100xNahrung | 45xWerkzeuge | 15xBewohner |")
$BauGetreidefarm = GUICtrlCreateButton("(Not allowed)", 1310, 380, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Getreidefarm.bmp", 0)
GUICtrlSetTip(-1, "Getreidefam: 70xHolz | 90xLehm | 70xEisen | 25xNahrung | 10xWerkzeuge | 6xBewohner |")
$BauMuhle = GUICtrlCreateButton("(Not allowed)", 1310, 180, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Mühle.bmp", 0)
GUICtrlSetTip(-1, "Mühle: 500xHolz | 440xLehm | 380xEisen | 500xNahrung | 15xWerkzeuge | 10xBewohner |")
$BauSpeicher = GUICtrlCreateButton("(Not allowed)", 1365, 180, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Speicher.bmp", 0)
GUICtrlSetTip(-1, "Speicher: 130xHolz | 160xLehm | 90xEisen | 40xNahrung | 5xWerkzeuge | 2xBewohner |")
$BauScharffarm = GUICtrlCreateButton("(Not allowed)", 1255, 230, 50,50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Scharffarm.bmp", 0)
GUICtrlSetTip(-1, "Scharffarm: 100xHolz | 180xLehm | 140xEisen | 50xNahrung | 25xWerkzeuge | 10xBewohner |")
$BauSchmiede = GUICtrlCreateButton("(Not allowed)", 1310, 230, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Schmied.bmp", 0)
GUICtrlSetTip(-1, "Schmiede: 200xHolz | 450xLehm | 510xEisen | 120xNahrung | 25xWerkzeuge | 10xBewohner | ")
$BauSteinbruch = GUICtrlCreateButton("(Not allowed)", 1365, 230, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "", 0)
GUICtrlSetTip(-1, "Steinbruch")
$BauSteinmetz = GUICtrlCreateButton("(Not allowed)", 1255, 280, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "", 0)
GUICtrlSetTip(-1, "Steinmetz")
$BauGoldmine = GUICtrlCreateButton("(Not allowed)", 1310, 280, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "", 0)
GUICtrlSetTip(-1, "Goldmine")
$BauGoldschmiede = GUICtrlCreateButton("(Not allowed)", 1365, 280, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Goldschmied.bmp", 0)
GUICtrlSetTip(-1, "Goldschmiede: 30.000xHolz | 25.000xLehm | 20.000xEisen | 15.000xNahrung | 10.000xWerkzeuge | 5.000xBewohner | 2.500xWolle | 2.000x Stoffe|")
$BauMamormine = GUICtrlCreateButton("(Not allowed)", 1255, 330, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "", 0)
GUICtrlSetTip(-1, "Mamormine")
$BauMamormetz = GUICtrlCreateButton("(Not allowed)", 1310, 330, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "", 0)
GUICtrlSetTip(-1, "Mamorwetz")
$BauBackerei = GUICtrlCreateButton("(Not allowed)", 1365, 330, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Bäckerei.bmp", 0)
GUICtrlSetTip(-1, "Bäcker: 1000xHolz | 880xLehm | 760xEisen | 1000xNahrung | 30xWerkzeuge | 20xBewohner |")
$Bauelehmgrube = GUICtrlCreateButton("(Not allowed)", 1255, 380, 50, 50, $BS_BITMAP)
GUICtrlSetImage(-1, @ScriptDir & "\Images\Welt 1\Button\Lehmgrube.bmp", 0)
GUICtrlSetTip(-1, "Lehmgrube: 80xHolz | 40xLehm | 80xEisen | 50xNahrung | 10xWerkzeuge | 4xBewohner | ")
$TabSheet2 = GUICtrlCreateTabItem("Speicher")
$Holz = GUICtrlCreateLabel("Holz", 1255, 150, 33, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$HolzAnzahl = GUICtrlCreateLabel("20", 1310, 150, 20, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$Eisen = GUICtrlCreateLabel("Eisen", 1255, 180, 41, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$EisenAnzahl = GUICtrlCreateLabel("20", 1310, 180, 20, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$NahrungAnzahl = GUICtrlCreateLabel("20", 1310, 210, 20, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1,0xffffff)
$Nahrung = GUICtrlCreateLabel("Nahrung", 1255, 210, 33, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetTip(-1, "Dein Nahrungslager")
$WerkzeugAnzahl = GUICtrlCreateLabel("20", 1310, 240, 75, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$Werkzeug = GUICtrlCreateLabel("Werkzeuge", 1255, 240, 33, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetTip(-1, "Dein Nahrungslager")
$Kohle = GUICtrlCreateLabel("Kohle", 1255, 270, 41, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$KohleAnzahl = GUICtrlCreateLabel("20", 1310, 270, 20, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$Lehm = GUICtrlCreateLabel("Lehm", 1255, 300, 41, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$LehmAnzahl = GUICtrlCreateLabel("20",1310, 300, 20, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$Stein = GUICtrlCreateLabel("Stein", 1255, 330, 37, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetTip(-1, "Dein Nahrungslager")
$SteinAnzahl = GUICtrlCreateLabel("20", 1310, 330, 20, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$Getreide = GUICtrlCreateLabel("Getreide", 1255, 360, 30, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetTip(-1, "Dein Nahrungslager")
$GetreideAnzahl = GUICtrlCreateLabel("20", 1310, 360, 20, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$StatusHolz = GUICtrlCreateProgress(1340, 150, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$StatusEisen = GUICtrlCreateProgress(1340, 180, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$StatusNahrung = GUICtrlCreateProgress(1340, 210, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$StatusLehm = GUICtrlCreateProgress(1340, 300, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$StatusStein = GUICtrlCreateProgress(1340, 330, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$StatusGetreide = GUICtrlCreateProgress(1340, 360, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$Gold = GUICtrlCreateLabel("Gold", 1255, 390, 34, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$GoldAnzahl = GUICtrlCreateLabel("0", 1310, 390, 12, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$Mamor = GUICtrlCreateLabel("Mamor", 1255, 420, 49, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$MamorAnzahl = GUICtrlCreateLabel("0", 1310, 420, 12, 21)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$StatusWerkzeug = GUICtrlCreateProgress(1340, 240, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$StatusKohle = GUICtrlCreateProgress(1340, 270, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$StatusGold = GUICtrlCreateProgress(1340, 390, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,0)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$StatusMamor = GUICtrlCreateProgress(1340, 420, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,0)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$TabSheet3 = GUICtrlCreateTabItem("Bewohner")
$Burger = GUICtrlCreateLabel("Bürger", 1255, 150, 42, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$BurgerPF = GUICtrlCreateLabel("Platz für", 1255, 180, 52, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
$BurgerAnzahl = GUICtrlCreateLabel("0", 1310, 150, 11, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetTip(-1, "2")
$BurgerPFAnzahl = GUICtrlCreateLabel("0", 1310, 180, 11, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetTip(-1, "2")
$BurgerStatus = GUICtrlCreateProgress(1340, 150, 70, 17, $PBS_SMOOTH)
GUICtrlSetData (-1,100)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$TabSheet4 = GUICtrlCreateTabItem("Welt")
$Welt1 = GUICtrlCreateButton("Welt 1", 1255, 150, 75, 25, 0)
$Welt2 = GUICtrlCreateButton("Welt 2", 1340, 150, 75, 25, 0)
$Welt3 = GUICtrlCreateButton("Welt 3", 1255, 200, 75, 25, 0)
$TabSheet5 = GUICtrlCreateTabItem("Spiel")
$Laden = GUICtrlCreateButton("Laden", 1255, 150, 75, 25, 0)
$Speichern = GUICtrlCreateButton("Speichern", 1340, 150, 75, 25, 0)
$VollBild = GUICtrlCreateButton("Vollbildschirm", 1255, 627, 75, 25, 0)
GUICtrlCreateTabItem("")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Dim $array[1][4]
Dim $bg2[12380]
Global $file
$Frei = 1
$Welt = 1
$Stunde = False
$ToolTip = False
$Sec = False
$SpeicherPfad = False
$Min = False
$Bewohner = 0
$BewohnerMax = 0
$HolzAbbau = 0
$Hauser = 0
$BewohnerZahl = 0
$HolzRead = GUICtrlRead($HolzAnzahl)
$BewohnerRead = GUICtrlRead($BurgerAnzahl)
$Speicher = 30
$cordx = -25
$cordy = -25
$Bau1Zahl = 0
$Bau2Zahl = 0
$Bau1Zahl1 = 0
$Bau2Zahl1 = 0
$WeltZahl = 0
Dim $Bau1[10000]
Dim $Bau2[10000]
$Zahl = 0
$Welt = 1
$cordx = -25
$cordy = -25
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $BauHaus
_Bau("Haus")
Case $Speichern
Call("_speichern")
Case $Laden
Call("_laden")
;Case $VollBild
;GuiSetState(@SW_MAXIMIZE,$hGui1)
EndSwitch
WEnd
Func _Bau($BauArt)
$A = GUICtrlCreatePic(@ScriptDir & "\Images\Welt 1" & $Welt & "\" & $BauArt & ".jpg", $cordx, $cordy, 50, 50)
GUICtrlSetCursor($A, 0)
$WinPos = WinGetPos("The destroyed city")
While 1
_MouseTrap($WinPos[0] + 37, $WinPos[1] + 72, $WinPos[0] + $WinPos[2] - 43, $WinPos[1] + $WinPos[3] - 218)
$Maus = GUIGetCursorInfo()
$x2 = $Maus[0]
$x = $cordx + $x2
$y2 = $Maus[1]
$y = $cordy + $y2
GUICtrlSetPos($A, $x, $y, 50, 50)
$xm = $Maus[0]
$ym = $Maus[1]
$nMsg1 = GUIGetMsg()
Switch $nMsg1
Case $bg2
GUICtrlDelete ($A)
$bild = @ScriptDir & "\Images\Welt 1" & $Welt & "\" & $BauArt & ".jpg"
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($bild)
$breite_bild = _GDIPlus_ImageGetWidth($hImage)
$hoehe_bild = _GDIPlus_ImageGetHeight($hImage)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
$WinPos = WinGetPos("The destroyed city")
_MouseTrap($WinPos[0], $WinPos[1], $WinPos[0] + $WinPos[2], $WinPos[1] + $WinPos[3])
$Pos = GUIGetCursorInfo()
$aktuell_x_links = $Pos[0]
$aktuell_y_oben = $Pos[1]
$aktuell_x_rechts = $Pos[0] + $breite_bild
$aktuell_y_unten = $Pos[1] + $hoehe_bild
For $i = 1 To UBound($array) - 1
$kollion = 0
$archiv_x_links = $array[$i][0]
$archiv_y_oben = $array[$i][1]
$archiv_x_rechts = $array[$i][0] + $array[$i][2]
$archiv_y_unten = $array[$i][1] + $array[$i][3]
If $aktuell_x_links > $archiv_x_links And $aktuell_x_links < $archiv_x_rechts Then $kollion += 1
If $aktuell_y_oben > $archiv_y_oben And $aktuell_y_oben < $archiv_y_unten Then $kollion += 1
If $aktuell_x_rechts > $archiv_x_links And $aktuell_x_rechts < $archiv_x_rechts Then $kollion += 1
If $aktuell_y_unten > $archiv_y_oben And $aktuell_y_unten < $archiv_y_unten Then $kollion += 1
ConsoleWrite($kollion & @CRLF)
If $kollion = 2 Then
ToolTip ("Dort ist bereits etwas Gebaut!")
Return
EndIf
Next
_Array2DAdd($array, $Pos[0] & "|" & $Pos[1] & "|" & $breite_bild & "|" & $hoehe_bild)
GUISetState (@SW_LOCK)
$bg2[$Zahl] = GUICtrlCreatePic($bild, $Pos[0]-25, $Pos[1]-25, $breite_bild, $hoehe_bild)
GUISetState (@SW_UNLOCK)
$Zahl += 1
_MouseTrap ()
ExitLoop
EndSwitch
WEnd
EndFunc ;==>_Bau
Func _speichern()
FileDelete($file)
If $SpeicherPfad = False Then
$file = FileSaveDialog("Spielstand speichern:", @ScriptDir & "\saves", "Spielstand (*.sav)", 2 + 16, "The destroyed city.sav")
$SpeicherPfad = $file
Else
$file = $SpeicherPfad
EndIf
If @error = 1 Then
Sleep(0)
Else
FileDelete($file)
$HolzRead = GUICtrlRead($RohstoffeHolzAnzahl)
$EisenRead = GUICtrlRead($RohstoffeEisenAnzahl)
$NahrungRead = GUICtrlRead($RohstoffeNahrungAnzahl)
$WerkzeugRead = GUICtrlRead($RohstoffeWerkzeugAnzahl)
$BewohnerRead = GUICtrlRead($BefoelkerungBuergerAnzahl)
$fileRead = FileRead(@ScriptDir & "\Bau.ini")
FileWrite($file, $fileRead)
IniWrite($file, "Rohstoffe", "Holz", $HolzRead)
IniWrite($file, "Rohstoffe", "Eisen", $EisenRead)
IniWrite($file, "Rohstoffe", "Nahrung", $NahrungRead)
IniWrite($file, "Rohstoffe", "Werkzeug", $WerkzeugRead)
IniWrite($file, "Bewohner", "Bürger", $BewohnerRead)
$Formel = $HolzRead + $EisenRead + $NahrungRead + $WerkzeugRead + $BewohnerRead * 100
$FormelHex = Hex($Formel)
IniWrite($file, "Daten", "Rechnung", $FormelHex)
ToolTip("Spiel Gespeichert")
$ToolTip = True
EndIf
EndFunc ;==>_speichern
Func _laden()
$Welt = 1
$file = FileOpenDialog("Spielstand laden:", @ScriptDir & "\saves", "Spielstand (*.sav)", 1 + 2, "The destroyed city.sav")
If @error = 1 Then
Sleep(0)
Else
$Hauser = 0
$LadenZahl = 0
$SpeicherPfad = $file
$LadenHolz = IniRead($file, "Rohstoffe", "Holz", "")
$LadenEisen = IniRead($file, "Rohstoffe", "Eisen", "")
$LadenNahrung = IniRead($file, "Rohstoffe", "Nahrung", "")
$LadenWerkzeug = IniRead($file, "Rohstoffe", "Werkzeug", "")
$LadenBewohner = IniRead($file, "Bewohner", "Bürger", "")
$LadenFormel = IniRead($file, "Daten", "Rechnung", "")
$LadenFormeDec = Dec($LadenFormel)
$Formel1 = $LadenHolz + $LadenEisen + $LadenNahrung + $LadenWerkzeug + $LadenBewohner * 100
If $Formel1 = $LadenFormeDec Then
GUISetState(@SW_LOCK)
$LadenZahlMax = IniRead($file, "Bau1", "ZahlHaus", "0")
If $LadenZahlMax > 0 Then
Do
$Hauser = $Hauser + 1
$BewohnerMax = $BewohnerMax + 5
$LadenZahl = $LadenZahl + 1
$LadenBau = IniRead($file, "Bau1", "Haus" & $LadenZahl, "0")
$LadenZahl = $LadenZahl + 1
$LadenBau2 = IniRead($file, "Bau1", "Haus" & $LadenZahl, "0")
$Bau1[$Bau1Zahl1] = GUICtrlCreatePic(@ScriptDir & "\Images\Welt 1\" & $Welt & "\Haus.jpg", $LadenBau, $LadenBau2, 50, 50)
$Bau1Zahl1 = $Bau1Zahl1 + 1
Until $LadenZahl = $LadenZahlMax
EndIf
$LadenZahlMax = IniRead($file, "Bau2", "ZahlHaus", "0")
$LadenZahl = 0
If $LadenZahlMax > 0 Then
Do
$Hauser = $Hauser + 1
$BewohnerMax = $BewohnerMax + 5
$LadenBau = IniRead($file, "Bau2", "Haus" & $LadenZahl, "0")
$LadenZahl = $LadenZahl + 1
$LadenBau2 = IniRead($file, "Bau2", "Haus" & $LadenZahl, "0")
$Bau2[$Bau2Zahl1] = GUICtrlCreatePic(@ScriptDir & "\Haus.jpg", $LadenBau, $LadenBau2, 50, 50)
GUICtrlSetState(-1, $GUI_HIDE)
$Bau2Zahl1 = $Bau2Zahl1 + 1
Until $LadenZahl = $LadenZahlMax
EndIf
$LadenZahl = 0
$LadenZahlMax = IniRead($file, "Bau1", "ZahlSägewerk", "0")
If $LadenZahlMax > 0 Then
Do
$HolzAbbau = $HolzAbbau + 1
$LadenZahl = $LadenZahl + 1
$LadenBau = IniRead($file, "Bau1", "Sägewerk" & $LadenZahl, "0")
$LadenZahl = $LadenZahl + 1
$LadenBau2 = IniRead($file, "Bau1", "Sägewerk" & $LadenZahl, "0")
GUICtrlCreatePic(@ScriptDir & "\Sägewerk.jpg", $LadenBau, $LadenBau2, 50, 50)
Until $LadenZahl = $LadenZahlMax
EndIf
$LadenZahlMax = IniRead($file, "Bau2", "ZahlSägewerk", "0")
$LadenZahl = 0
If $LadenZahlMax > 0 Then
Do
$Hauser = $Hauser + 1
$BewohnerMax = $BewohnerMax + 5
$LadenZahl = $LadenZahl + 1
$LadenBau = IniRead($file, "Bau2", "Sägewerk" & $LadenZahl, "0")
$LadenZahl = $LadenZahl + 1
$LadenBau2 = IniRead($file, "Bau2", "Sägewerk" & $LadenZahl, "0")
$Bau2[$Bau2Zahl1] = GUICtrlCreatePic(@ScriptDir & "\Sägewerk.jpg", $LadenBau, $LadenBau2, 50, 50)
GUICtrlSetState(-1, $GUI_HIDE)
$Bau2Zahl1 = $Bau2Zahl1 + 1
Until $LadenZahl = $LadenZahlMax
EndIf
GUISetState(@SW_UNLOCK)
GUICtrlSetData($BefoelkerungPFAnzahl, $BewohnerMax)
GUICtrlSetData($RohstoffeHolzAnzahl, $LadenHolz)
GUICtrlSetData($RohstoffeEisenAnzahl, $LadenEisen)
GUICtrlSetData($RohstoffeNahrungAnzahl, $LadenNahrung)
GUICtrlSetData($RohstoffeWerkzeugAnzahl, $LadenWerkzeug)
GUICtrlSetData($BefoelkerungBuergerAnzahl, $LadenBewohner)
Else
MsgBox(16, "Error", "Spielstand kann nicht geladen werden")
EndIf
EndIf
EndFunc ;==>_laden