Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Modifying all pointers to a particular Object. #258716
04/01/09 17:58
04/01/09 17:58
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Heres an odd one, and I haven been able to find anything on it,
probably cause I dont really know of a phrase to search on.

My problem is this.
1> An entity gets created, and is (usually) given a global pointer of some sort.
2> Over time, several other global AND non-global pointer end up aimed at it.
3a> I now ent_remove this entity, and set its global pointer to NULL.
3b> OR I now ent_remove this entity using one of the OTHER pointers, and set it to NULL.
4>>> All the other pointers are still pointing to where it was,and so are invalid.

Is there any way for me to programmatically "find" these pointers and set them to NULL too?
(PS I dont want to have to make all these pointers a pointer-to-a-pointer as its too messy)

Im trying to avoid modifying the "other" functions or pointers at all. I really want to code a
function that will hunt down the pointers to the entity and NULL them.

Any ideas anyone?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Modifying all pointers to a particular Object. [Re: EvilSOB] #258723
04/01/09 18:30
04/01/09 18:30
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Hey, other than scanning through all possible global entity pointers and entity parents i haven't found a way yet either

scan all ents and check if entities match, if they do store this pointer,
ENTITY* global_removal_firm;

then keep scanning, if any more that are found to match set them to NULL,
then remove the global_removal; and set to NULL

Hope this helps

Re: Modifying all pointers to a particular Object. [Re: MrGuest] #258727
04/01/09 19:16
04/01/09 19:16
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
The only way I know of "scan"ing all ents is using ent_next and that only gives me a list of actual entities, not any pointers to them.
Or do you mean some other way to scan than ent_next? I hope so.

Getting a list of all pointers to all entities (or even just ALL pointers) is my goal, but for the life of me I cant see a way to do it yet.
Ive tried several attempts to burrow into the engine, but ent_next giving real entity locations is the closest Ive gotten so far and its of no use.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Modifying all pointers to a particular Object. [Re: EvilSOB] #258774
04/02/09 03:39
04/02/09 03:39
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Well the only way I could think of would be to compare your global variables to the pointer which is supposed to be removed.
Like
Code:
ENTITY* aPtrToRemove = ent_create("myent.mdl", myPos, theAction);
...  //whatever code follows next
if(aPtrToRemove == myGlobalVariable1) ptr_remove(myGlobalVariable1);
if(aPtrTpRemove == myGlobalVariable2) ptr_remove(myGlobalVariable2);
...


This pseudocode shows that it would be practically to keep the global entity pointers in an array to be able to loop through them.

Hope this helps...

greetings
K-Duke


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: Modifying all pointers to a particular Object. [Re: KDuke] #258809
04/02/09 09:20
04/02/09 09:20
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Nice try but no go.
It is un-feasable for me to store all the pointers I want to check in an array.
I want to SCAN and FIND them all, without previously knowing their names or locations.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Modifying all pointers to a particular Object. [Re: EvilSOB] #258826
04/02/09 10:30
04/02/09 10:30
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
First of maybe pVars is of help here?

This is only an assumption though theoretically you should be able to scan all global variables by comparing the value starting at pVars, increasingly checking the following pointer up till ((sys_memory - nexus)*1024)/4.

Anyways... maybe you could post some pseudo/example code of what is your intention to do with this?

greetings
K-Duke

Last edited by KDuke; 04/02/09 10:36.

Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: Modifying all pointers to a particular Object. [Re: KDuke] #258833
04/02/09 11:48
04/02/09 11:48
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline OP
Expert
EvilSOB  Offline OP
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Hmm, I'll try looking into the pVars avenue. I thought it was for external (dll) use only.

Sorry, cant pseudo-code anything.
One - Its only theoretical at this point. If it cant be done I want to know now before I NEED it.
Two - My original post is as close to pseudo-code as I can get at this early stage.

But it basically involves simplifying a cross-referential, multi-layered group of linked lists.
If I delete an object from THIS linked list, I want to be able to call one function that can then
scan through "memory" and set all pointers to that object to NULL.
Then the actions associated with those pointers can perform the necessary clean-up operations
when they see the object no longer exists, by checking if(pointer=NULL).
These "other actions" could be linked-list house-keeper actions, OR entity-targetting actions,
Database (in a TEXT) entries or whatever.
I intend this code to develop until it is flexible, so it is not limited to any particular object "type".
I just need help getting started.

I'll start looking at pVars now. Thanks again.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

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