Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 10-31-2012, 09:54 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default overriding and casting

i'm still learning C++ and i'm having a little bit of trouble wrapping my head around something. i've seen areas where group members are being iterated over as mobs, IsClient() is checked, and if true, a Client method is called on the mob through CastToClient(). can the check and cast be skipped if the method being called is overridden in the Client class? is it only necessary when the method being called is unique to Client? i'm wondering because IsClient() is only set to return a value of true in the definition of Client, but is false in Entity and Mob, and this leads me to believe the client check and cast would be superfluous.

for example, if i wanted to override Mob::IsEngaged() in client.h with

Code:
virtual inline bool IsEngaged() { return (IsAIControlled() ? !hate_list.IsEmpty() : AggroCount > 0);
would i be able to skip IsClient() and CastToClient() for each group member?

thanks in advance.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:34 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3