script class style

I’ve seen a majority of scripts using choise 3, malygos was recently added and used choise 3 however icc is clearly using choice 1.

While we are already polling for other stuff on this forum, why not get some consistency here too and set a standard.

Choise 1:

class npc_option1 : public CreatureScript
{
    public:
        npc_option1() : CreatureScript("npc_option1") { }

        struct npc_option1AI : public ScriptedAI
        {
            npc_testAI(Creature* creature) : ScriptedAI(creature)
            {
            }

            void Reset()
            {
                _gotCondition = false;
            }

        private:
            bool _gotCondition;
        };

        CreatureAI* GetAI(Creature* creature) const
        {
            return new npc_option1AI(creature);
        }
};

Choise 2

class npc_option2 : public CreatureScript
{
public:
    npc_option2() : CreatureScript("npc_option2") { }

    struct npc_option2AI : public ScriptedAI
    {
        npc_option2AI(Creature* creature) : ScriptedAI(creature)
        {
        }

        bool GotCondition;

        void Reset()
        {
            GotCondition = false;
        }
    };

    CreatureAI* GetAI(Creature* creature) const
    {
        return new npc_option2AI(creature);
    }
};

Choise 3

class npc_option3 : public CreatureScript
{
public:
    npc_option3() : CreatureScript("npc_option3") { }

    CreatureAI* GetAI(Creature* creature) const
    {
        return new npc_option3AI(creature);
    }

    struct npc_option3AI : public ScriptedAI
    {
        npc_option3AI(Creature* creature) : ScriptedAI(creature)
        {
        }

        bool GotCondition;

        void Reset()
        {
            GotCondition = false;
        }
    };
};

[/CODE]

Choice 1 by far, but there’s something that still bugs me about it. Should we imply indentation under any { ?

If so, then choice 1:

[CODE]class npc_option1 : public CreatureScript
{
public:
npc_option1() : CreatureScript(“npc_option1”) { }

    struct npc_option1AI : public ScriptedAI
    {
        npc_testAI(Creature* creature) : ScriptedAI(creature)
        {
        }

        void Reset()
        {
            _gotCondition = false;
        }

    private:
        bool _gotCondition;
    };

    CreatureAI* GetAI(Creature* creature) const
    {
        return new npc_option1AI(creature);
    }

};[/code]

would become (check “private” indentation first, then whole)

[code]class npc_option1 : public CreatureScript
{
public:
npc_option1() : CreatureScript(“npc_option1”) { }

    struct npc_option1AI : public ScriptedAI
    {
        npc_testAI(Creature* creature) : ScriptedAI(creature)
        {
        }

        void Reset()
        {
            _gotCondition = false;
        }

        private:
            bool _gotCondition;
    };

    CreatureAI* GetAI(Creature* creature) const
    {
        return new npc_option1AI(creature);
    }

};
[/CODE]

or

[CODE]class npc_option1 : public CreatureScript
{
public:
npc_option1() : CreatureScript(“npc_option1”) { }

    struct npc_option1AI : public ScriptedAI
    {
            npc_testAI(Creature* creature) : ScriptedAI(creature)
            {
            }

            void Reset()
            {
                _gotCondition = false;
            }

        private:
            bool _gotCondition;
    };

    CreatureAI* GetAI(Creature* creature) const
    {
        return new npc_option1AI(creature);
    }

};[/code]

or

[code]class npc_option1 : public CreatureScript
{
public:
npc_option1() : CreatureScript(“npc_option1”) { }

    struct npc_option1AI : public ScriptedAI
    {
        public:
            npc_testAI(Creature* creature) : ScriptedAI(creature)
            {
            }

            void Reset()
            {
                _gotCondition = false;
            }

        private:
            bool _gotCondition;
    };

    CreatureAI* GetAI(Creature* creature) const
    {
        return new npc_option1AI(creature);
    }

};
[/CODE]

Indentation really needs to be another thread. We have so many inconsistencies…

If we can firm all this up (since it was one of our tasks to do from our last meeting anyway /emoticons/default_tongue.png), then we will be one step closer becoming the professional development team that we already are at heart /emoticons/default_smile.png

– Brian