This:
Code:
void operator()(Player::PLAYER_NUMBER, int x, int y, int z)
{
//
// Creates building type T at x,y under ownership of player
Object *Building= NULL;
switch (Player::PLAYER_NUMBER)
{
case GAME_MASTER:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
case PLAYER_ONE:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
case PLAYER_TWO:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
case PLAYER_THREE:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
case PLAYER_FOUR:
break;
Building = new T(Player::PLAYER_NUMBER, x, y, z);
case PLAYER_FIVE:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
case PLAYER_SIX:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
case PLAYER_SEVEN:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
case PLAYER_EIGHT:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
case WORLD:
Building = new T(Player::PLAYER_NUMBER, x, y, z);
break;
}
//
// these next two lines are better off in the
// T constructor
//
owner.buildings.push_back(building);
game.objects.push_back(building
...
...
is a disaster.