   ListQueue of method calls
  Is there a way i can implement a Queue of method calls?For my game, each object (Unit) has a given speed.  I want the user to tell each unit how to move, the moveUnit() call will then be added to the queue.  After all movement orders are completed, the method calls will the be re-arranged according to the invoking units speed parameter.  Each moveUnit() call will then run from highest speed to lowest.So, my questions for all of you are:1. Is my situation above possible?  2. Is there even a data structure that can hold method calls?3. Am I even using the proper data structure? Should I use an Array List or Linked List?Thanks 
  If the method calls have the same signature, then you can just store a list of function pointers. Otherwise, you have to do a lot more work.You don''t need to do this anyway, do you? Why not just have a list of units to move, sort that by the speed, and call the method on each unit in the list as appropriate?Array List? What is that? The data structure in this case isn''t really relevant anyway, as long as you can sort it in reasonably quick time.   [ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost  Asking Questions | Organising code files | My stuff | Tiny XML | STLPort] ;quote:Original post by Kylotan  You don''t need to do this anyway, do you? Why not just have a list of units to move, sort that by the speed, and call the method on each unit in the list as appropriate?Array List? What is that? The data structure in this case isn''t really relevant anyway, as long as you can sort it in reasonably quick time.   Thats what i ended up doing, thanks anyway...An array list in an object (unlike an array) which is like an array in almost every way except for the fact that it does not have a definative size.  It can shrink or contract depending on how many cells of it are occupied.  Very handy in some instances. ;  Are you by any chance a (fellow) Java programmer?  C++ types* would probably call it a "vector".* pun intended. :D   [edited by - Zahlman on April 5, 2004 4:19:17 AM];quote:Original post by Zahlman  Are you by any chance a (fellow) Java programmer? Indeed, I''ve barely touched c++ within the last year.  I would like to get back in the swing of it though. 