-1

I trying to "fix" one problem in one game, there is .cpp file, and two version, maybe i found bag. What diference beetwen this 2 examples of code:

Example #1

    // not supposed to do anything while evocate
    if (m_creature->HasAura(SPELL_EVOCATION))
    {
        return;
    }

Example #2

// not supposed to do anything while evocate
if (m_creature->HasAura(SPELL_EVOCATION))
    return;

Maybe it`s stupid question, i am not C++ developer, just knew only python and i am newbie . So what the diference in logic of this code? Thanks alot.

Aqia Ru
  • 11
  • 2

2 Answers2

2

No difference. They are equivalent. When there is only one statement in the body of the if then you can omit the braces.

GrahamS
  • 9,980
  • 9
  • 49
  • 63
  • thank you for answer, i trying to find bug, but no expirience in c++ ( here 2 version of code: I use it: https://github.com/mangos/ScriptDev3/blob/master/scripts/eastern_kingdoms/karazhan/boss_curator.cpp And here second (wich more older): https://github.com/scriptdev2/scriptdev2/blob/master/scripts/eastern_kingdoms/karazhan/boss_curator.cpp Problem is that mob cast every second Evocation, and summon another mobs, but he must just cast 20 second "Evocation" spell, and dont do anything ;( – Aqia Ru Dec 24 '16 at 14:38
0

There is no diffrence in running the code you will get the same resaults. but your second problem in the comments is not really specific. You can make a second question with specific info about what is your problem or you can google your bug. edit: I didnt really understand the question but if you are looking for diffrences between the two version of code. In the first version you addet:

struct boss_curator : public CreatureScript
{
    boss_curator() : CreatureScript("boss_curator") {}
  • thank you! its specific problem in game. boss must stop do anything and cast spell "Evocation" - in "chaneling mode" (dont break it), but he do it (break spell cast) many times and start again and again, and after each stopt\start he summon new mobs. There is 2 version of this code , i use "new" version https://github.com/mangos/ScriptDev3/blob/master/scripts/eastern_kingdoms/karazhan/boss_curator.cpp - but exist older https://github.com/scriptdev2/scriptdev2/blob/master/scripts/eastern_kingdoms/karazhan/boss_curator.cpp i trying compare it – Aqia Ru Dec 24 '16 at 14:53