|
|
#1246 | |
|
master of fugue
Join Date: Jun 2007
Posts: 2,558
![]() ![]() ![]() ![]()
|
Quote:
|
|
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#1247 |
|
Free Software Terrorist
Technical Director
|
I've been using the VM to code jasshelper for a long time, but I've been feeling unmotivated to do that stuff, maybe after the hero contest.
__________________ |
|
|
|
|
|
#1248 |
|
User
Join Date: Nov 2006
Posts: 36
|
I might have an idea that might optimize the jass code a lot, and shouldn't be a lot of work.
JASS:function example takes real x y facing, unit u returns nothing JASS:function example takes real x, real y, real facing, unit u returns nothing As in many languages you don't have to re-declare the type of variable, but separate it with a comma. However due to free type declaration it should be easier to detect when a comma isn't used. |
|
|
|
|
|
#1250 |
|
Free Software Terrorist
Technical Director
|
Just like you'd make an array of any other type.
__________________ JASS:globals mystruct array A endglobals |
|
|
|
|
|
#1251 |
|
Zerzy
|
This might be a bug in the compiler: I declared an array within a struct with a limit of 3, and use indices 1, 2, and 3 in the script. I get a syntax error claiming that 3 is an array index out of bounds, while I can use a loop and never directly reference index 3 and JassHelper has no problems with that.
__________________ |
|
|
|
|
|
#1252 |
|
Free Software Terrorist
Technical Director
|
Size 3: Use indexes 0,1,2
__________________Programming is often 0-based. |
|
|
|
|
|
#1253 |
|
Zerzy
|
I forgot to mention that this array is of another struct type. I was under the impression that I should avoid using index 0 in struct arrays because I've had MUI and double free issues when doing so. Doesn't mean I'm right, but...
__________________EDIT: Does this mean I've been going out of array bounds when using the "limiting" index of an array (3 for example, in a loop)? Last edited by Zerzax : 12-31-2008 at 07:40 PM. |
|
|
|
|
|
#1254 | ||
|
Lackadaisically Absent.
Respected User
|
Quote:
JASS:globals keyword MyStruct MyStruct array MyStructs endglobals struct MyStruct integer Blah endstruct Quote:
JASS:struct Blah integer array Stuff[3] endstruct function Garrr takes nothing returns nothing local Blah B = Blah.create() local integer J = 0 loop set J = J+1 exitwhen J > 3 set Blah.Stuff[J] = GetRandomInt(0, 10) endloop endfunction |
||
|
|
|
|
|
#1255 |
|
Zerzy
|
Good thing I raised the point, that would hurt my Hero Contest judging if I ever got there.
__________________I was doing this: JASS:struct flaremissile endstruct struct caster flaremissile array castMissiles[3] method Garrrr takes nothing returns nothing local integer i = 1 local flaremissile f loop exitwhen i > 3 set f = this.castmissiles[i] // actions... set i = i + 1 endloop endmethod endstruct I wasn't really being specific enough when I said struct arrays. I believe when you use the 0 index in this case, it is exactly as you described Pyro (never used as a struct instance). Last edited by Zerzax : 12-31-2008 at 09:41 PM. |
|
|
|
|
|
#1256 | ||
|
Free Software Terrorist
Technical Director
|
Quote:
Quote:
|
||
|
|
|
|
|
#1257 |
|
Zerzy
|
I'll start using indices 0 to Limit - 1 instead now. Thanks to both of you :D.
__________________ |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |