Replaced usage of some confusing IDs with more explicit pointers
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3736 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d1c5c449f9
commit
a44b531525
@ -25,6 +25,7 @@
|
||||
#include "input/input_device.hpp"
|
||||
|
||||
class InputDevice;
|
||||
class PlayerKart;
|
||||
|
||||
/**
|
||||
* class for managing player name and control configuration.
|
||||
@ -61,6 +62,7 @@ public:
|
||||
|
||||
/**
|
||||
* Represents a player that is currently playing.
|
||||
* FIXME: this class seems very closely related to PlayerKart, maybe merge them
|
||||
*/
|
||||
class ActivePlayer
|
||||
{
|
||||
@ -68,35 +70,16 @@ class ActivePlayer
|
||||
InputDevice* m_device;
|
||||
public:
|
||||
|
||||
ActivePlayer(Player* player)
|
||||
{
|
||||
m_player = player;
|
||||
m_device = NULL;
|
||||
}
|
||||
~ActivePlayer()
|
||||
{
|
||||
setDevice(NULL);
|
||||
}
|
||||
ActivePlayer(Player* player);
|
||||
~ActivePlayer();
|
||||
|
||||
Player* getPlayer()
|
||||
{
|
||||
return m_player;
|
||||
}
|
||||
void setPlayer(Player* player)
|
||||
{
|
||||
m_player = player;
|
||||
}
|
||||
Player* getPlayer();
|
||||
void setPlayer(Player* player);
|
||||
|
||||
InputDevice* getDevice() const { return m_device; }
|
||||
void setDevice(InputDevice* device)
|
||||
{
|
||||
if (m_device != NULL) m_device->setPlayer(NULL);
|
||||
|
||||
m_device = device;
|
||||
|
||||
if(device != NULL)
|
||||
device->setPlayer(this);
|
||||
}
|
||||
InputDevice* getDevice() const;
|
||||
void setDevice(InputDevice* device);
|
||||
|
||||
PlayerKart* getKart();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -50,7 +50,6 @@ namespace StateManager
|
||||
|
||||
class PlayerKartWidget : public Widget
|
||||
{
|
||||
ActivePlayer* m_associatedPlayer;
|
||||
float x_speed, y_speed, w_speed, h_speed;
|
||||
|
||||
public:
|
||||
@ -59,6 +58,8 @@ namespace StateManager
|
||||
ModelViewWidget* modelView;
|
||||
LabelWidget* kartName;
|
||||
|
||||
ActivePlayer* m_associatedPlayer;
|
||||
|
||||
int playerID;
|
||||
std::string spinnerID;
|
||||
|
||||
@ -464,9 +465,22 @@ void setPlayer0Device(InputDevice* device)
|
||||
|
||||
PlayerKartWidget* removedWidget = NULL;
|
||||
|
||||
void playerPressedRescue(int playerID)
|
||||
{
|
||||
std::cout << "Player " << playerID << " no more wishes to play!\n";
|
||||
void playerPressedRescue(ActivePlayer* player)
|
||||
{
|
||||
int playerID = -1;
|
||||
|
||||
for (int n=0; n<g_player_karts.size(); n++)
|
||||
{
|
||||
if (g_player_karts[n].m_associatedPlayer == player)
|
||||
{
|
||||
playerID = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (playerID == -1)
|
||||
{
|
||||
std::cerr << "void playerPressedRescue(ActivePlayer* player) : cannot find passed player\n";
|
||||
}
|
||||
|
||||
removedWidget = g_player_karts.remove(playerID);
|
||||
StateManager::removeActivePlayer(playerID);
|
||||
@ -569,9 +583,22 @@ void menuEventKarts(Widget* widget, std::string& name)
|
||||
}
|
||||
std::cout << "==========\n";
|
||||
|
||||
std::cout << "Calling setNumKarts(" << race_manager->getNumKarts() + players.size() << ")\n";
|
||||
race_manager->setNumKarts( race_manager->getNumKarts() + players.size() );
|
||||
|
||||
std::cout << "Calling setNumPlayers(" << players.size() << ")\n";
|
||||
race_manager->setNumPlayers( players.size() );
|
||||
race_manager->setNumLocalPlayers( players.size() );
|
||||
|
||||
g_player_karts.clearWithoutDeleting();
|
||||
race_manager->setLocalKartInfo(0, w->getSelectionIDString());
|
||||
|
||||
// TODO : assign karts to other players too
|
||||
for(int n=1; n<players.size(); n++)
|
||||
{
|
||||
race_manager->setLocalKartInfo(n, "tux");
|
||||
}
|
||||
|
||||
input_manager->getDeviceList()->setAssignMode(ASSIGN);
|
||||
|
||||
StateManager::pushMenu("racesetup.stkgui");
|
||||
|
@ -24,12 +24,13 @@ namespace GUIEngine
|
||||
class Widget;
|
||||
}
|
||||
class InputDevice;
|
||||
class ActivePlayer;
|
||||
|
||||
namespace StateManager
|
||||
{
|
||||
void setPlayer0Device(InputDevice* device);
|
||||
void firePressedOnNewDevice(InputDevice* device);
|
||||
void playerPressedRescue(int playerID);
|
||||
void playerPressedRescue(ActivePlayer* player);
|
||||
|
||||
void kartSelectionUpdate(float delta);
|
||||
|
||||
|
@ -348,8 +348,6 @@ void startGame()
|
||||
race_manager->setNumLaps( 3 );
|
||||
race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge
|
||||
//race_manager->setNumKarts( 1 );
|
||||
race_manager->setNumPlayers( 1 );
|
||||
race_manager->setNumLocalPlayers( 1 );
|
||||
network_manager->setupPlayerKartInfo();
|
||||
//race_manager->getKartType(1) = KT_PLAYER;
|
||||
|
||||
|
@ -188,7 +188,7 @@ namespace StateManager
|
||||
{
|
||||
SpinnerWidget* w = dynamic_cast<SpinnerWidget*>(widget);
|
||||
|
||||
race_manager->setNumKarts( w->getValue() + 1 );
|
||||
race_manager->setNumKarts( w->getValue() );
|
||||
}
|
||||
/*
|
||||
289 race_manager->setDifficulty((RaceManager::Difficulty)m_difficulty);
|
||||
|
@ -244,6 +244,7 @@
|
||||
955DE88310042701006A4F3C /* check_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 955DE88110042701006A4F3C /* check_manager.cpp */; };
|
||||
955DE88C1004273B006A4F3C /* check_structure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 955DE8871004273B006A4F3C /* check_structure.cpp */; };
|
||||
955DE88D1004273B006A4F3C /* checkline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 955DE8891004273B006A4F3C /* checkline.cpp */; };
|
||||
956D36A710095035007FCB95 /* player.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 956D36A610095035007FCB95 /* player.cpp */; };
|
||||
95CB476C0FF30EF400413BAE /* bezier_curve.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95CB476B0FF30EF400413BAE /* bezier_curve.cpp */; };
|
||||
95D1F5F70FC8C3E300FF6968 /* input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95D1F5F60FC8C3E300FF6968 /* input.cpp */; };
|
||||
95D1F6190FC8CDBB00FF6968 /* options_screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95D1F6180FC8CDBB00FF6968 /* options_screen.cpp */; };
|
||||
@ -375,6 +376,7 @@
|
||||
955DE8881004273B006A4F3C /* check_structure.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = check_structure.hpp; path = ../../tracks/check_structure.hpp; sourceTree = SOURCE_ROOT; };
|
||||
955DE8891004273B006A4F3C /* checkline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = checkline.cpp; path = ../../tracks/checkline.cpp; sourceTree = SOURCE_ROOT; };
|
||||
955DE88A1004273B006A4F3C /* checkline.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = checkline.hpp; path = ../../tracks/checkline.hpp; sourceTree = SOURCE_ROOT; };
|
||||
956D36A610095035007FCB95 /* player.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = player.cpp; path = games/supertuxkart/src/config/player.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
95A118290F77EA3100B18B3D /* input.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input.hpp; path = ../../input/input.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95A1182A0F77EA3100B18B3D /* input_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = input_manager.cpp; path = ../../input/input_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95A1182B0F77EA3100B18B3D /* input_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input_manager.hpp; path = ../../input/input_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -2038,6 +2040,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95D950CD0FE473CA002E10AD /* player.hpp */,
|
||||
956D36A610095035007FCB95 /* player.cpp */,
|
||||
95D950CE0FE473CA002E10AD /* stk_config.cpp */,
|
||||
95D950CF0FE473CA002E10AD /* stk_config.hpp */,
|
||||
95D950D00FE473CA002E10AD /* user_config.cpp */,
|
||||
@ -2345,6 +2348,7 @@
|
||||
955DE88310042701006A4F3C /* check_manager.cpp in Sources */,
|
||||
955DE88C1004273B006A4F3C /* check_structure.cpp in Sources */,
|
||||
955DE88D1004273B006A4F3C /* checkline.cpp in Sources */,
|
||||
956D36A710095035007FCB95 /* player.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -115,12 +115,12 @@ void DeviceManager::add(GamePadDevice* d)
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
bool DeviceManager::mapInputToPlayerAndAction( Input::InputType type, int deviceID, int btnID, int axisDir, int value,
|
||||
const bool programaticallyGenerated, int* player /* out */,
|
||||
const bool programaticallyGenerated, ActivePlayer** player /* out */,
|
||||
PlayerAction* action /* out */ )
|
||||
{
|
||||
if(m_assign_mode == NO_ASSIGN)
|
||||
{
|
||||
*player = -1;
|
||||
*player = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -142,48 +142,40 @@ bool DeviceManager::mapInputToPlayerAndAction( Input::InputType type, int device
|
||||
else
|
||||
{
|
||||
// In assign mode, find to which active player this binding belongs
|
||||
// FIXME : in order to speed this use, a Player* pointer could be
|
||||
// stored inside the device so we don't need to iterate through players
|
||||
const ptr_vector<ActivePlayer, HOLD>& players = StateManager::getActivePlayers();
|
||||
const int playerAmount = players.size();
|
||||
for(int p=0; p<playerAmount; p++)
|
||||
if (m_keyboards[n].m_player != NULL)
|
||||
{
|
||||
if(players[p].getDevice() == m_keyboards.get(n))
|
||||
{
|
||||
// we found which active player has this binding
|
||||
*player = n;
|
||||
|
||||
if (m_assign_mode == DETECT_NEW && *action == PA_RESCUE)
|
||||
{
|
||||
if (value > Input::MAX_VALUE/2) StateManager::playerPressedRescue( *player );
|
||||
*action = PA_FIRST; // FIXME : returning PA_FIRST is quite a hackish way to tell input was handled internally
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // end for player
|
||||
|
||||
// no active player has this binding. if we want to check for new players trying to join,
|
||||
// check now
|
||||
if (m_assign_mode == DETECT_NEW)
|
||||
{
|
||||
for(unsigned int n=0; n<m_keyboard_amount; n++)
|
||||
{
|
||||
PlayerAction localaction = PA_FIRST; // none
|
||||
if (m_keyboards[n].hasBinding(btnID, &localaction))
|
||||
{
|
||||
if(localaction == PA_FIRE)
|
||||
{
|
||||
if (value > Input::MAX_VALUE/2) StateManager::firePressedOnNewDevice( m_keyboards.get(n) );
|
||||
}
|
||||
*player = m_keyboards[n].m_player;
|
||||
|
||||
*action = PA_FIRST; // FIXME : returning PA_FIRST is quite a hackish way to tell input was handled internally
|
||||
return true;
|
||||
}
|
||||
} // end for
|
||||
if (m_assign_mode == DETECT_NEW && *action == PA_RESCUE)
|
||||
{
|
||||
if (value > Input::MAX_VALUE/2) StateManager::playerPressedRescue( *player );
|
||||
*action = PA_FIRST; // FIXME : returning PA_FIRST is quite a hackish way to tell input was handled internally
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no active player has this binding. if we want to check for new players trying to join,
|
||||
// check now
|
||||
if (m_assign_mode == DETECT_NEW)
|
||||
{
|
||||
for(unsigned int n=0; n<m_keyboard_amount; n++)
|
||||
{
|
||||
PlayerAction localaction = PA_FIRST; // none
|
||||
if (m_keyboards[n].hasBinding(btnID, &localaction))
|
||||
{
|
||||
if(localaction == PA_FIRE)
|
||||
{
|
||||
if (value > Input::MAX_VALUE/2) StateManager::firePressedOnNewDevice( m_keyboards.get(n) );
|
||||
}
|
||||
|
||||
*action = PA_FIRST; // FIXME : returning PA_FIRST is quite a hackish way to tell input was handled internally
|
||||
return true;
|
||||
}
|
||||
} // end for
|
||||
|
||||
} // end if assign_mode == DETECT_NEW
|
||||
} // end if assign_mode == DETECT_NEW
|
||||
}
|
||||
|
||||
return false;
|
||||
} // end if/else NO_ASSIGN mode
|
||||
@ -220,9 +212,9 @@ bool DeviceManager::mapInputToPlayerAndAction( Input::InputType type, int device
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gamepad->m_player_id != -1)
|
||||
if(gamepad->m_player != NULL)
|
||||
{
|
||||
*player = gamepad->m_player_id;
|
||||
*player = gamepad->m_player;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -234,7 +226,7 @@ bool DeviceManager::mapInputToPlayerAndAction( Input::InputType type, int device
|
||||
for(unsigned int n=0; n<m_gamepad_amount; n++)
|
||||
{
|
||||
PlayerAction localaction = PA_FIRST; // none
|
||||
if (m_gamepads[n].hasBinding(type, btnID, value, -1, &localaction) && localaction == PA_FIRE)
|
||||
if (m_gamepads[n].hasBinding(type, btnID, value, NULL, &localaction) && localaction == PA_FIRE)
|
||||
{
|
||||
if (value > Input::MAX_VALUE/2) StateManager::firePressedOnNewDevice( m_gamepads.get(n) );
|
||||
*action = PA_FIRST;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
maps this input to the corresponding player and game action. returns false if player/action could not be set.
|
||||
Special case : can return true but set action to PA_FIRST if the input was used but is not associated to an action and a player */
|
||||
bool mapInputToPlayerAndAction( Input::InputType type, int id0, int id1, int id2, int value, const bool programaticallyGenerated,
|
||||
int* player /* out */, PlayerAction* action /* out */ );
|
||||
ActivePlayer** player /* out */, PlayerAction* action /* out */ );
|
||||
|
||||
void serialize();
|
||||
bool deserialize();
|
||||
|
@ -13,7 +13,7 @@ InputDevice::InputDevice()
|
||||
m_default_bindings[n].type = Input::IT_NONE;
|
||||
m_default_bindings[n].dir = Input::AD_NEUTRAL;
|
||||
}
|
||||
m_player_id = -1;
|
||||
m_player = NULL;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
@ -21,23 +21,7 @@ InputDevice::InputDevice()
|
||||
*/
|
||||
void InputDevice::setPlayer(ActivePlayer* owner)
|
||||
{
|
||||
if(owner == NULL)
|
||||
{
|
||||
m_player_id = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
const ptr_vector<ActivePlayer, HOLD>& players = StateManager::getActivePlayers();
|
||||
const int playerAmount = players.size();
|
||||
for(int n=0; n<playerAmount; n++)
|
||||
{
|
||||
if(players.getConst(n) == owner)
|
||||
{
|
||||
m_player_id = n;
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::cerr << "\n\nError, trying to assign a player that doesn't exist to a device!!!\n\n";
|
||||
m_player = owner;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void InputDevice::serialize(std::ofstream& stream)
|
||||
@ -303,15 +287,22 @@ void GamePadDevice::editBinding(const PlayerAction action, const Input::InputTyp
|
||||
m_default_bindings[action].dir = direction;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void GamePadDevice::resetAxisDirection(const int axis, Input::AxisDirection direction, const int player)
|
||||
void GamePadDevice::resetAxisDirection(const int axis, Input::AxisDirection direction, ActivePlayer* player)
|
||||
{
|
||||
if(!StateManager::isGameState()) return; // ignore this while in menus
|
||||
|
||||
PlayerKart* pk = player->getKart();
|
||||
if (pk == NULL)
|
||||
{
|
||||
std::cerr << "Error, trying to reset axis for an unknown player\n";
|
||||
return;
|
||||
}
|
||||
|
||||
for(int n=0; n<PA_COUNT; n++)
|
||||
{
|
||||
if(m_default_bindings[n].id == axis && m_default_bindings[n].dir == direction)
|
||||
{
|
||||
RaceManager::getWorld()->getLocalPlayerKart(player)->action((PlayerAction)n, 0);
|
||||
pk->action((PlayerAction)n, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -321,7 +312,7 @@ void GamePadDevice::resetAxisDirection(const int axis, Input::AxisDirection dire
|
||||
* Player ID can either be a player ID or -1. If -1, the method only returns whether a binding exists for this player.
|
||||
* If it's a player name, it also handles axis resets, direction changes, etc.
|
||||
*/
|
||||
bool GamePadDevice::hasBinding(Input::InputType type, const int id, const int value, const int player, PlayerAction* action /* out */)
|
||||
bool GamePadDevice::hasBinding(Input::InputType type, const int id, const int value, ActivePlayer* player, PlayerAction* action /* out */)
|
||||
{
|
||||
if(m_prevAxisDirections == NULL) return false; // device not open
|
||||
|
||||
@ -329,7 +320,7 @@ bool GamePadDevice::hasBinding(Input::InputType type, const int id, const int va
|
||||
{
|
||||
if(id >= m_axis_count) return false; // this gamepad doesn't even have that many axes
|
||||
|
||||
if (player != -1)
|
||||
if (player != NULL)
|
||||
{
|
||||
// going to negative from positive
|
||||
if (value < 0 && m_prevAxisDirections[id] == Input::AD_POSITIVE)
|
||||
@ -349,7 +340,7 @@ bool GamePadDevice::hasBinding(Input::InputType type, const int id, const int va
|
||||
else if(value < 0) m_prevAxisDirections[id] = Input::AD_NEGATIVE;
|
||||
|
||||
// check if within deadzone
|
||||
if(value > -m_deadzone && value < m_deadzone && player != -1)
|
||||
if(value > -m_deadzone && value < m_deadzone && player != NULL)
|
||||
{
|
||||
// Axis stands still: This is reported once for digital axes and
|
||||
// can be called multipled times for analog ones. Uses the
|
||||
|
@ -32,7 +32,7 @@ protected:
|
||||
DeviceType m_type;
|
||||
KeyBinding m_default_bindings[PA_COUNT];
|
||||
|
||||
int m_player_id;
|
||||
ActivePlayer* m_player;
|
||||
|
||||
public:
|
||||
std::string m_name; // if device has a name; unused for keyboards since AFAIK we can't tell keyboards apart
|
||||
@ -68,7 +68,7 @@ public:
|
||||
|
||||
class GamePadDevice : public InputDevice
|
||||
{
|
||||
void resetAxisDirection(const int axis, Input::AxisDirection direction, const int player);
|
||||
void resetAxisDirection(const int axis, Input::AxisDirection direction, ActivePlayer* player);
|
||||
bool m_buttonPressed[SEvent::SJoystickEvent::NUMBER_OF_BUTTONS];
|
||||
public:
|
||||
int m_deadzone;
|
||||
@ -79,7 +79,7 @@ public:
|
||||
|
||||
/** checks if this key belongs to this belongs. if yes, sets action and returns true; otherwise returns false.
|
||||
The 'player' id passed is simply to know where to send 'axis reset's when necessary*/
|
||||
bool hasBinding(Input::InputType type, const int id, const int value, const int player, PlayerAction* action /* out */);
|
||||
bool hasBinding(Input::InputType type, const int id, const int value, ActivePlayer* player, PlayerAction* action /* out */);
|
||||
|
||||
void editBinding(const PlayerAction action, const Input::InputType type, const int id,
|
||||
Input::AxisDirection direction=Input::AD_NEUTRAL);
|
||||
|
@ -251,7 +251,7 @@ void InputManager::inputSensing(Input::InputType type, int deviceID, int btnID,
|
||||
void InputManager::input(Input::InputType type, int deviceID, int btnID, int axisDirection, int value,
|
||||
const bool programaticallyGenerated)
|
||||
{
|
||||
int player;
|
||||
ActivePlayer* player = NULL;
|
||||
PlayerAction action;
|
||||
|
||||
bool action_found = m_device_manager->mapInputToPlayerAndAction( type, deviceID, btnID, axisDirection,
|
||||
@ -293,7 +293,16 @@ void InputManager::input(Input::InputType type, int deviceID, int btnID, int axi
|
||||
// ... when in-game
|
||||
if(StateManager::isGameState())
|
||||
{
|
||||
RaceManager::getWorld()->getLocalPlayerKart(player)->action(action, abs(value));
|
||||
// Find the corresponding PlayerKart from our ActivePlayer instance
|
||||
PlayerKart* pk = player->getKart();
|
||||
|
||||
if (pk == NULL)
|
||||
{
|
||||
std::cerr << "Error, trying to process action for an unknown player\n";
|
||||
return;
|
||||
}
|
||||
|
||||
pk->action(action, abs(value));
|
||||
}
|
||||
// ... when in menus
|
||||
else
|
||||
|
@ -116,9 +116,13 @@ void KartPropertiesManager::loadKartData(bool dont_load_models)
|
||||
//-----------------------------------------------------------------------------
|
||||
const int KartPropertiesManager::getKartId(const std::string &ident) const
|
||||
{
|
||||
std::cout << "======\n";
|
||||
std::cout << "Searching for kart " << ident.c_str() << std::endl;
|
||||
|
||||
for(KartPropertiesVector::const_iterator i = m_karts_properties.begin();
|
||||
i != m_karts_properties.end(); ++i)
|
||||
{
|
||||
std::cout << " -- " << (*i)->getIdent().c_str() << std::endl;
|
||||
if ((*i)->getIdent() == ident)
|
||||
return i-m_karts_properties.begin();
|
||||
}
|
||||
@ -264,7 +268,7 @@ std::vector<std::string> KartPropertiesManager::getRandomKartList(int count,
|
||||
// -----------------------------------------
|
||||
std::vector<bool> used;
|
||||
used.resize(getNumberOfKarts(), false);
|
||||
|
||||
|
||||
std::vector<std::string> all_karts;
|
||||
for(unsigned int i=0; i<existing_karts.size(); i++)
|
||||
{
|
||||
|
@ -120,6 +120,7 @@ void World::init()
|
||||
switch(race_manager->getKartType(i))
|
||||
{
|
||||
case RaceManager::KT_PLAYER:
|
||||
std::cout << "===== World : creating player kart for #" << i << "===========\n";
|
||||
newkart = new PlayerKart(kart_name, position,
|
||||
&(UserConfigParams::m_player[local_player_id]),
|
||||
init_pos, local_player_id);
|
||||
@ -133,6 +134,8 @@ void World::init()
|
||||
m_player_karts[global_player_id] = (PlayerKart*)newkart;
|
||||
break;
|
||||
case RaceManager::KT_AI:
|
||||
std::cout << "===== World : creating AI kart for #" << i << "===========\n";
|
||||
|
||||
newkart = loadRobot(kart_name, position, init_pos);
|
||||
break;
|
||||
case RaceManager::KT_GHOST:
|
||||
|
Loading…
x
Reference in New Issue
Block a user