I'm not 100% positive those will work, and I don't currently have access to a compiler so I can't check. But I think the second one would probably work, it is the C-style method for initializing arrays. The only difference would be that the memory isn't dynamically allocated. But, since you presumably don't intend to ever delete that array (and it's pretty tiny) it shouldn't make a difference.
So with the 1.5 patch beta presumably starting soon, I was wondering if you have any idea how long it will take to incorporate the API changes into Galaxy + + ? Too soon to tell?
Just because I recently had difficulty with this, I want expand on that. The above statement only declares the initial array of 42 Foo pointers that don't point to anything (technically I think they are all pointing to the same object, but not important). To actually use the array, you'd have to go through and declare each one in something like:
Thanks, you were right. I was thinking in terms of C arrays where you would declare an array of objects all in one statement, instead of first declaring the array of pointers, then instantiating new objects for each pointer. I was thinking the second declaration was implicit, not in terms of "pointer to a pointer".
As a suggestion for a feature, did you consider allowing a conversion from int to fixed, possibly with a warning? I understand you obviously would lose precision, but my experience is largely with C where I have learned not to care. Galaxy provides a function for this already:
intTruncI(fixedx)
Or, you could just make me do the type conversion explicitly. :)
Edit:
Also, I just found a small bug. I was trying to create an infinite loop by using for(;;), which does appear to be valid in straight Galaxy. This crashes the compilation job. I sent a report via the in-editor tool.
I'm not sure why that worked for you, but not for me. I tested mine inside of a much larger beast, but this was early enough in execution that it shouldn't have mattered. I wish I could test it more, but unfortunately my work laptop is picky about running the editor.
Attached is a copy of part of my map code. I believe it is enough. I had to make some adjustments for clarity without the benefit of a compiler to double-check me, but I think it will compile fine.
Did not know the compiler would handle the string to text conversion on its own, that's cool!
Also, I would like to mention a small bug that I found the other day. If I do something like:
The code coloration will not catch the last */ . It will list the entire rest of my code as comments. It still compiles (parses?) correctly, it is just the color that's off.
First off, let me say, great project! You are awesome!
About a year ago I started a map project using Andromeda. I recently returned to working on it, and Andromeda is no longer updated, where your language has grown significantly. As such, I decided to switch my development over to gpp . I'm still trying to get the hang of your language.
I'm having a problem using arrays of objects. I'm not sure how to create a multidimensional array of objects that works reliably, and I am getting bizarre behavior if I try to create an array of pointers. My testing so far makes me think it is the same for structs and classes. Here is my data declaration:
At first, I had tried to do the HeroData declaration as HeroData*[], an array of pointers to a the HeroData struct. However, it seems whenever I do that, all entries in the array point to the same object. The following shows the error:
Am I just using arrays of pointers wrong? The problem did go away for the structs when I declared it as a straight array instead of an array of pointers, but I suspect it is still present in UnitList*[][]. Since that one is a pointer to a class, I am required to declare it as a pointer or else it gives me the "classes must be dynamic" error.
Let me know if I wasn't clear enough about anything, or if you'd like to see some map code.
Edit: Apparently using the plusplus operator makes my text appear green? Well that's weird!
@elunder: Go
I would try it like this:
string[] names = new string {"Zeratul", "Tychus", "Rory", "Nova", "Tassadar", "Egon"};
or
string[] names = {"Zeratul", "Tychus", "Rory", "Nova", "Tassadar", "Egon"};
I'm not 100% positive those will work, and I don't currently have access to a compiler so I can't check. But I think the second one would probably work, it is the C-style method for initializing arrays. The only difference would be that the memory isn't dynamically allocated. But, since you presumably don't intend to ever delete that array (and it's pretty tiny) it shouldn't make a difference.
So with the 1.5 patch beta presumably starting soon, I was wondering if you have any idea how long it will take to incorporate the API changes into Galaxy + + ? Too soon to tell?
Just because I recently had difficulty with this, I want expand on that. The above statement only declares the initial array of 42 Foo pointers that don't point to anything (technically I think they are all pointing to the same object, but not important). To actually use the array, you'd have to go through and declare each one in something like:
This only applies to arrays of pointers.
I didn't realize gpp supported casting. That works perfectly!
Thanks, you were right. I was thinking in terms of C arrays where you would declare an array of objects all in one statement, instead of first declaring the array of pointers, then instantiating new objects for each pointer. I was thinking the second declaration was implicit, not in terms of "pointer to a pointer".
As a suggestion for a feature, did you consider allowing a conversion from int to fixed, possibly with a warning? I understand you obviously would lose precision, but my experience is largely with C where I have learned not to care. Galaxy provides a function for this already:
Or, you could just make me do the type conversion explicitly. :)
Edit:
Also, I just found a small bug. I was trying to create an infinite loop by using for(;;), which does appear to be valid in straight Galaxy. This crashes the compilation job. I sent a report via the in-editor tool.
I'm not sure why that worked for you, but not for me. I tested mine inside of a much larger beast, but this was early enough in execution that it shouldn't have mattered. I wish I could test it more, but unfortunately my work laptop is picky about running the editor.
Attached is a copy of part of my map code. I believe it is enough. I had to make some adjustments for clarity without the benefit of a compiler to double-check me, but I think it will compile fine.
Did not know the compiler would handle the string to text conversion on its own, that's cool!
Also, I would like to mention a small bug that I found the other day. If I do something like:
The code coloration will not catch the last */ . It will list the entire rest of my code as comments. It still compiles (parses?) correctly, it is just the color that's off.
First off, let me say, great project! You are awesome!
About a year ago I started a map project using Andromeda. I recently returned to working on it, and Andromeda is no longer updated, where your language has grown significantly. As such, I decided to switch my development over to gpp . I'm still trying to get the hang of your language.
I'm having a problem using arrays of objects. I'm not sure how to create a multidimensional array of objects that works reliably, and I am getting bizarre behavior if I try to create an array of pointers. My testing so far makes me think it is the same for structs and classes. Here is my data declaration:
HeroData, BaseData, PlayerData - structs UnitList - object
At first, I had tried to do the HeroData declaration as HeroData*[], an array of pointers to a the HeroData struct. However, it seems whenever I do that, all entries in the array point to the same object. The following shows the error:
Am I just using arrays of pointers wrong? The problem did go away for the structs when I declared it as a straight array instead of an array of pointers, but I suspect it is still present in UnitList*[][]. Since that one is a pointer to a class, I am required to declare it as a pointer or else it gives me the "classes must be dynamic" error.
Let me know if I wasn't clear enough about anything, or if you'd like to see some map code.
Edit: Apparently using the plusplus operator makes my text appear green? Well that's weird!