About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
General Pointer to class ?
Author Message
RedcrowProd Offline
Bronze Supporter

Post: #1
General Pointer to class ?
Hey, so i was trying something and ended up with a small wall.
i'm trying to do a dynamic target system passing the Sockaddr of the neighbor, into the actor.user, and getting it back, so i can do a find into my map of neighbor to avoid repa.

so i got my actor/addr:
Actor A_Torso;
SockAddr addr;

and i give him an user info of the address of my addr:
A_Torso.user(&addr);

up to here, no issues.

now i want to get it back to get my mouseover info.

and do a find with it.

so i do something like that:

if(Physics.ray(start, end-start, &phys_hit, actor_groups )) // if ray hit something
{
// CAST(SockAddr, phy_hit.user);
SockAddr &test = phys_hit.user;
Neighbor *n=NeighborClients.find (test);
}

but i must have a wrong idea of what is this General Ptr, because nothing is working saying Ptr cannot be converted to SockAddr

anybody could clear up this grey area please ? =)
07-18-2015 07:22 AM
Find all posts by this user Quote this message in a reply
rstralberg Offline
Member

Post: #2
RE: General Pointer to class ?
This will do the trick

Code:
SockAddr* test = reinterpret_cast<SockAddr*>(phys_hit.user);

or for the lazy one smile

Code:
SockAddr* test = (SockAddr*)phys_hit.user;
(This post was last modified: 07-18-2015 10:47 AM by rstralberg.)
07-18-2015 09:58 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RedcrowProd Offline
Bronze Supporter

Post: #3
RE: General Pointer to class ?
perfect thanks wink
07-18-2015 04:52 PM
Find all posts by this user Quote this message in a reply
Post Reply