PlayerOwner vs. Owner

Discussions about Coding and Scripting
Post Reply
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

PlayerOwner vs. Owner

Post by Barbie »

I was visiting the HUD code and stumbled about the usage of PlayerOwner and Owner. They are defined as

Code: Select all

HUD.uc, line 19:			var PlayerPawn PlayerOwner;		// always the actual owner
Actor.uc, line 79:			var const Actor Owner;			// Owner actor.
Shouldn't they always reference the same?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Buggie
Godlike
Posts: 2733
Joined: Sat Mar 21, 2020 5:32 am

Re: PlayerOwner vs. Owner

Post by Buggie »

I want help you: :lol2:
Exists also PawnOwner :loool:
https://github.com/Slipyx/UT99/blob/f2e ... HUD.uc#L49

Code: Select all

var Pawn PawnOwner;	// pawn currently managing this HUD (may be the viewtarget of the owner rather than the owner)
--- EDIT ---
https://github.com/Slipyx/UT99/blob/f2e ... UD.uc#L294

Code: Select all

PlayerOwner = PlayerPawn(Owner);
I think it link to same actor but for avoid many-many-many casts everywhere - it cast only once and saved to field.
Post Reply