Issue solved. Here's the fix for the sake of the mailing list archives.

On first glance it looks like the assertion is raised because the
factory does not exist. Actually, it's raised because a factory for
that entity *already* exists.

This is because CSDKPlayer and C_SDKPlayer are linking themselves to
the "player" entity, with the LINK_ENTITY_TO_CLASS() macro, which
creates the factory. When you do this in your derived class, it can't
create the factory because CSDKPlayer already did.

The solution?

Comment out the LINK_ENTITY_TO_CLASS() macro in both CSDKPlayer and
C_SDKPlayer (sdk_player.cpp and c_sdk_player.cpp).

Now only your derived player class will create the factory and
happiness will ensue.

--Bob





On Sat, Aug 29, 2009 at 6:11 PM, Bob Somers<[email protected]> wrote:
> Yep. It also looks like LINK_ENTITY_TO_CLASS is the macro that creates
> the factory.
>
> --Bob
>
>
>
>
> On Sat, Aug 29, 2009 at 6:06 PM, Jonathan Murphy<[email protected]> 
> wrote:
>> After looking on the SDK do you have
>>
>> DECLARE_CLASS(CMyPlayer, CSDKPlayer);
>>
>> In the header declaration.
>>
>> On Sunday, August 30, 2009, Jonathan Murphy <[email protected]> wrote:
>>> I don't have an SDK with me but there should be a set of macros used
>>> to declare a factory for new entities.
>>>
>>> On Sunday, August 30, 2009, Bob Somers <[email protected]> wrote:
>>>> So just do a global find/replace on CSDKPlayer to CMyPlayer?
>>>>
>>>> --Bob
>>>>
>>>>
>>>>
>>>> On Sat, Aug 29, 2009 at 5:35 PM, Stephen Swires<[email protected]> 
>>>> wrote:
>>>>> The official way to do this with the template is to copy all the SDK stuff
>>>>> and rename it to what you want
>>>>>
>>>>> On Sun, Aug 30, 2009 at 1:31 AM, Bob Somers <[email protected]> wrote:
>>>>>
>>>>>> Hello all.
>>>>>>
>>>>>> So I'm trying to create a custom player by deriving it from CSDKPlayer,
>>>>>> like so:
>>>>>>
>>>>>> class CMyPlayer : public CSDKPlayer
>>>>>> {
>>>>>>   // player things
>>>>>> };
>>>>>>
>>>>>> I've got both the server and client players skeleton class build, I've
>>>>>> linked the class to the player entity with LINK_ENTITY_TO_CLASS, and
>>>>>> setup a simple send/recv table that just networks one boolean
>>>>>> temporarily.
>>>>>>
>>>>>> Lastly, I edited the _client.cpp file to instantiate a an instance of
>>>>>> my CMyPlayer class instead of CSDKPlayer when creating new players.
>>>>>>
>>>>>> However, now when I run the mod I break at an assertion:
>>>>>>
>>>>>> File: game\server\util.cpp
>>>>>> Line: 144
>>>>>> Assertion Failed: FindFactory(pClassName) == NULL
>>>>>>
>>>>>> I looked into it a bit and it looks the server keeps a dictionary of
>>>>>> entity factories for producing entities of certain types. My guess is
>>>>>> that it can't find a factory to build my custom player class. I tried
>>>>>> looking for an example of building a CEntityFactory for it, but
>>>>>> couldn't find anything. Is this something I need to build myself and
>>>>>> call InstallFactory(), or should one of the macros be creating that?
>>>>>>
>>>>>> Lastly, am I doing something horribly wrong? i.e. should not be
>>>>>> subclassing CSDKPlayer? Thanks.
>>>>>>
>>>>>> --Bob
>>>>>>
>>>>>> _______________________________________________
>>>>>> To unsubscribe, edit your list preferences, or view the list archives,
>>>>>> please visit:
>>>>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> - Stephen Swires
>>>>> _______________________________________________
>>>>> To unsubscribe, edit your list preferences, or view the list archives, 
>>>>> please visit:
>>>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> To unsubscribe, edit your list preferences, or view the list archives, 
>>>> please visit:
>>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>>>
>>>>
>>>
>>> --
>>> Programmer for Resistance and Liberation
>>> http://www.resistanceandliberation.com
>>> Programmer for Red Tribe
>>> http://www.redtribe.com
>>>
>>
>> --
>> Programmer for Resistance and Liberation
>> www.resistanceandliberation.com
>> Programmer for Red Tribe
>> www.redtribe.com
>>
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list archives, 
>> please visit:
>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>
>>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to