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
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/**
|
||||
@ -520,8 +520,7 @@ void UserConfig::loadConfig(const std::string& filename)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
UserConfig::readStickConfigs(const lisp::Lisp *r)
|
||||
void UserConfig::readStickConfigs(const lisp::Lisp *r)
|
||||
{
|
||||
string temp;
|
||||
int count = 0;
|
||||
@ -552,19 +551,17 @@ UserConfig::readStickConfigs(const lisp::Lisp *r)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} // readStickConfigs
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::readPlayerInput(const lisp::Lisp *r, const char *node,
|
||||
void UserConfig::readPlayerInput(const lisp::Lisp *r, const char *node,
|
||||
KartAction ka, int playerIndex)
|
||||
{
|
||||
readInput(r, node, (GameAction) (playerIndex * KC_COUNT + ka + GA_P1_LEFT));
|
||||
}
|
||||
} // readPlayerInput
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::readInput(const lisp::Lisp* r,
|
||||
const char *node,
|
||||
void UserConfig::readInput(const lisp::Lisp* r, const char *node,
|
||||
GameAction action)
|
||||
{
|
||||
string inputTypeName;
|
||||
@ -623,7 +620,7 @@ UserConfig::readInput(const lisp::Lisp* r,
|
||||
setInput(action, input);
|
||||
}
|
||||
|
||||
}
|
||||
} // readInput
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Call saveConfig with the default filename for this platform. */
|
||||
@ -744,8 +741,7 @@ void UserConfig::saveConfig(const std::string& filename)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
UserConfig::writeStickConfigs(lisp::Writer *writer)
|
||||
void UserConfig::writeStickConfigs(lisp::Writer *writer)
|
||||
{
|
||||
int count = 0;
|
||||
string temp;
|
||||
@ -772,19 +768,17 @@ UserConfig::writeStickConfigs(lisp::Writer *writer)
|
||||
}
|
||||
|
||||
writer->endList("stick-configs");
|
||||
}
|
||||
} // writeStickConfigs
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::writePlayerInput(lisp::Writer *writer, const char *node,
|
||||
void UserConfig::writePlayerInput(lisp::Writer *writer, const char *node,
|
||||
KartAction ka, int playerIndex)
|
||||
{
|
||||
writeInput(writer, node, (GameAction) (playerIndex * KC_COUNT + ka + GA_P1_LEFT));
|
||||
}
|
||||
} // writePlayerInput
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::writeInput(lisp::Writer *writer,
|
||||
const char *node,
|
||||
void UserConfig::writeInput(lisp::Writer *writer, const char *node,
|
||||
GameAction action)
|
||||
{
|
||||
writer->beginList(node);
|
||||
@ -836,7 +830,8 @@ UserConfig::writeInput(lisp::Writer *writer,
|
||||
}
|
||||
|
||||
writer->endList(node);
|
||||
}
|
||||
} // writeInput
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
std::string UserConfig::getInputAsString(Input &input)
|
||||
{
|
||||
@ -878,11 +873,10 @@ std::string UserConfig::getInputAsString(Input &input)
|
||||
} // GetKeyAsString
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
string
|
||||
UserConfig::getMappingAsString(GameAction ga)
|
||||
string UserConfig::getMappingAsString(GameAction ga)
|
||||
{
|
||||
if (inputMap[ga].count
|
||||
&& inputMap[ga].inputs[0].type)
|
||||
if (inputMap[ga].count &&
|
||||
inputMap[ga].inputs[0].type)
|
||||
{
|
||||
stringstream s;
|
||||
s << getInputAsString(inputMap[ga].inputs[0]);
|
||||
@ -893,18 +887,17 @@ UserConfig::getMappingAsString(GameAction ga)
|
||||
{
|
||||
return string(_("not set"));
|
||||
}
|
||||
}
|
||||
} // getMappingAsString
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
string
|
||||
UserConfig::getMappingAsString(int playerIndex, KartAction ka)
|
||||
string UserConfig::getMappingAsString(int playerIndex, KartAction ka)
|
||||
{
|
||||
return getMappingAsString((GameAction) (GA_FIRST_KARTACTION
|
||||
+ 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++)
|
||||
{
|
||||
@ -924,37 +917,34 @@ UserConfig::unsetDuplicates (GameAction ga, Input &i)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // unsetDuplicates
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::set(GameAction ga, Input i)
|
||||
void UserConfig::set(GameAction ga, Input i)
|
||||
{
|
||||
inputMap[ga].count = 1;
|
||||
inputMap[ga].inputs = new Input[1];
|
||||
inputMap[ga].inputs[0] = i;
|
||||
}
|
||||
} // set(1 input)
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::set(GameAction ga, Input i0, Input i1)
|
||||
void UserConfig::set(GameAction ga, Input i0, Input i1)
|
||||
{
|
||||
inputMap[ga].count = 2;
|
||||
inputMap[ga].inputs = new Input[2];
|
||||
inputMap[ga].inputs[0] = i0;
|
||||
inputMap[ga].inputs[1] = i1;
|
||||
}
|
||||
} // set(2 inputs)
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::set(GameAction ga, Input i0, Input i1, Input i2)
|
||||
void UserConfig::set(GameAction ga, Input i0, Input i1, Input i2)
|
||||
{
|
||||
inputMap[ga].count = 3;
|
||||
inputMap[ga].inputs = new Input[3];
|
||||
inputMap[ga].inputs[0] = i0;
|
||||
inputMap[ga].inputs[1] = i1;
|
||||
inputMap[ga].inputs[2] = i2;
|
||||
}
|
||||
} //set(3 inputs)
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::set(GameAction ga, Input i0, Input i1, Input i2, Input i3)
|
||||
void UserConfig::set(GameAction ga, Input i0, Input i1, Input i2, Input i3)
|
||||
{
|
||||
inputMap[ga].count = 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[2] = i2;
|
||||
inputMap[ga].inputs[3] = i3;
|
||||
}
|
||||
} // set(4 inputs)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::setInput(GameAction ga, Input &input)
|
||||
void UserConfig::setInput(GameAction ga, Input &input)
|
||||
{
|
||||
// Removes the input from all mappings where it occurs.
|
||||
unsetDuplicates(ga, input);
|
||||
|
||||
set(ga, input);
|
||||
}
|
||||
} // setInput
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::setInput(int playerIndex, KartAction ka, Input &input)
|
||||
void UserConfig::setInput(int playerIndex, KartAction ka, Input &input)
|
||||
{
|
||||
setInput((GameAction) (GA_FIRST_KARTACTION
|
||||
+ playerIndex * KC_COUNT + ka),
|
||||
input);
|
||||
}
|
||||
} // setInput
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void
|
||||
UserConfig::clearInput(int playerIndex, KartAction ka)
|
||||
void UserConfig::clearInput(int playerIndex, KartAction ka)
|
||||
{
|
||||
inputMap[(GameAction) (GA_FIRST_KARTACTION + playerIndex * KC_COUNT + ka)]
|
||||
.count = 0;
|
||||
}
|
||||
} // clearInput
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
ActionMap *
|
||||
UserConfig::newActionMap(const int from, const int to)
|
||||
ActionMap *UserConfig::newActionMap(const int from, const int to)
|
||||
{
|
||||
ActionMap *am = new ActionMap();
|
||||
|
||||
@ -1002,16 +991,16 @@ UserConfig::newActionMap(const int from, const int to)
|
||||
}
|
||||
|
||||
return am;
|
||||
}
|
||||
} // newActionMap
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
ActionMap *
|
||||
UserConfig::newMenuActionMap()
|
||||
ActionMap *UserConfig::newMenuActionMap()
|
||||
{
|
||||
return newActionMap(GA_FIRST_MENU, GA_LAST_MENU);
|
||||
}
|
||||
} // newMenuActionMap
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
ActionMap *
|
||||
UserConfig::newIngameActionMap()
|
||||
ActionMap *UserConfig::newIngameActionMap()
|
||||
{
|
||||
// This is rather unfriendly hack but work quite effective:
|
||||
// In order to prevent the input driver from handling input mappings
|
||||
@ -1048,14 +1037,14 @@ UserConfig::newIngameActionMap()
|
||||
}
|
||||
|
||||
return am;
|
||||
}
|
||||
} // newIngameActionMap
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** 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
|
||||
* allow the user to use it.
|
||||
*/
|
||||
bool
|
||||
UserConfig::isFixedInput(InputType type, int id0, int id1, int id2)
|
||||
bool UserConfig::isFixedInput(InputType type, int id0, int id1, int id2)
|
||||
{
|
||||
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;
|
||||
}
|
||||
} // isFixedInput
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
UserConfig::addStickConfig(StickConfig *sc)
|
||||
void UserConfig::addStickConfig(StickConfig *sc)
|
||||
{
|
||||
m_stickconfigs.push_back(sc);
|
||||
}
|
||||
} // addStickConfig
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
const std::vector<UserConfig::StickConfig *> *
|
||||
UserConfig::getStickConfigs() const
|
||||
const std::vector<UserConfig::StickConfig *> *UserConfig::getStickConfigs() const
|
||||
{
|
||||
return &m_stickconfigs;
|
||||
}
|
||||
} // getStickConfigs
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
UserConfig::StickConfig::StickConfig(string &newId)
|
||||
: id(newId)
|
||||
|
Loading…
Reference in New Issue
Block a user