Bug #796 more fixes for changing controls

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5274 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 061ed046c5031c3e8fb96571cc0e515f9bc18a95
Former-commit-id: 8ceaa30795263cebe6e6d1be8b223d9820e90179
This commit is contained in:
mungewell 2013-03-08 05:24:34 +00:00
parent b359091140
commit 24dc38e16b
2 changed files with 29 additions and 7 deletions

View file

@ -603,8 +603,28 @@ newrace(int index, tCarElt* car, tSituation *s)
void
resumerace(int index, tCarElt* car, tSituation *s)
{
const int idx = index - 1;
tControlCmd *cmd = HCtx[idx]->cmdControl;
// re-read the controls as they may have changed
HmReadPrefs(index);
// Setup Keyboard map (key code => index of the associated command in keyInfo / lastReadKeyState).
keyIndex = 0;
mapKeys.clear();
for (int i = 0; i < NbCmdControl; i++)
{
if (cmd[i].type == GFCTRL_TYPE_KEYBOARD)
{
if (mapKeys.find(cmd[i].val) == mapKeys.end())
{
mapKeys[cmd[i].val] = keyIndex;
keyIndex++;
}
}//KEYBOARD
}//for i
}
static int

View file

@ -610,10 +610,17 @@ ControlMenuInit(void *prevMenu, void *prefHdle, unsigned index, tGearChangeMode
{
int i;
/* Don't recreate screen if already done */
if (ScrHandle) {
if (PrevScrHandle != prevMenu)
// Need to re-create screen as parent has changed
GfuiScreenRelease(ScrHandle);
else
return ScrHandle;
}
ReloadValues = 1;
PrevScrHandle = prevMenu;
PrefHdle = prefHdle;
SaveOnExit = saveOnExit;
@ -623,11 +630,6 @@ ControlMenuInit(void *prevMenu, void *prefHdle, unsigned index, tGearChangeMode
/* Set specified gear changing mode for current player */
GearChangeMode = gearChangeMode;
/* Don't recreate screen if already done */
if (ScrHandle) {
return ScrHandle;
}
/* Initialize joysticks array */
for (int jsInd = 0; jsInd < GFCTRL_JOY_NUMBER; jsInd++)
Joystick[jsInd] = 0;