Autor Beitrag
Philipp_Reitter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: Do 30.08.07 20:44 
hi

ich hab eine Class :
ausblenden Delphi-Quelltext
1:
TTwLevel   = (tuw1,twu2,twu3,twu4);					


und jetzt kann ich ja mit

ausblenden Delphi-Quelltext
1:
2:
var lvl : TTwLevel;
lvl := TTwLevel(1);


nur will ich jetzt als meine variable lvl um eines erhöhen...
also

ausblenden Delphi-Quelltext
1:
lvl := TTwLevel(1lvl+1);					


nur geht das so ned...
kann mir wer sgen wie ich das machen soll?

mfg
Philipp

PS: sagts mir wenn mein titel mull is...
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19345
Erhaltene Danke: 1753

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 30.08.07 20:50 
Du müsstest das vorher nach Byte casten, dann geht das. Aber gibt es da nicht eine bessere Lösung? :gruebel:
(Mir ist nicht ganz klar, was das bringen soll.)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 30.08.07 20:52 
Moin!

user profile iconPhilipp_Reitter hat folgendes geschrieben:
ich hab eine Class :
ausblenden Delphi-Quelltext
1:
TTwLevel   = (tuw1,twu2,twu3,twu4);					

Das nennt man Aufzählung (oder auch "enumeration", kurz "enum"), das hat nix mit Klassen zu tun! :mahn: :idea:

user profile iconPhilipp_Reitter hat folgendes geschrieben:
und jetzt kann ich ja mit

ausblenden Delphi-Quelltext
1:
2:
var lvl : TTwLevel;
lvl := TTwLevel(1);


nur will ich jetzt als meine variable lvl um eines erhöhen...

Das geht mit Inc(lvl);am einfachsten. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.


Zuletzt bearbeitet von Narses am Do 30.08.07 20:55, insgesamt 2-mal bearbeitet
Philipp_Reitter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: Do 30.08.07 20:53 
also ich will ne prozedure Tower.Upgrade
und da soll er dann einfach den Lvl dens towers um eines erhöhen...
Philipp_Reitter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: Do 30.08.07 20:53 
danke!
Philipp_Reitter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: Do 30.08.07 21:11 
ok nur jetzt noch wie bekomm ich die zahl her also wenn ich das brauche welche stelle das gerade hat...
also inc zähle eines dazu aber ich will eine Zahl herausbekommen....

mfg
Philipp
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Do 30.08.07 21:14 
Müsste Ord(lvl) sein.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 30.08.07 21:24 
Moin!

user profile iconPhilipp_Reitter hat folgendes geschrieben:
ok nur jetzt noch wie bekomm ich die zahl her also wenn ich das brauche welche stelle das gerade hat...
also inc zähle eines dazu aber ich will eine Zahl herausbekommen....

Es geht auch mit Typecasts, z.B. Integer(lvl)

Aber mal was grundsätzliches: wenn du doch den Aufzählungstyp gar nicht verwendest, warum definierst du ihn dann überhaupt... :? :nixweiss:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Philipp_Reitter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 430



BeitragVerfasst: Do 30.08.07 21:28 
thx!