Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » Probable error
Probable error [message #478091] Wed, 19 December 2012 15:20 Go to next message
Agent is currently offline  Agent
Messages: 45
Registered: November 2010
Location: United States
Karma: 0
Recruit
In SSGMGameManager::PowerupPurchaseHook, SSGMGameManager::VehiclePurchaseHook, and SSGMGameManager::CharacterPurchaseHook methods of gmgame.cpp, there appears to be a slight logic error. Each of them contain something along the lines of:

		int ret = RegisteredEvents[EVENT_CHARACTER_PURCHASE_HOOK][i]->OnCharacterPurchase(base,purchaser,cost,preset,data);
		if (ret != -1)
		{
			return ret;
		}
		if (ret == -2)
		{
			fp = true;
		}


The second if statement will never be reached in the even which it is true, as when ret == -2, it will have already return.
I'm assuming the intended behavior would have:

		int ret = RegisteredEvents[EVENT_CHARACTER_PURCHASE_HOOK][i]->OnCharacterPurchase(base,purchaser,cost,preset,data);
		if (ret == -2)
		{
			fp = true;
		}
		else if (ret != -1)
		{
			return ret;
		}


Edits:
Also, will there be a method implemented into the Plugin class to allow for plugins to detect player/vehicle/building/object deaths? I'm trying to avoid modifying scripts.dll directly for my IRC bot.

[Updated on: Wed, 19 December 2012 15:32]

Report message to a moderator

Re: Probable error [message #478095 is a reply to message #478091] Thu, 20 December 2012 00:54 Go to previous messageGo to next message
StealthEye is currently offline  StealthEye
Messages: 2518
Registered: May 2006
Location: The Netherlands
Karma: 0
General (2 Stars)

You seem to be right. I will apply your fix when I am home.

You can define a script in your plugin, override the Killed or Destroyed method, and attach it in the object creation hook. You do not need to change scripts.dll for this to work afaik.


BlackIntel admin/founder/coder
Please visit http://www.blackintel.org/
Re: Probable error [message #478097 is a reply to message #478095] Thu, 20 December 2012 09:29 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

StealthEye wrote on Thu, 20 December 2012 01:54


You can define a script in your plugin, override the Killed or Destroyed method, and attach it in the object creation hook. You do not need to change scripts.dll for this to work afaik.

^ Check out the example plugin included with SSGM, it does pretty much this, although it doesn't define the ::Killed or ::Destroyed event if I recall, but you can probably do this yourself if you know what you're doing. Rocked Over


-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

Re: Probable error [message #478098 is a reply to message #478091] Thu, 20 December 2012 09:40 Go to previous message
Agent is currently offline  Agent
Messages: 45
Registered: November 2010
Location: United States
Karma: 0
Recruit
Ah, I'll just use that then. Razz
Previous Topic: Just some idea for next update
Next Topic: graphic updates
Goto Forum:
  


Current Time: Sat Apr 13 21:59:19 MST 2024

Total time taken to generate the page: 0.00575 seconds