Raised This Month: $51 Target: $400
 12% 

[FM] forward_return


  
 
 
Thread Tools Display Modes
Author Message
VEN
Veteran Member
Join Date: Jan 2005
Old 01-23-2007 , 05:40   [FM] forward_return
#1

The above script is act like if FMRES_SUPERCEDE been passed. Though if we would return FMRES_SUPERCEDE the script will act like if FMRES_OVERRIDE been passed.

Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {         register_forward(FM_GetGameDescription, "forward_get_game_description") } public forward_get_game_description() {         forward_return(FMV_STRING, "something")         return FMRES_OVERRIDE }

I believe the issue http://forums.alliedmods.net/showthread.php?t=50275 is related to this. Because even when you would try to return the original value the practical result will be different.
VEN is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 01-23-2007 , 06:24   Re: [FM] forward_return
#2

It's how metamod works.

Override: Don't actually block the target function, but use your return value instead of the one from the target function.
Supercede: Block the target function and use my return value.

Overriding a function when the function's only purpose is to return a value (getgamedescription) would act identically to superceding it from your point of view.

Unless I'm mis-understanding you...

edit: Just reviewed the module source...

The FMRES_OVERRIDE / FMRES_SUPERCEDE appears as though it's working for all the module is concerned. I think this would be something with how Metamod is handling it. Although there is no point to using override instead of supercede in either yours or avalanches case. In fact, I can't honestly think of an instance where override would be preferable to use.

As for avalanche's bug, that is due to a long-standing bug with non-string forward_return values. I have it fixed locally and will commit to svn as soon as I'm done testing some other stuff.
__________________
fyren sucks

Last edited by sawce the snail; 01-23-2007 at 08:20.
sawce is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 01-23-2007 , 09:37   Re: [FM] forward_return
#3

Thanks for reply.

Quote:
Override: Don't actually block the target function, but use your return value instead of the one from the target function
So following this logic
Quote:
forward_return(FMV_STRING, "something")
return FMRES_OVERRIDE
in practice should show "something", correct? But it actually doesn't, it is return nothing in practice.

EDIT:

That actually was my main point. In practice my return value doesn't "accepted" while in theory it must be "accepted".

Last edited by VEN; 01-23-2007 at 09:47.
VEN is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 01-23-2007 , 09:47   Re: [FM] forward_return
#4

From the tests I ran, fakemeta is telling metamod the proper values for returns. It's just metamod's handling of it. Just don't use override.
__________________
fyren sucks
sawce is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 01-23-2007 , 13:17   Re: [FM] forward_return
#5

Can we have a corresponding note for FMRES_OVERRIDE?
VEN is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 01-24-2007 , 06:21   Re: [FM] forward_return
#6

Fixed Avalanche's return bug in revision 3258

Added the comment in revision 3259
__________________
fyren sucks
sawce is offline
 



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 15:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode