Author Topic: Problem adding plugin system.  (Read 4865 times)

Grief-Code

  • Average Member
  • ***
  • Posts: 149
  • Karma: +25/-8
    • View Profile
Re: Problem adding plugin system.
« Reply #15 on: February 27, 2015, 09:46:05 am »
Oh lol, i totally missread that.

Indeed, im calling it twice :D Stupid me, there was a snippet around there for the handler register, and i just didnt notice that i copied out of the code the calling :D

Thanks for the info.


Edit: Can be confirmed as reason.
« Last Edit: February 27, 2015, 09:59:54 am by Grief-Code »

Grief-Code

  • Average Member
  • ***
  • Posts: 149
  • Karma: +25/-8
    • View Profile
Re: Problem adding plugin system.
« Reply #16 on: February 28, 2015, 01:54:32 am »
One last question.

Everytime an event gets included into the ghost, there is a value added 'exectuedTwice':

Code: [Select]
-void CGame :: EventPlayerDeleted( CGamePlayer *player )
+void CGame :: EventPlayerDeleted( CGamePlayer *player, bool executeTwice )
 {
- CBaseGame :: EventPlayerDeleted( player );
+ try
+ {
+ EXECUTE_HANDLER("PlayerDeleted", true, boost::ref(this), boost::ref(player))
+ }
+ catch(...)
+ {
+ return;
+ }
 
+ CBaseGame :: EventPlayerDeleted( player, false );
+

What is the reason for that?
Just to understand the case.

uakf.b

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
  • Karma: +86/-12
    • View Profile
Re: Problem adding plugin system.
« Reply #17 on: February 28, 2015, 10:19:01 am »
It may have been a way to get plugins to be able to hook event either before or after the event processing in C++ finishes, although maybe not since that'd be better done by adding ExecuteHandler at the end. Unless Krauzi replies, probably won't figure out, since the boolean isn't used anywhere as far as I can tell (only looking at your source code though, maybe original pyghost++ uses it).

Grief-Code

  • Average Member
  • ***
  • Posts: 149
  • Karma: +25/-8
    • View Profile
Re: Problem adding plugin system.
« Reply #18 on: February 28, 2015, 11:10:23 am »
Well it was in use there, but I didnt understand the reason for it.

However, thanks for the info.

Regards

uakf.b

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
  • Karma: +86/-12
    • View Profile
Re: Problem adding plugin system.
« Reply #19 on: February 28, 2015, 05:23:41 pm »
Well it was in use there, but I didnt understand the reason for it.

However, thanks for the info.

Regards
Looks like it was to prevent plugins from getting event notification twice, once from parent class and again from the child class (e.g. CBaseGame and CGame).