Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dynamic integers?
#1
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. :|
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#2
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
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#3
yes but... how does that make 'em dynamic?

Well anyways I made a max of 8 so problem solved.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#4
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.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#5
but strings are slow. =|
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#6
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.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#7
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. :|
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)