|
Re: GSVector
[Re: pegamode]
#261409
04/17/09 13:53
04/17/09 13:53
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
I'd try to work with static.... and i offer you to make new version of your dll(probably you wouldnt use it, as you use your version many times in your projects, but it may be more friendly for users): 1a) with the help of inline int _INT(var x) { return x>>10; } convert second parameter to var, so we'd be able easily to get ascess to any element of vector in loop without any troubles 1b) as variant, add new function getFromGSVectorElement, for example(just cant find better name), that would work like 1a) 2) add function insertIntoGSVectorUnique that will check, if the same element is already exist in vector
|
|
|
Re: GSVector
[Re: pegamode]
#261423
04/17/09 14:42
04/17/09 14:42
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
But where are you store all structures? Okay, thats individual So, what about second version of your dll? (i'm afraid to ask sources )
|
|
|
Re: GSVector
[Re: pegamode]
#261426
04/17/09 14:47
04/17/09 14:47
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
well, at least
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <GSVector.h>
///////////////////////////////
function main()
{
level_load("");
wait(2);
var testVec = createGSVector();
insertIntoGSVector(testVec,1);
insertIntoGSVector(testVec,2);
insertIntoGSVector(testVec,3);
insertIntoGSVector(testVec,4);
int* pos = 0;
var check = getFromGSVector(testVec, pos);
diag("GSVectorCheck: ");
diag(str_for_num(NULL, check));
}
this works
|
|
|
Re: GSVector
[Re: VeT]
#261435
04/17/09 15:03
04/17/09 15:03
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
looking like you write in Legasy mode
for(i=0; i<sizeOfGSVector(scheduler); i++) {
scheduleTask = (SCHEDULETASK*)(getFromGSVector(scheduler,i));
this crashes in any case i tried &pos = testpos; but this crashes, as it may be, but... how do you use for-loop to get elements?
|
|
|
Re: GSVector
[Re: KDuke]
#261437
04/17/09 15:15
04/17/09 15:15
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
Serious User
|
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
2KDuke i dont know, how you comiled your code
int* pos = 0;
pos += 1; // or pos ++; or pos = pos + 1;
crash to me... only variant is to use but
pos = num; // or &pos = num; or even pos = #(i'm going crazy :)))
dont work you want to say that i may use
int* firstpos = 0;
int* secondpos = 1;
int* thirdpos = 2;
***
pos = firstpos; // this works
?
|
|
|
|