Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Which OnRightClicked() do you mean? There's only OnPlayerRightClickingEntity() and there's a reason for it to give a cPlayer - only players may right-click other entities. So what are you trying to accomplish here?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Also, I think you should get rid of the default param for SetOwner(). It doesn't make sense that we even allow a call to SetOwner without the param; and if we want to remove ownership, we want to have it explicit: SetOwner(NULL)
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
Problem with this code is that once the owner disconnects from the server, the wolf will crash - it has a pointer to an object that's no longer there. And when the player reconnects, there's no way they can re-claim their wolves.
I think it'd be better to store the owner's name. That way it won't crash and it will survive a reconnect; a name can also be saved to the world file. Your best bet would be to check the NBT structure in vanilla to see how it does this.
Posts: 4,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
Now you mention it thats a big problem. I gues my idea to make other entities have wolves isn't going to work ;( Could you them maybe explain how to create an callback? So I can use it in cWorld::FindAndDoWithPlayer().
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1074 thank(s) in 852 post(s)
That's the string comparison function having some debugging output. Why are you using "FindAndDoWithPlayer()"? That one does similarity comparison, you want exact-matching, so DoWithPlayer() should be the right one.
What are you using the callback for anyway? Is that even needed?