Autor Beitrag
Niko S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Fr 17.07.09 09:16 
Ich bin grad auf ein Problem gestoßen.
Unzwar wollte ich von einem anderen Programm die Struktur nach Delphi übernehmen um das Dateiformat kompatibel zu machen.
Allerdings benutzt dieses Format "Type" in einem Record und das geht anscheinend in Delphi nicht.
Weiß jemand was ich da machen kann, außer eine andere Srache wählen? ;x


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Fr 17.07.2009 um 11:05
jfheins
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 918
Erhaltene Danke: 158

Win 10
VS 2013, VS2015
BeitragVerfasst: Fr 17.07.09 09:25 
Zeig mal die Orginal-Deklaration ;)
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Fr 17.07.09 09:33 
Original Code:
ausblenden volle Höhe Quelltext
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:
Type TileRec
    Ground As Long
    Mask As Long
    Anim As Long
    Mask2 As Long
    M2Anim As Long
    Fringe As Long
    FAnim As Long
    Fringe2 As Long
    F2Anim As Long
    Type As Byte
    Data1 As Long
    Data2 As Long
    Data3 As Long
    String1 As String
    String2 As String
    String3 As String
    Light As Long
    GroundSet As Byte
    MaskSet As Byte
    AnimSet As Byte
    Mask2Set As Byte
    M2AnimSet As Byte
    FringeSet As Byte
    FAnimSet As Byte
    Fringe2Set As Byte
    F2AnimSet As Byte
End Type

Type MapRec
    Name As String * 20
    Revision As Integer
    Moral As Byte
    Up As Integer
    Down As Integer
    Left As Integer
    Right As Integer
    music As String
    BootMap As Integer
    BootX As Byte
    BootY As Byte
    Shop As Integer
    Indoors As Byte
    Tile() As TileRec
    NPC(1 To 15) As Integer
    SpawnX(1 To 15) As Byte
    SpawnY(1 To 15) As Byte
    Owner As String
    Scrolling As Byte
    Weather As Integer
End Type


Und das ist mein Versuch in Delphi
ausblenden volle Höhe Delphi-Quelltext
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:
  TTile = record
    Ground : LongInt;
    Mask : LongInt;
    Anim : LongInt;
    Mask2 : LongInt;
    M2Anim : LongInt;
    Fringe : LongInt;
    FAnim : LongInt;
    Fringe2 : LongInt;
    F2Anim : LongInt;
    Type : Byte;   // Type geht nicht..
    Data1 : LongInt;
    Data2 : LongInt;
    Data3 : LongInt;
    String1 : String;
    String2 : String;
    String3 : String;
    Light : LongInt;
    GroundSet : Byte;
    MaskSet : Byte;
    AnimSet : Byte;
    Mask2Set : Byte;
    M2AnimSet : Byte;
    FringeSet : Byte;
    FAnimSet : Byte;
    Fringe2Set : Byte;
    F2AnimSet : Byte;
  end;

  TMap = record
    Name : String[20];
    Revision : Integer;
    Moral : Byte;
    Up : Integer;
    Down : Integer;
    Left : Integer;
    Right : Integer;
    music : String;
    BootMap : Integer;
    BootX : Byte;
    BootY : Byte;
    Shop : Integer;
    Indoors : Byte;
    Tile : array of array of TTile;
    NPC : array[1..15of Integer;
    SpawnX : array[1..15of Byte;
    SpawnY : array[1..15of Byte;
    Owner : String;
    Scrolling : Byte;
    Weather : Integer;
  end;
Krischa
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 118

Windows 7 64 Bit
Delphi 2007
BeitragVerfasst: Fr 17.07.09 09:34 
Type ist von Delphi reserviert und darf nicht als "Variablenname" verwendet werden.
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: Fr 17.07.09 13:38 
user profile iconNiko S. hat folgendes geschrieben Zum zitierten Posting springen:
Und das ist mein Versuch in Delphi

Hallo,

das Wort ist reserviert, aber Namen sind Schall und Rauch, wenn du stattdessen Type1 schreibst (oder was immer dir geeignet erscheint), wird alles funktionieren wie gewünscht.

Wahrscheinlich muss es aber heissen "packed record", damit keine Lücken zwischen den Elementen vorgesehen werden.

Gruss Reinhard

Moderiert von user profile iconNarses: Zitat gekürzt.
oki
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

Win XP
Delphi 2007 Prof
BeitragVerfasst: Fr 17.07.09 15:18 
Nenne das Feld einfach Typ. Auf deine Daten hat das keinen Einfluß, da es ja nur ein Bezeichner ist. Alle anderen Varianten wie Type_ usw. sind natürlich auch möglich. Im Rahmen deines Quellcodes greifst du auf dieses Feld dann natürlich mittels Typ (Type_) zu wo in der anderen Sprache der Bezeichner Type verwendet wird.

Gruß oki

_________________
42
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Fr 17.07.09 15:25 
hm okay dann wäre das schonmal "gelöst", dennoch sind die daten irgendwie nicht ganz richtig die ich auslese aber das steht ja im anderen thread ;x
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Sa 18.07.09 17:58 
Kurze Frage:

ausblenden Quelltext
1:
    Tile() As TileRec					

wurde übersetzt mit
ausblenden Delphi-Quelltext
1:
    Tile : array of array of TTile;					

Ist das nicht ein array of zuviel?

_________________
PROGRAMMER: A device for converting coffee into software.
Niko S. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Sa 18.07.09 18:01 
Nein das ist ein 2 Dimensionales array...
Also im Server wird das mit Map(index).Tile(x, y) angesprochen...