Qbasicnews.com
September 20, 2021, 02:25:14 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: dynamic integers?  (Read 3090 times)
Agamemnus
x/ \z
*****
Posts: 3491



« on: March 15, 2003, 03:38:06 PM »

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. :|
Logged

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.
toonski84
__/--\__
*****
Posts: 2567



« Reply #1 on: March 15, 2003, 03:55:37 PM »

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
Logged

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
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #2 on: March 15, 2003, 04:52:00 PM »

yes but... how does that make 'em dynamic?

Well anyways I made a max of 8 so problem solved.
Logged

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.
toonski84
__/--\__
*****
Posts: 2567



« Reply #3 on: March 15, 2003, 08:23:17 PM »

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.
Logged

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
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #4 on: March 15, 2003, 09:14:15 PM »

but strings are slow. =|
Logged

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.
toonski84
__/--\__
*****
Posts: 2567



« Reply #5 on: March 16, 2003, 01:24:05 AM »

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.
Logged

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
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #6 on: March 16, 2003, 11:41:46 AM »

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. :|
Logged

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!