Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3268 for code/branches/netp6


Ignore:
Timestamp:
Jul 1, 2009, 6:20:38 PM (15 years ago)
Author:
rgrieder
Message:

Removed the need to specify unique numbers when declaring multiple console commands with the same non-string arguments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp6/src/core/ConsoleCommand.h

    r3196 r3268  
    3232#include "CorePrereqs.h"
    3333
     34#include <boost/preprocessor/cat.hpp>
     35
    3436#include "ArgumentCompletionFunctions.h"
    3537#include "CommandExecutor.h"
     
    3941
    4042#define SetConsoleCommand(classname, function, bCreateShortcut) \
    41     SetConsoleCommandAliasMulti(classname, function, #function, 0, bCreateShortcut)
     43    SetConsoleCommandGeneric(classname, function, #function, bCreateShortcut)
    4244#define SetConsoleCommandAlias(classname, function, name, bCreateShortcut) \
    43     SetConsoleCommandAliasMulti(classname, function, name, 0, bCreateShortcut)
    44 #define SetConsoleCommandAliasMulti(classname, function, name, number, bCreateShortcut) \
    45     SetConsoleCommandGeneric(classname##function##consolecommand__##number, classname, orxonox::createConsoleCommand(orxonox::createFunctor(&classname::function), name), bCreateShortcut)
     45    SetConsoleCommandGeneric(classname, function, name, bCreateShortcut)
    4646
    47 #define SetConsoleCommandGeneric(fakevariable, classname, command, bCreateShortcut) \
    48     orxonox::ConsoleCommand& fakevariable = orxonox::ClassIdentifier<classname>::getIdentifier(#classname)->addConsoleCommand(command, bCreateShortcut)
     47#define SetConsoleCommandGeneric(classname, function, name, bCreateShortcut) \
     48    orxonox::ConsoleCommand& BOOST_PP_CAT(classname##function##consolecommand__, __LINE__) = orxonox::ClassIdentifier<classname>::getIdentifier(#classname)->addConsoleCommand(orxonox::createConsoleCommand(orxonox::createFunctor(&classname::function), name), bCreateShortcut)
    4949
    5050
    5151#define SetConsoleCommandShortcut(classname, function) \
    52     SetConsoleCommandShortcutAliasMulti(classname, function, #function, 0)
     52    SetConsoleCommandShortcutAliasGeneric(classname, function, #function)
    5353#define SetConsoleCommandShortcutAlias(classname, function, name) \
    54     SetConsoleCommandShortcutAliasMulti(classname, function, name, 0)
    55 #define SetConsoleCommandShortcutAliasMulti(classname, function, name, number) \
    56     SetConsoleCommandShortcutGeneric(function##consolecommand__##number, orxonox::createConsoleCommand(orxonox::createFunctor(&classname::function), name))
     54    SetConsoleCommandShortcutAliasGeneric(classname, function, name)
     55#define SetConsoleCommandShortcutAliasGeneric(classname, function, name) \
     56    SetConsoleCommandShortcutGeneric(BOOST_PP_CAT(function##consolecommand__, __LINE__), orxonox::createConsoleCommand(orxonox::createFunctor(&classname::function), name))
    5757
    5858#define SetConsoleCommandShortcutExtern(function) \
    59     SetConsoleCommandShortcutExternAliasMulti(function, #function, 0)
     59    SetConsoleCommandShortcutExternAliasGeneric(function, #function)
    6060#define SetConsoleCommandShortcutExternAlias(function, name) \
    61     SetConsoleCommandShortcutExternAliasMulti(function, name, 0)
    62 #define SetConsoleCommandShortcutExternAliasMulti(function, name, number) \
    63     SetConsoleCommandShortcutGeneric(function##consolecommand__##number, orxonox::createConsoleCommand(orxonox::createFunctor(&function), name))
     61    SetConsoleCommandShortcutExternAliasGeneric(function, name)
     62#define SetConsoleCommandShortcutExternAliasGeneric(function, name) \
     63    SetConsoleCommandShortcutGeneric(BOOST_PP_CAT(function##consolecommand__, __LINE__), orxonox::createConsoleCommand(orxonox::createFunctor(&function), name))
    6464
    6565#define SetConsoleCommandShortcutGeneric(fakevariable, command) \
Note: See TracChangeset for help on using the changeset viewer.