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
Page 2 of 3 1 2 3
Re: Function called by Entity is terminated after Entity is removed? [Re: EvilSOB] #259921
04/08/09 08:28
04/08/09 08:28
Joined: Jan 2005
Posts: 605
Deutschland, NRW
G
garv3 Offline OP
User
garv3  Offline OP
User
G

Joined: Jan 2005
Posts: 605
Deutschland, NRW
Quote:
Hey garv, my last post does contain a function to use as a workaround,
if you are deperate.
Oh yeah, missed it, because I read the post before the edit. This might be a very slow function if you got many entities. And I do.
Quote:
But I feel we need to band together and try to get a real fix for this
pushed through as an engine update.
I agree! This is a very inappropriate limitation that has to be fixed.

So jcl - accept our request please blush


GameStudio Version: A7 Pro v7.86
Re: Function called by Entity is terminated after Entity is removed? [Re: garv3] #259943
04/08/09 10:11
04/08/09 10:11
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Ive added THIS request, and a link back here, to "The Future" forum.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Function called by Entity is terminated after Entity is removed? [Re: EvilSOB] #260089
04/08/09 20:49
04/08/09 20:49
Joined: Jan 2005
Posts: 605
Deutschland, NRW
G
garv3 Offline OP
User
garv3  Offline OP
User
G

Joined: Jan 2005
Posts: 605
Deutschland, NRW
Great! The solution offered by jcl would be perfect!


GameStudio Version: A7 Pro v7.86
Re: Function called by Entity is terminated after Entity is removed? [Re: EvilSOB] #260139
04/09/09 04:48
04/09/09 04:48
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Well as the parameter is a newly created variable which isn't changed if the entity gets removed it should be possible to do the following:
Code:
function doSomeStuff(ENTITY** ent){
   while(*ent){
      // do something as logn as the entity exists
      wait(1);
   }
   // do something else -> this is not performed!!!
}


Then you gotta call the function this way:
Code:
doSomeStuff(&TestBlock)


This way you are not creating a copy of the entity-pointer but rather more you access the memory where the entity-pointer is stored and it will be changed if the entity gets removed.

greetings
K-Duke


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: Function called by Entity is terminated after Entity is removed? [Re: KDuke] #260141
04/09/09 05:07
04/09/09 05:07
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Ive got a sneaky suspison it will fail as soon as doSomeStuff hits its first wait.
I have recently discovered, with JCL's help, that the "&" operator WILL fail
if (in your example) TestBlock is a local pointer. (due to multitasking of pointers)
Also, there is no way you could test if the ME, MY, or YOU pointers have a valid
entry.
Also, for it to work, when you ent_remove(TestBlock); you also have to follow with TestBlock=NULL;

Nice try though, but Ive already been down that road.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Function called by Entity is terminated after Entity is removed? [Re: EvilSOB] #260143
04/09/09 05:41
04/09/09 05:41
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
*deleted* has been nonsense!

Last edited by KDuke; 04/09/09 05:43.

Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: Function called by Entity is terminated after Entity is removed? [Re: KDuke] #260146
04/09/09 06:11
04/09/09 06:11
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Eh? I dont follow? Am I wrong? It DOES happen.
I have had faulty test processes before that led me to being stupid.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Function called by Entity is terminated after Entity is removed? [Re: EvilSOB] #260148
04/09/09 06:30
04/09/09 06:30
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
wat is "deleted" here ?


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Function called by Entity is terminated after Entity is removed? [Re: delinkx] #260156
04/09/09 07:00
04/09/09 07:00
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Dunno what was deleted, but Ive tried you suggestion, but still no luck.

Tried it by feeding it
Code:
doSomeStuff(&Globally_defined_TestBlock);
and
doSomeStuff(&Locally_defined_TestBlock);
and
me=TestBlock;  doSomeStuff(&me);
All of which failed, in varying severity crashes.
None with usable error messages at crash.

Sorry.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Function called by Entity is terminated after Entity is removed? [Re: EvilSOB] #260220
04/09/09 14:33
04/09/09 14:33
Joined: Apr 2009
Posts: 33
Germany
B
Bunsen Offline
Newbie
Bunsen  Offline
Newbie
B

Joined: Apr 2009
Posts: 33
Germany
Sorry, I'm not sure. Are you searching for this?

#include <acknex.h>
#include <default.c>

//-------------------------------------------------------------------
typedef struct { ENTITY **ent; } ENT_PTR;

//-------------------------------------------------------------------
function doSomeStuff(ENTITY **ent)
{
ENT_PTR entPtr;
entPtr.ent = ent;

while ( *(entPtr.ent) )
{
// do something as long as the entity exists:
( **(entPtr.ent) ).pan += time_step * 6;
wait (1);
}
// do something else:
// ...

printf("I'll be back!"); // signal NORMAL termination
}

//-------------------------------------------------------------------
ENTITY *Cube;

//-------------------------------------------------------------------
function main()
{
level_load(NULL);
wait(2);
Cube = ent_create("cube.mdl", vector(122,0,0), NULL);

doSomeStuff(&Cube);

while (Cube != NULL)
{
if (key_x)
{
ent_remove(Cube);
Cube = NULL;
}
wait(1);
}
}

Page 2 of 3 1 2 3

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