aqualectrix
Member
So: on a wild guess I tried using typedef in ash, and lo and behold! typedefs exist.
However, I am having a little trouble working with them according to my C/C++ typedef background knowledge. I'm not sure if this is a Mafia bug or just my lack of understanding as to how they work in Mafia, so I figured I'd ask around for insights rather than filing a bug report.
Simple example:
gives me the error message "Internal error: Cannot assign int to foo"
A slightly different assignment:
prints a debug log, which I've attached.
Is there any way to assign a value to a variable of typedef'd type? These seemed reasonable tries, but it's quite possible I'm missing something.
A more complicated example:
gives me the error message "Index for 'baz' has wrong data type (expected foo, got int)"
So even though I can't assign ints to foos, sometimes Mafia thinks that foos are ints anyway. What am I doing wrong here?
If anyone knowledgeable about ash typedefs could help me out, that would be awesome.
However, I am having a little trouble working with them according to my C/C++ typedef background knowledge. I'm not sure if this is a Mafia bug or just my lack of understanding as to how they work in Mafia, so I figured I'd ask around for insights rather than filing a bug report.
Simple example:
Code:
typedef int foo;
foo x = 0;
A slightly different assignment:
Code:
typedef int foo;
foo x;
x = 0;
Is there any way to assign a value to a variable of typedef'd type? These seemed reasonable tries, but it's quite possible I'm missing something.
A more complicated example:
Code:
typedef int foo;
record bar
{ foo member; };
bar b;
string [foo] baz;
baz[b.member] = "blah";
So even though I can't assign ints to foos, sometimes Mafia thinks that foos are ints anyway. What am I doing wrong here?
If anyone knowledgeable about ash typedefs could help me out, that would be awesome.
Attachments
Last edited: