Revision: 1702
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1702&view=rev
Author:   rorlifter
Date:     2011-02-27 15:51:12 +0000 (Sun, 27 Feb 2011)

Log Message:
-----------
Support beam user limit added
Magic number removed ( 4.0 )
Original limit reset

Modified Paths:
--------------
    trunk/source/main/physics/BeamData.h
    trunk/source/main/physics/BeamForcesEuler.cpp
    trunk/source/main/physics/input_output/BeamLoadTruck.cpp

Modified: trunk/source/main/physics/BeamData.h
===================================================================
--- trunk/source/main/physics/BeamData.h        2011-02-27 13:48:54 UTC (rev 
1701)
+++ trunk/source/main/physics/BeamData.h        2011-02-27 15:51:12 UTC (rev 
1702)
@@ -106,6 +106,7 @@
 static const float NODE_VOLUME_COEF_DEFAULT     = 1.0f;
 static const float NODE_SURFACE_COEF_DEFAULT    = 1.0f;
 static const float NODE_LOADWEIGHT_DEFAULT      = -1.0f;
+static const float SUPPORT_BEAM_LIMIT_DEFAULT   = 4.0f;
 
 /* Enumerations */
 enum {

Modified: trunk/source/main/physics/BeamForcesEuler.cpp
===================================================================
--- trunk/source/main/physics/BeamForcesEuler.cpp       2011-02-27 13:48:54 UTC 
(rev 1701)
+++ trunk/source/main/physics/BeamForcesEuler.cpp       2011-02-27 15:51:12 UTC 
(rev 1702)
@@ -154,11 +154,20 @@
                                                {
                                                        k=0.0f;
                                                        d=d*0.1f;
-                                                       // If support beam is 
extended more than hundred original beam lengths, break it
-                                                       if 
(difftoBeamL>beams[i].L*100.0f)
+                                                       float break_limit = 
SUPPORT_BEAM_LIMIT_DEFAULT;
+                                                       if (beams[i].longbound 
> 0.0f)
+                                                               //this is a 
supportbeam with a user set break limit, get the user set limit
+                                                               break_limit = 
beams[i].longbound;
+
+                                                       // If support beam is 
extended the originallength * break_limit, break and disable it
+                                                       if (difftoBeamL > 
beams[i].L*break_limit)
                                                        {
                                                                
beams[i].broken=1;
                                                                
beams[i].disabled=true;
+                                                               
if(beambreakdebug)
+                                                               {
+                                                                       
LogManager::getSingleton().logMessage(" XXX Support-Beam " + 
StringConverter::toString(i) + " limit extended and broke. Length: " + 
StringConverter::toString(difftoBeamL) + " / max. Length: " + 
StringConverter::toString(beams[i].L*break_limit) + ". It was between nodes " + 
StringConverter::toString(beams[i].p1->id) + " and " + 
StringConverter::toString(beams[i].p2->id) + ".");
+                                                               }
                                                        }
                                                }
                                        }

Modified: trunk/source/main/physics/input_output/BeamLoadTruck.cpp
===================================================================
--- trunk/source/main/physics/input_output/BeamLoadTruck.cpp    2011-02-27 
13:48:54 UTC (rev 1701)
+++ trunk/source/main/physics/input_output/BeamLoadTruck.cpp    2011-02-27 
15:51:12 UTC (rev 1702)
@@ -963,9 +963,10 @@
                {
                        //parse beams
                        int id1, id2;
+                       float support_break_factor = -1.0f;
                        char options[50] = "v";
                        int type=BEAM_NORMAL;
-                       int result = sscanf(line,"%i, %i, 
%s",&id1,&id2,options);
+                       int result = sscanf(line,"%i, %i, %s 
%f",&id1,&id2,options,&support_break_factor);
                        if (result < 2 || result == EOF) {
                                LogManager::getSingleton().logMessage("Error 
parsing File (Beam) " + String(fname) +" line " + 
StringConverter::toString(linecounter) + ". trying to continue ...");
                                continue;
@@ -1019,7 +1020,7 @@
                        }
                        */
 
-                       int pos=add_beam(&nodes[id1], &nodes[id2], manager, \
+                               int pos=add_beam(&nodes[id1], &nodes[id2], 
manager, \
                                parent, type, default_break * 
default_break_scale, default_spring * default_spring_scale, \
                                default_damp * default_damp_scale, 
detacher_group_state, -1, -1, -1, 1, \
                                default_beam_diameter);
@@ -1041,6 +1042,10 @@
                                                break;
                                        case 's':
                                                beams[pos].bounded=SUPPORTBEAM;
+                                               float support_break_limit = 
0.0f;
+                                               if (support_break_factor > 0.0f)
+                                                       support_break_limit = 
support_break_factor;
+                                               beams[pos].longbound = 
support_break_limit;
                                                break;
                                }
                                options_pointer++;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to