From 64d5b6e80d78c876b304c71fc56337810c327e96 Mon Sep 17 00:00:00 2001 From: mungewell Date: Wed, 12 Jun 2013 05:03:08 +0000 Subject: [PATCH] Bug 828 - prevent continous write to graph.xml with F11 camera git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5510 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: e76307e440277db7dc49c0976747f19c486c5449 Former-commit-id: 2de098b5b478971b19e61b96c8a8f2727a433f81 --- src/modules/graphic/ssggraph/grcam.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/graphic/ssggraph/grcam.cpp b/src/modules/graphic/ssggraph/grcam.cpp index 4a9e898f2..d8132a755 100644 --- a/src/modules/graphic/ssggraph/grcam.cpp +++ b/src/modules/graphic/ssggraph/grcam.cpp @@ -1726,6 +1726,7 @@ class cGrCarCamRoadZoomTVD : public cGrCarCamRoadZoom double lastViewTime; tdble proximityThld; int current; + int curCar; public: cGrCarCamRoadZoomTVD(class cGrScreen *myscreen, int id, int drawCurr, int drawBG, @@ -1744,6 +1745,7 @@ class cGrCarCamRoadZoomTVD : public cGrCarCamRoadZoom lastEventTime = 0; lastViewTime = 0; + curCar = 0; current = -1; camChangeInterval = GfParmGetNum(grHandle, GR_SCT_TVDIR, GR_ATT_CHGCAMINT, (char*)NULL, 10.0); @@ -1755,7 +1757,7 @@ class cGrCarCamRoadZoomTVD : public cGrCarCamRoadZoom void update(tCarElt *car, tSituation *s) { int i, j; - int curCar; + int newCar; double curPrio; double deltaEventTime = s->currentTime - lastEventTime; double deltaViewTime = s->currentTime - lastViewTime; @@ -1847,17 +1849,17 @@ class cGrCarCamRoadZoomTVD : public cGrCarCamRoadZoom if ((event && (deltaEventTime > camEventInterval)) || (deltaViewTime > camChangeInterval)) { int last_current = current; - curCar = 0; + newCar = 0; curPrio = -1000000.0; for (i = 0; i < grNbCars; i++) { if ((schedView[i].prio > curPrio) && (schedView[i].viewable)) { curPrio = schedView[i].prio; - curCar = i; + newCar = i; } } for (i = 0; i < grNbCars; i++) { - if (s->cars[i]->index == curCar) { + if (s->cars[i]->index == newCar) { current = i; break; } @@ -1869,7 +1871,10 @@ class cGrCarCamRoadZoomTVD : public cGrCarCamRoadZoom } } - screen->setCurrentCar(s->cars[current]); + if (newCar != curCar) { + screen->setCurrentCar(s->cars[current]); + curCar = newCar; + } cGrCarCamRoadZoom::update(s->cars[current], s); }