Revision: 2643
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2643&view=rev
Author: ulteq
Date: 2012-05-24 00:47:48 +0000 (Thu, 24 May 2012)
Log Message:
-----------
-Fix: fixes interference between speed limiter and cruise control (#2635)
Modified Paths:
--------------
trunk/source/main/gameplay/RoRFrameListener.cpp
trunk/source/main/gui/SelectorWindow.cpp
trunk/source/main/physics/Beam.cpp
trunk/source/main/physics/BeamData.h
trunk/source/main/physics/input_output/SerializedRig.cpp
Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp 2012-05-23 23:23:34 UTC
(rev 2642)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp 2012-05-24 00:47:48 UTC
(rev 2643)
@@ -1175,7 +1175,6 @@
{
#ifdef USE_MYGUI
// show truck selector
-
SelectorWindow::getSingleton().setEnableCancel(false);
if (w)
{
hideMap();
@@ -1188,6 +1187,7 @@
#endif // USE_MYGUI
} else
{
+ // init no trucks
initTrucks(false, preselected_map);
}
} else if (!preselected_truck.empty() && preselected_truck !=
"none")
@@ -1202,7 +1202,6 @@
// show terrain selector
hideMap();
SelectorWindow::getSingleton().show(SelectorWindow::LT_Terrain);
- SelectorWindow::getSingleton().setEnableCancel(false);
#endif // USE_MYGUI
}
@@ -1859,7 +1858,10 @@
{
curr_truck->cc_target_speed += 5.0f * dt;
curr_truck->cc_target_speed =
std::max(curr_truck->cc_target_speed_lower_limit, curr_truck->cc_target_speed);
- curr_truck->cc_target_speed =
std::min(curr_truck->cc_target_speed, curr_truck->sl_speed_limit);
+ if (curr_truck->sl_enabled)
+ {
+ curr_truck->cc_target_speed =
std::min(curr_truck->cc_target_speed, curr_truck->sl_speed_limit);
+ }
} else if (curr_truck->engine->getGear() == 0) // out of gear
{
curr_truck->cc_target_rpm += 1000.0f * dt;
@@ -1880,7 +1882,10 @@
}
if (INPUTENGINE.getEventBoolValue(EV_TRUCK_CRUISE_CONTROL_READJUST))
{
- curr_truck->cc_target_speed = std::min(curr_truck->WheelSpeed,
curr_truck->sl_speed_limit);
+ if (curr_truck->sl_enabled)
+ {
+ curr_truck->cc_target_speed =
std::min(curr_truck->WheelSpeed, curr_truck->sl_speed_limit);
+ }
curr_truck->cc_target_speed =
std::max(curr_truck->cc_target_speed_lower_limit, curr_truck->cc_target_speed);
curr_truck->cc_target_rpm = curr_truck->engine->getRPM();
}
@@ -1898,7 +1903,7 @@
void checkSpeedlimit(Beam* curr_truck, float dt)
{
- if (curr_truck->sl_speed_limit > 0.0f && curr_truck->engine->getGear()
!= 0)
+ if (curr_truck->sl_enabled && curr_truck->engine->getGear() != 0)
{
float accl = (curr_truck->sl_speed_limit -
std::abs(curr_truck->WheelSpeed)) * 2.0f;
accl = std::max(0.0f, accl);
@@ -2482,30 +2487,30 @@
}
if
(INPUTENGINE.getEventBoolValueBounce(EV_TRUCK_SWITCH_SHIFT_MODES))
+ {
+
//Toggle Auto shift
+
curr_truck->engine->toggleAutoMode();
+#ifdef USE_MYGUI
+
switch(curr_truck->engine->getAutoMode())
{
-
//Toggle Auto shift
-
curr_truck->engine->toggleAutoMode();
-#ifdef USE_MYGUI
-
switch(curr_truck->engine->getAutoMode())
-
{
-
case BeamEngine::AUTOMATIC:
-
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Automatic shift"), "cog.png", 3000);
-
break;
-
case BeamEngine::SEMIAUTO:
-
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Manual shift - Auto clutch"), "cog.png",
3000);
-
break;
-
case BeamEngine::MANUAL:
-
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Fully Manual: sequential shift"),
"cog.png", 3000);
-
break;
-
case BeamEngine::MANUAL_STICK:
-
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Fully manual: stick shift"), "cog.png",
3000);
-
break;
-
case BeamEngine::MANUAL_RANGES:
-
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Fully Manual: stick shift with ranges"),
"cog.png", 3000);
-
break;
-
}
+
case BeamEngine::AUTOMATIC:
+
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Automatic shift"), "cog.png", 3000);
+
break;
+
case BeamEngine::SEMIAUTO:
+
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Manual shift - Auto clutch"), "cog.png",
3000);
+
break;
+
case BeamEngine::MANUAL:
+
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Fully Manual: sequential shift"),
"cog.png", 3000);
+
break;
+
case BeamEngine::MANUAL_STICK:
+
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Fully manual: stick shift"), "cog.png",
3000);
+
break;
+
case BeamEngine::MANUAL_RANGES:
+
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Fully Manual: stick shift with ranges"),
"cog.png", 3000);
+
break;
+ }
#endif //USE_MYGUI
- }
+ }
//joy clutch
float cval =
INPUTENGINE.getEventValue(EV_TRUCK_MANUAL_CLUTCH);
@@ -3278,8 +3283,8 @@
}
} else
{
- // init no trucks, as there
were found some
- initTrucks(false, sel->fname,
String(), 0, false, skin);
+ // init no trucks
+ initTrucks(false, sel->fname,
"", 0, false, skin);
}
}
} else if (loading_state==TERRAIN_LOADED)
@@ -5575,18 +5580,17 @@
int free_truck = BeamFactory::getSingleton().getTruckCount();
Beam **trucks = BeamFactory::getSingleton().getTrucks();
- //first, test if the place if clear, BUT NOT IN MULTIPLAYER
+ // first, test if the place if clear, BUT NOT IN MULTIPLAYER
if (!net)
{
- collision_box_t *spawnbox=collisions->getBox(instance, box);
- for (int t=0; t<free_truck; t++)
+ collision_box_t *spawnbox = collisions->getBox(instance, box);
+ for (int t=0; t < free_truck; t++)
{
if (!trucks[t]) continue;
- for (int i=0; i<trucks[t]->free_node; i++)
+ for (int i=0; i < trucks[t]->free_node; i++)
{
if
(collisions->isInside(trucks[t]->nodes[i].AbsPosition, spawnbox))
{
- //boy, thats bad
#ifdef USE_MYGUI
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO,
Console::CONSOLE_SYSTEM_NOTICE, _L("Please clear the place first"),
"error.png");
#endif // USE_MYGUI
@@ -5596,10 +5600,10 @@
}
}
}
- reload_pos=collisions->getPosition(instance, box);
- reload_dir=collisions->getDirection(instance, box);
- reload_box=collisions->getBox(instance, box);
- loading_state=RELOADING;
+ reload_pos = collisions->getPosition(instance, box);
+ reload_dir = collisions->getDirection(instance, box);
+ reload_box = collisions->getBox(instance, box);
+ loading_state = RELOADING;
hideMap();
#ifdef USE_MYGUI
SelectorWindow::getSingleton().show(SelectorWindow::LoaderType(type));
Modified: trunk/source/main/gui/SelectorWindow.cpp
===================================================================
--- trunk/source/main/gui/SelectorWindow.cpp 2012-05-23 23:23:34 UTC (rev
2642)
+++ trunk/source/main/gui/SelectorWindow.cpp 2012-05-24 00:47:48 UTC (rev
2643)
@@ -316,19 +316,19 @@
if(it->fext=="terrn")
add = (mLoaderType == LT_Terrain);
else if(it->fext=="truck")
- add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Vehicle || mLoaderType == LT_Truck || mLoaderType == LT_Network ||
mLoaderType == LT_NetworkWithBoat);
+ add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Vehicle || mLoaderType == LT_Truck || mLoaderType == LT_Network ||
mLoaderType == LT_NetworkWithBoat);
else if(it->fext=="car")
- add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Vehicle || mLoaderType == LT_Car || mLoaderType == LT_Network || mLoaderType
== LT_NetworkWithBoat);
+ add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Vehicle || mLoaderType == LT_Car || mLoaderType == LT_Network ||
mLoaderType == LT_NetworkWithBoat);
else if(it->fext=="boat")
- add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Boat || mLoaderType == LT_NetworkWithBoat);
+ add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Boat
|| mLoaderType ==
LT_NetworkWithBoat);
else if(it->fext=="airplane")
- add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Airplane || mLoaderType == LT_Network || mLoaderType == LT_NetworkWithBoat);
+ add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Airplane ||
mLoaderType == LT_Network || mLoaderType == LT_NetworkWithBoat);
else if(it->fext=="trailer")
- add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Trailer || mLoaderType == LT_Extension);
+ add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Trailer || mLoaderType == LT_Extension);
else if(it->fext=="train")
add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Train);
else if(it->fext=="load")
- add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Load || mLoaderType == LT_Extension);
+ add = (mLoaderType == LT_AllBeam || mLoaderType ==
LT_Load || mLoaderType == LT_Extension);
if(!add)
continue;
Modified: trunk/source/main/physics/Beam.cpp
===================================================================
--- trunk/source/main/physics/Beam.cpp 2012-05-23 23:23:34 UTC (rev 2642)
+++ trunk/source/main/physics/Beam.cpp 2012-05-24 00:47:48 UTC (rev 2643)
@@ -259,6 +259,7 @@
previousCrank = 0.0f;
+ sl_enabled = false;
sl_speed_limit = 0.0f;
state = SLEEPING;
Modified: trunk/source/main/physics/BeamData.h
===================================================================
--- trunk/source/main/physics/BeamData.h 2012-05-23 23:23:34 UTC (rev
2642)
+++ trunk/source/main/physics/BeamData.h 2012-05-24 00:47:48 UTC (rev
2643)
@@ -899,6 +899,7 @@
float cc_target_speed_lower_limit;
// Speed Limiter
+ bool sl_enabled;
float sl_speed_limit;
float beam_creak;
Modified: trunk/source/main/physics/input_output/SerializedRig.cpp
===================================================================
--- trunk/source/main/physics/input_output/SerializedRig.cpp 2012-05-23
23:23:34 UTC (rev 2642)
+++ trunk/source/main/physics/input_output/SerializedRig.cpp 2012-05-24
00:47:48 UTC (rev 2643)
@@ -872,6 +872,7 @@
parser_warning(c, "SpeedLimiter:
Parameter must be a decimal and greater than zero (e.g. 69.445)");
continue;
}
+ sl_enabled = true;
continue;
}
if (c.line.size() > 17 && c.line.substr(0, 17) ==
"fileformatversion")
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel