Declaring a map object

Started by
1 comment, last by jon723 17 years, 2 months ago
I am trying to declare an object (ball) so that either team can pick up the ball. I am modding existing code and I am stuck. If you look at the code below you will see that there are 2 balls one for each team. I want there to be only 1 ball that both teams use. I do not know how to declare it since it is declared by which team the ball is for. Any help would be great. If more code is needed let me know here is the header info:

class RB_RBTeam : public RB_Team
{
public:
   RB_RBTeam();
   void onBeginRound();
   void setDroppedController(RB_ItemControllerAPI & icapi);
   bool updateTrackedballs();
   void releaseControllers();
   void makeballAvailable();
   bool availableball();
   RB_MenuPageAPI& getballIndicatorPage();
   
   std::string             ball_name;
   std::string             enemy_ball_name;
   std::string             endzone_name;
   std::string             enemy_endzone_name;
   
   bool                    track_dropped_controller;
   RB_ItemControllerAPI  ball_controller;
   RB_ItemControllerAPI  dropped_ball_controller;
	
};
here is the .cpp file info:

RB_RBMode::RB_RBMode()
{
   shortID = "RB";
   mode_index=MODE_RB;
   // create the two teams
   _teams[0] = new RB_RBTeam;
   _teams[1] = new RB_RBTeam;
   getTeam(1)->team_name=TEAM_NAMES[0];     // Definable?
   getTeam(2)->team_name=TEAM_NAMES[1];
   getTeam(1)->team=1;
   getTeam(2)->team=2;
   getTeam(1)->ball_name=("ball1");
   getTeam(1)->enemy_ball_name=("ball2");
   getTeam(2)->ball_name=("ball2");
   getTeam(2)->enemy_ball_name=("ball1");


    onInterfaceLoaded();

Advertisement
Create a Game object, and have it own the single Ball?
Another option is to have a static ball object. This way there is only one instance of object when it's referenced by other objects.
www.lefthandinteractive.net

This topic is closed to new replies.

Advertisement