2 registered members (Ayumi, Power_P),
1,065
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Pointer valid?
#221204
08/12/08 19:07
08/12/08 19:07
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Hi! I have the following code:
entity* temppointer;
function blabla()
{
var savepointer;
savepointer = you;
you = null;
while(1)
{
temppointer = savepointer;
if(temppointer == NULL) {return(-1);}
wait(1);
}
}
But this function will never return -1 because it never goes into the if, even if the you entity is removed. So how can I check if a pointer is still valid even if the pointer isn't set to null from another function? Thanks for your help! Dark_Samurai
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: Pointer valid?
[Re: Dark_samurai]
#221206
08/12/08 19:10
08/12/08 19:10
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
why not set temppointe to 0 when its removed?
"empty"
|
|
|
Re: Pointer valid?
[Re: flits]
#221208
08/12/08 19:21
08/12/08 19:21
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Because temppointer is only used for getting access to skills... of the entity, but the pointer itself is saved in the var. So this is like the variable temp (you can/should only use it one frame long because other functions will also use this). The only solution I currently can imagin would be to use a global pointer for this, but thats not realy handy because in my chase I would need a lot global pointers...
Dark_Samurai
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: Pointer valid?
[Re: Dark_samurai]
#221221
08/12/08 21:49
08/12/08 21:49
|
Joined: May 2006
Posts: 398
Bot190
Senior Member
|
Senior Member
Joined: May 2006
Posts: 398
|
if you want the var savepointer to be updated when "you" changes you have to put it in a loop. right now, it sets savepointer to what ever "you" is. but doesn't change when you set "you" to null.
Wait, there isn't a "Make My Game Now" button?
|
|
|
Re: Pointer valid?
[Re: testDummy]
#221646
08/15/08 09:56
08/15/08 09:56
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
OP
Serious User
|
OP
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Ok, thanks for your help! I solved the problem now!
Dark_Samurai
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
|