From 8817d8c2fee8d6853ac861b50a8ea2a29568702d Mon Sep 17 00:00:00 2001 From: mungewell Date: Fri, 1 Feb 2013 06:20:47 +0000 Subject: [PATCH] Bug #532 Only use driver preference when not spanning splits ie. Stop mirror and map settings being duplicated on all split screens git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5112 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 45fce945cf5a3d9e4de7ad246f3d9550bcd28c2d Former-commit-id: 156bea5de40082453063bd4d482bcb60797693a6 --- src/modules/graphic/ssggraph/grboard.cpp | 5 ++++- src/modules/graphic/ssggraph/grscreen.cpp | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/modules/graphic/ssggraph/grboard.cpp b/src/modules/graphic/ssggraph/grboard.cpp index c1bb72711..da6b8fca9 100644 --- a/src/modules/graphic/ssggraph/grboard.cpp +++ b/src/modules/graphic/ssggraph/grboard.cpp @@ -92,6 +92,7 @@ cGrBoard::loadDefaults(const tCarElt *curCar) char path[1024]; snprintf(path, sizeof(path), "%s%s", GfLocalDir(), GR_PARAM_FILE); void *hdle = GfParmReadFile(path, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT); + const char *pszSpanSplit; ReadDashColor(hdle, GFSCR_ELT_NORMALCLR, &normal_color_); ReadDashColor(hdle, GFSCR_ELT_DANGERCLR, &danger_color_); @@ -122,7 +123,9 @@ cGrBoard::loadDefaults(const tCarElt *curCar) trackMap->setViewMode((int)GfParmGetNum(grHandle, path, GR_ATT_MAP, NULL, trackMap->getDefaultViewMode())); - if (curCar->_driverType == RM_DRV_HUMAN) { + // Only apply driver preferences when not spanning split screens + pszSpanSplit = GfParmGetStr(grHandle, GR_SCT_MONITOR, GR_ATT_SPANSPLIT, GR_VAL_NO); + if (strcmp(pszSpanSplit, GR_VAL_YES) && curCar->_driverType == RM_DRV_HUMAN) { snprintf(path, sizeof(path), "%s/%s", GR_SCT_DISPMODE, curCar->_name); debugFlag = (int)GfParmGetNum(grHandle, path, GR_ATT_DEBUG, NULL, debugFlag); boardFlag = (int)GfParmGetNum(grHandle, path, GR_ATT_BOARD, NULL, boardFlag); diff --git a/src/modules/graphic/ssggraph/grscreen.cpp b/src/modules/graphic/ssggraph/grscreen.cpp index 2b3170717..7ba3a493c 100644 --- a/src/modules/graphic/ssggraph/grscreen.cpp +++ b/src/modules/graphic/ssggraph/grscreen.cpp @@ -156,6 +156,7 @@ void cGrScreen::selectTrackMap() sprintf(path, "%s/%d", GR_SCT_DISPMODE, id); GfParmSetNum(grHandle, path, GR_ATT_MAP, NULL, (tdble)viewmode); + /* save also as user's preference if human */ if (curCar->_driverType == RM_DRV_HUMAN) { sprintf(path2, "%s/%s", GR_SCT_DISPMODE, curCar->_name); @@ -169,6 +170,7 @@ void cGrScreen::switchMirror(void) mirrorFlag = 1 - mirrorFlag; sprintf(path, "%s/%d", GR_SCT_DISPMODE, id); GfParmSetNum(grHandle, path, GR_ATT_MIRROR, NULL, (tdble)mirrorFlag); + /* save also as user's preference if human */ if (curCar->_driverType == RM_DRV_HUMAN) { sprintf(path2, "%s/%s", GR_SCT_DISPMODE, curCar->_name); @@ -451,6 +453,7 @@ void cGrScreen::loadParams(tSituation *s) int i; class cGrCamera *cam; const char *carName; + const char *pszSpanSplit; // Initialize the screen "current car" if not already done. sprintf(path, "%s/%d", GR_SCT_DISPMODE, id); @@ -482,13 +485,18 @@ void cGrScreen::loadParams(tSituation *s) } // Load "current camera" settings (attached to the "current car"). - sprintf(path2, "%s/%s", GR_SCT_DISPMODE, curCar->_name); curCamHead = (int)GfParmGetNum(grHandle, path, GR_ATT_CAM_HEAD, NULL, 9); camNum = (int)GfParmGetNum(grHandle, path, GR_ATT_CAM, NULL, 0); mirrorFlag = (int)GfParmGetNum(grHandle, path, GR_ATT_MIRROR, NULL, (tdble)mirrorFlag); - curCamHead = (int)GfParmGetNum(grHandle, path2, GR_ATT_CAM_HEAD, NULL, (tdble)curCamHead); - camNum = (int)GfParmGetNum(grHandle, path2, GR_ATT_CAM, NULL, (tdble)camNum); - mirrorFlag = (int)GfParmGetNum(grHandle, path2, GR_ATT_MIRROR, NULL, (tdble)mirrorFlag); + + // Only apply driver preferences when not spanning split screens + pszSpanSplit = GfParmGetStr(grHandle, GR_SCT_MONITOR, GR_ATT_SPANSPLIT, GR_VAL_NO); + if (strcmp(pszSpanSplit, GR_VAL_YES)) { + sprintf(path2, "%s/%s", GR_SCT_DISPMODE, curCar->_name); + curCamHead = (int)GfParmGetNum(grHandle, path2, GR_ATT_CAM_HEAD, NULL, (tdble)curCamHead); + camNum = (int)GfParmGetNum(grHandle, path2, GR_ATT_CAM, NULL, (tdble)camNum); + mirrorFlag = (int)GfParmGetNum(grHandle, path2, GR_ATT_MIRROR, NULL, (tdble)mirrorFlag); + } // Get board width (needed for scissor) boardWidth = (int)GfParmGetNum(grHandle, path, GR_ATT_BOARDWIDTH, NULL, 100);