Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualDrSuperSocks

Posted 20 March 2013 - 05:25 PM

Well, for your small amount of commands that looks good to me. If you wanted to get semi-fancy, you could have an array of pointers to functions, where the functions executed the appropriate command. Then, your CommandMode would be the index of the function in your array. The functions would take an int for the number of args submitted and an array of strings for the actual args. Just an idea smile.png

 

Edit:

Even better, get rid of the CommandMode value and use std::map to map command names to pointers to functions.


#1DrSuperSocks

Posted 20 March 2013 - 04:49 PM

Well, for your small amount of commands that looks good to me. If you wanted to get semi-fancy, you could have an array of pointers to functions, where the functions executed the appropriate command. Then, your CommandMode would be the index of the function in your array. The functions would take an int for the number of args submitted and an array of strings for the actual args. Just an idea :)


PARTNERS