Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 4 of 6 1 2 3 4 5 6
Re: GSVector [Re: KDuke] #261385
04/17/09 11:04
04/17/09 11:04
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi VeT,

No, I don't write in a file ... I just read from a file.
If the state is changed it is set in the struct object.

I only write a file when during game save.

---------

The source of "getFromGSVector" isn't that special:

DLLFUNC var getFromGSVector(container &cont, int pos)
{
return cont.at(pos);
}

I'd never had any problem using the vector.
Maybe you have to check your pointers ... you have to be sure that the address is still correct when you use it with the vector.
A non-static variable gets a new address with every wait. Maybe you have to check this. Don't know.

Regards,
Pegamode.

Re: GSVector [Re: pegamode] #261409
04/17/09 13:53
04/17/09 13:53
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

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 smile

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


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: GSVector [Re: VeT] #261413
04/17/09 14:02
04/17/09 14:02
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
//No, I don't write in a file ... I just read from a file.If the state is changed it is set in the struct object.

But... if you have 100 records and 100 doors, how are you telling the doors their states?
Imho, you need OR load state of the door in every action of door (read all file and search needed state), OR store all records in operative memory, and spread doors/states from here


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: GSVector [Re: KDuke] #261417
04/17/09 14:20
04/17/09 14:20
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
okay, i make
static byte* pnum = 0;
***
pnum++;

and debug shows me, that pnum = 0.001


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: GSVector [Re: VeT] #261419
04/17/09 14:33
04/17/09 14:33
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi VeT,

all struct objects are in memory (build on game startup by reading the file).
All useable objects have an action that get it's correspondenting struct object and sets its own pointer. So I can access the entity when I have the struct object and I can also access the struct object when I have the entity.

Re: GSVector [Re: pegamode] #261423
04/17/09 14:42
04/17/09 14:42
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
But where are you store all structures?
Okay, thats individual smile

So, what about second version of your dll?
(i'm afraid to ask sources laugh )


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: GSVector [Re: pegamode] #261426
04/17/09 14:47
04/17/09 14:47
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
well, at least
Code:
///////////////////////////////
#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 smile


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: GSVector [Re: VeT] #261435
04/17/09 15:03
04/17/09 15:03
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
looking like you write in Legasy mode smile

Code:
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... smile

how do you use for-loop to get elements?


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: GSVector [Re: KDuke] #261437
04/17/09 15:15
04/17/09 15:15
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
2KDuke

i dont know, how you comiled your code smile
Code:
int* pos = 0;
pos += 1; // or pos ++; or pos = pos + 1;

crash to me... only variant is to use
Code:
pos = 2;

but
Code:
pos = num; // or &pos = num; or even pos = &num;(i'm going crazy :))) 

dont work

you want to say that i may use
Code:
int* firstpos = 0;
int* secondpos = 1;
int* thirdpos = 2;

***
pos = firstpos; // this works

? laugh


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: GSVector [Re: VeT] #261507
04/18/09 04:44
04/18/09 04:44
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi VeT,

after 14 hours at work I didn't feel like changing the GSVector.

I think I could build a special version with var parameters instead of int this weekend, but I'm not sure if that helps you to get rid of assuring that your pointers are valid. But let's give it a try.

Regards,
Pegamode.

Page 4 of 6 1 2 3 4 5 6

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1