Raised This Month: $ Target: $400
 0% 

If to switch optimising


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DarkSidero
Junior Member
Join Date: Jul 2009
Location: Romania
Old 07-23-2009 , 16:37   If to switch optimising
Reply With Quote #1

Hello there! I'll make it short. We've got the following code:

Code:
public abilities(id)
{
    if(a_invisibility[id] && !a_stoneshield[id] && !a_rage[id])
    {
    set_task(0.1, "invisibilitydo")
    }

    if(!a_invisibility[id] && a_stoneshield[id] && !a_rage[id])
    {
    set_task(0.1, "stoneshielddo")
    }

    if(!a_invisibility[id] && !a_stoneshield[id] && a_rage[id])
    {
    set_task(0.1, "ragedo")
    }

    if(!a_invisibility[id] && !a_stoneshield[id] && !a_rage[id])
    {
    return PLUGIN_HANDLED
    }            
}
I'd want to use this code in a plugin, and that, from what I've read, would cause a lot of processor branching, thus making the plugin work harder and giving the processor a hard job. I'd like to know how is it possible to optimise it to do the same thing (from what I know up until now, it should be done through a "switch" command, but I guess there are other different ways either).
__________________
There are 10 types of people in the world: those who understand binary and those who do not.

Professions Mod

Last edited by DarkSidero; 07-29-2009 at 10:33.
DarkSidero is offline
Send a message via Yahoo to DarkSidero
 


Thread Tools
Display Modes

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 18:23.


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