Layout changes only (to be in STK coding style).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2217 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
796b0b9848
commit
82d817a7ec
@ -69,7 +69,7 @@ UserConfig::UserConfig(const std::string& filename)
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
UserConfig::~UserConfig()
|
UserConfig::~UserConfig()
|
||||||
{
|
{
|
||||||
}
|
} // ~UserConfig
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
@ -520,8 +520,7 @@ void UserConfig::loadConfig(const std::string& filename)
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void
|
void UserConfig::readStickConfigs(const lisp::Lisp *r)
|
||||||
UserConfig::readStickConfigs(const lisp::Lisp *r)
|
|
||||||
{
|
{
|
||||||
string temp;
|
string temp;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -552,19 +551,17 @@ UserConfig::readStickConfigs(const lisp::Lisp *r)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // readStickConfigs
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::readPlayerInput(const lisp::Lisp *r, const char *node,
|
||||||
UserConfig::readPlayerInput(const lisp::Lisp *r, const char *node,
|
|
||||||
KartAction ka, int playerIndex)
|
KartAction ka, int playerIndex)
|
||||||
{
|
{
|
||||||
readInput(r, node, (GameAction) (playerIndex * KC_COUNT + ka + GA_P1_LEFT));
|
readInput(r, node, (GameAction) (playerIndex * KC_COUNT + ka + GA_P1_LEFT));
|
||||||
}
|
} // readPlayerInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::readInput(const lisp::Lisp* r, const char *node,
|
||||||
UserConfig::readInput(const lisp::Lisp* r,
|
|
||||||
const char *node,
|
|
||||||
GameAction action)
|
GameAction action)
|
||||||
{
|
{
|
||||||
string inputTypeName;
|
string inputTypeName;
|
||||||
@ -623,7 +620,7 @@ UserConfig::readInput(const lisp::Lisp* r,
|
|||||||
setInput(action, input);
|
setInput(action, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // readInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/** Call saveConfig with the default filename for this platform. */
|
/** Call saveConfig with the default filename for this platform. */
|
||||||
@ -744,8 +741,7 @@ void UserConfig::saveConfig(const std::string& filename)
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void
|
void UserConfig::writeStickConfigs(lisp::Writer *writer)
|
||||||
UserConfig::writeStickConfigs(lisp::Writer *writer)
|
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
string temp;
|
string temp;
|
||||||
@ -772,19 +768,17 @@ UserConfig::writeStickConfigs(lisp::Writer *writer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
writer->endList("stick-configs");
|
writer->endList("stick-configs");
|
||||||
}
|
} // writeStickConfigs
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::writePlayerInput(lisp::Writer *writer, const char *node,
|
||||||
UserConfig::writePlayerInput(lisp::Writer *writer, const char *node,
|
|
||||||
KartAction ka, int playerIndex)
|
KartAction ka, int playerIndex)
|
||||||
{
|
{
|
||||||
writeInput(writer, node, (GameAction) (playerIndex * KC_COUNT + ka + GA_P1_LEFT));
|
writeInput(writer, node, (GameAction) (playerIndex * KC_COUNT + ka + GA_P1_LEFT));
|
||||||
}
|
} // writePlayerInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::writeInput(lisp::Writer *writer, const char *node,
|
||||||
UserConfig::writeInput(lisp::Writer *writer,
|
|
||||||
const char *node,
|
|
||||||
GameAction action)
|
GameAction action)
|
||||||
{
|
{
|
||||||
writer->beginList(node);
|
writer->beginList(node);
|
||||||
@ -836,7 +830,8 @@ UserConfig::writeInput(lisp::Writer *writer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
writer->endList(node);
|
writer->endList(node);
|
||||||
}
|
} // writeInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
std::string UserConfig::getInputAsString(Input &input)
|
std::string UserConfig::getInputAsString(Input &input)
|
||||||
{
|
{
|
||||||
@ -878,11 +873,10 @@ std::string UserConfig::getInputAsString(Input &input)
|
|||||||
} // GetKeyAsString
|
} // GetKeyAsString
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
string
|
string UserConfig::getMappingAsString(GameAction ga)
|
||||||
UserConfig::getMappingAsString(GameAction ga)
|
|
||||||
{
|
{
|
||||||
if (inputMap[ga].count
|
if (inputMap[ga].count &&
|
||||||
&& inputMap[ga].inputs[0].type)
|
inputMap[ga].inputs[0].type)
|
||||||
{
|
{
|
||||||
stringstream s;
|
stringstream s;
|
||||||
s << getInputAsString(inputMap[ga].inputs[0]);
|
s << getInputAsString(inputMap[ga].inputs[0]);
|
||||||
@ -893,18 +887,17 @@ UserConfig::getMappingAsString(GameAction ga)
|
|||||||
{
|
{
|
||||||
return string(_("not set"));
|
return string(_("not set"));
|
||||||
}
|
}
|
||||||
}
|
} // getMappingAsString
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
string
|
string UserConfig::getMappingAsString(int playerIndex, KartAction ka)
|
||||||
UserConfig::getMappingAsString(int playerIndex, KartAction ka)
|
|
||||||
{
|
{
|
||||||
return getMappingAsString((GameAction) (GA_FIRST_KARTACTION
|
return getMappingAsString((GameAction) (GA_FIRST_KARTACTION
|
||||||
+ playerIndex * KC_COUNT + ka) );
|
+ playerIndex * KC_COUNT + ka) );
|
||||||
}
|
} // getMappingAsString
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void
|
// -----------------------------------------------------------------------------
|
||||||
UserConfig::unsetDuplicates (GameAction ga, Input &i)
|
void UserConfig::unsetDuplicates(GameAction ga, Input &i)
|
||||||
{
|
{
|
||||||
for (int cga = GA_FIRST_KARTACTION; cga <= GA_LAST_KARTACTION; cga++)
|
for (int cga = GA_FIRST_KARTACTION; cga <= GA_LAST_KARTACTION; cga++)
|
||||||
{
|
{
|
||||||
@ -924,37 +917,34 @@ UserConfig::unsetDuplicates (GameAction ga, Input &i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // unsetDuplicates
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::set(GameAction ga, Input i)
|
||||||
UserConfig::set(GameAction ga, Input i)
|
|
||||||
{
|
{
|
||||||
inputMap[ga].count = 1;
|
inputMap[ga].count = 1;
|
||||||
inputMap[ga].inputs = new Input[1];
|
inputMap[ga].inputs = new Input[1];
|
||||||
inputMap[ga].inputs[0] = i;
|
inputMap[ga].inputs[0] = i;
|
||||||
}
|
} // set(1 input)
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::set(GameAction ga, Input i0, Input i1)
|
||||||
UserConfig::set(GameAction ga, Input i0, Input i1)
|
|
||||||
{
|
{
|
||||||
inputMap[ga].count = 2;
|
inputMap[ga].count = 2;
|
||||||
inputMap[ga].inputs = new Input[2];
|
inputMap[ga].inputs = new Input[2];
|
||||||
inputMap[ga].inputs[0] = i0;
|
inputMap[ga].inputs[0] = i0;
|
||||||
inputMap[ga].inputs[1] = i1;
|
inputMap[ga].inputs[1] = i1;
|
||||||
}
|
} // set(2 inputs)
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::set(GameAction ga, Input i0, Input i1, Input i2)
|
||||||
UserConfig::set(GameAction ga, Input i0, Input i1, Input i2)
|
|
||||||
{
|
{
|
||||||
inputMap[ga].count = 3;
|
inputMap[ga].count = 3;
|
||||||
inputMap[ga].inputs = new Input[3];
|
inputMap[ga].inputs = new Input[3];
|
||||||
inputMap[ga].inputs[0] = i0;
|
inputMap[ga].inputs[0] = i0;
|
||||||
inputMap[ga].inputs[1] = i1;
|
inputMap[ga].inputs[1] = i1;
|
||||||
inputMap[ga].inputs[2] = i2;
|
inputMap[ga].inputs[2] = i2;
|
||||||
}
|
} //set(3 inputs)
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::set(GameAction ga, Input i0, Input i1, Input i2, Input i3)
|
||||||
UserConfig::set(GameAction ga, Input i0, Input i1, Input i2, Input i3)
|
|
||||||
{
|
{
|
||||||
inputMap[ga].count = 4;
|
inputMap[ga].count = 4;
|
||||||
inputMap[ga].inputs = new Input[4];
|
inputMap[ga].inputs = new Input[4];
|
||||||
@ -962,35 +952,34 @@ UserConfig::set(GameAction ga, Input i0, Input i1, Input i2, Input i3)
|
|||||||
inputMap[ga].inputs[1] = i1;
|
inputMap[ga].inputs[1] = i1;
|
||||||
inputMap[ga].inputs[2] = i2;
|
inputMap[ga].inputs[2] = i2;
|
||||||
inputMap[ga].inputs[3] = i3;
|
inputMap[ga].inputs[3] = i3;
|
||||||
}
|
} // set(4 inputs)
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::setInput(GameAction ga, Input &input)
|
||||||
UserConfig::setInput(GameAction ga, Input &input)
|
|
||||||
{
|
{
|
||||||
// Removes the input from all mappings where it occurs.
|
// Removes the input from all mappings where it occurs.
|
||||||
unsetDuplicates(ga, input);
|
unsetDuplicates(ga, input);
|
||||||
|
|
||||||
set(ga, input);
|
set(ga, input);
|
||||||
}
|
} // setInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::setInput(int playerIndex, KartAction ka, Input &input)
|
||||||
UserConfig::setInput(int playerIndex, KartAction ka, Input &input)
|
|
||||||
{
|
{
|
||||||
setInput((GameAction) (GA_FIRST_KARTACTION
|
setInput((GameAction) (GA_FIRST_KARTACTION
|
||||||
+ playerIndex * KC_COUNT + ka),
|
+ playerIndex * KC_COUNT + ka),
|
||||||
input);
|
input);
|
||||||
}
|
} // setInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void
|
void UserConfig::clearInput(int playerIndex, KartAction ka)
|
||||||
UserConfig::clearInput(int playerIndex, KartAction ka)
|
|
||||||
{
|
{
|
||||||
inputMap[(GameAction) (GA_FIRST_KARTACTION + playerIndex * KC_COUNT + ka)]
|
inputMap[(GameAction) (GA_FIRST_KARTACTION + playerIndex * KC_COUNT + ka)]
|
||||||
.count = 0;
|
.count = 0;
|
||||||
}
|
} // clearInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
ActionMap *
|
ActionMap *UserConfig::newActionMap(const int from, const int to)
|
||||||
UserConfig::newActionMap(const int from, const int to)
|
|
||||||
{
|
{
|
||||||
ActionMap *am = new ActionMap();
|
ActionMap *am = new ActionMap();
|
||||||
|
|
||||||
@ -1002,16 +991,16 @@ UserConfig::newActionMap(const int from, const int to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return am;
|
return am;
|
||||||
}
|
} // newActionMap
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
ActionMap *
|
ActionMap *UserConfig::newMenuActionMap()
|
||||||
UserConfig::newMenuActionMap()
|
|
||||||
{
|
{
|
||||||
return newActionMap(GA_FIRST_MENU, GA_LAST_MENU);
|
return newActionMap(GA_FIRST_MENU, GA_LAST_MENU);
|
||||||
}
|
} // newMenuActionMap
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
ActionMap *
|
ActionMap *UserConfig::newIngameActionMap()
|
||||||
UserConfig::newIngameActionMap()
|
|
||||||
{
|
{
|
||||||
// This is rather unfriendly hack but work quite effective:
|
// This is rather unfriendly hack but work quite effective:
|
||||||
// In order to prevent the input driver from handling input mappings
|
// In order to prevent the input driver from handling input mappings
|
||||||
@ -1048,14 +1037,14 @@ UserConfig::newIngameActionMap()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return am;
|
return am;
|
||||||
}
|
} // newIngameActionMap
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/** Determines whether the given Input is used in a mapping where it is marked
|
/** Determines whether the given Input is used in a mapping where it is marked
|
||||||
* as fixed. This allows the input driver to discard the mapping and not
|
* as fixed. This allows the input driver to discard the mapping and not
|
||||||
* allow the user to use it.
|
* allow the user to use it.
|
||||||
*/
|
*/
|
||||||
bool
|
bool UserConfig::isFixedInput(InputType type, int id0, int id1, int id2)
|
||||||
UserConfig::isFixedInput(InputType type, int id0, int id1, int id2)
|
|
||||||
{
|
{
|
||||||
for (int i = GA_FIRST_INGAME_FIXED; i <= GA_LAST_INGAME_FIXED; i++)
|
for (int i = GA_FIRST_INGAME_FIXED; i <= GA_LAST_INGAME_FIXED; i++)
|
||||||
{
|
{
|
||||||
@ -1069,22 +1058,20 @@ UserConfig::isFixedInput(InputType type, int id0, int id1, int id2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} // isFixedInput
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
void UserConfig::addStickConfig(StickConfig *sc)
|
||||||
void
|
|
||||||
UserConfig::addStickConfig(StickConfig *sc)
|
|
||||||
{
|
{
|
||||||
m_stickconfigs.push_back(sc);
|
m_stickconfigs.push_back(sc);
|
||||||
}
|
} // addStickConfig
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
const std::vector<UserConfig::StickConfig *> *
|
const std::vector<UserConfig::StickConfig *> *UserConfig::getStickConfigs() const
|
||||||
UserConfig::getStickConfigs() const
|
|
||||||
{
|
{
|
||||||
return &m_stickconfigs;
|
return &m_stickconfigs;
|
||||||
}
|
} // getStickConfigs
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
UserConfig::StickConfig::StickConfig(string &newId)
|
UserConfig::StickConfig::StickConfig(string &newId)
|
||||||
: id(newId)
|
: id(newId)
|
||||||
|
Loading…
Reference in New Issue
Block a user