Qbasicnews.com

Full Version: dynamic integers?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is there any way to redim part of an integer array in qb or vbdos?

If I had array1(100,10), for instance, and I wanted to have different sizes for each of the 100 parts of the first dimension, could I do that?

I'll probably have to figure out a way to do it without dynamic array like that, though. :|
well, if you're using qb 7.1, you can put arrays in type structures, like so:

type bob
joe(10) as integer
bill(5) as integer
end type

dim bob(100) as bob

but this wont work in qb4.5
yes but... how does that make 'em dynamic?

Well anyways I made a max of 8 so problem solved.
i dont know, but you said you wanted them to have different lengths...

i think the only way to do this is string arrays, but if this is files, windows does have a 255 character cap, so you could always stop there.
but strings are slow. =|
yeah, but how fast must you retrieve and handle 100 strings? that oughta fly on a 486 unless you're doing some sort of crazy string manipulation or something, which i'm willing to bet you arent by the filename references.
for the pathfinding of the RTS me and pr0gger are making.

The max would be (x.max^2+y.max^2)^.5 which comes out with a lot of empties.

3 ideas I came up with:

1) use a limited amount of integers for each tank and keep remaking the path (up to a certain point) when the tank goes through those integers. (slow)
2) use path strings for each tank. (slow)
3) put all the movement into a large integer queue with a reference to both the unit and where it should go. (fast but... hmm...)

EDIT:
4) then again, 200k memory for a 160x120 map, 1000 units doesn't seem so bad... but the array size is too big. :|