mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 15:09:19 +02:00
ai improvements and fixes for acceleration and brake handling, fix for automatic sandbox activation
This commit is contained in:
@@ -4650,36 +4650,26 @@ double TMoverParameters::TractionForce(double dt)
|
||||
else
|
||||
tmp = 4; // szybkie malenie, powolne wzrastanie
|
||||
}
|
||||
// if SlippingWheels then begin PosRatio:=0; tmp:=10; SandDoseOn;
|
||||
// end;//przeciwposlizg
|
||||
|
||||
// if(Flat)then //PRZECIWPOŚLIZG
|
||||
dmoment = eimv[eimv_Fful];
|
||||
// else
|
||||
// dmoment:=eimc[eimc_p_F0]*0.99;
|
||||
// NOTE: the commands to operate the sandbox are likely to conflict with other similar ai decisions
|
||||
// TODO: gather these in single place so they can be resolved together
|
||||
if ((abs((PosRatio + 9.66 * dizel_fill) * dmoment * 100) >
|
||||
0.95 * Adhesive(RunningTrack.friction) * TotalMassxg))
|
||||
{
|
||||
if( ( std::abs( ( PosRatio + 9.66 * dizel_fill ) * dmoment * 100 ) > 0.95 * Adhesive( RunningTrack.friction ) * TotalMassxg ) ) {
|
||||
PosRatio = 0;
|
||||
tmp = 4;
|
||||
Sandbox( true, range::local );
|
||||
} // przeciwposlizg
|
||||
if ((abs((PosRatio + 9.80 * dizel_fill) * dmoment * 100) >
|
||||
0.95 * Adhesive(RunningTrack.friction) * TotalMassxg))
|
||||
{
|
||||
if( ( std::abs( ( PosRatio + 9.80 * dizel_fill ) * dmoment * 100 ) > 0.95 * Adhesive( RunningTrack.friction ) * TotalMassxg ) ) {
|
||||
PosRatio = 0;
|
||||
tmp = 9;
|
||||
} // przeciwposlizg
|
||||
if( ( SlippingWheels ) ) {
|
||||
PosRatio = 0;
|
||||
tmp = 9;
|
||||
Sandbox( true, range::local );
|
||||
} // przeciwposlizg
|
||||
if ((SlippingWheels))
|
||||
{
|
||||
// PosRatio = -PosRatio * 0; // serio -0 ???
|
||||
PosRatio = 0;
|
||||
tmp = 9;
|
||||
Sandbox( true, range::local );
|
||||
} // przeciwposlizg
|
||||
else {
|
||||
// switch sandbox off
|
||||
Sandbox( false, range::local );
|
||||
}
|
||||
|
||||
dizel_fill += Max0R(Min0R(PosRatio - dizel_fill, 0.1), -0.1) * 2 *
|
||||
(tmp /*2{+4*byte(PosRatio<dizel_fill)*/) *
|
||||
|
||||
@@ -48,40 +48,30 @@ std::string Now() {
|
||||
return converter.str();
|
||||
}
|
||||
|
||||
bool TestFlag(int Flag, int Value)
|
||||
{
|
||||
if ((Flag & Value) == Value)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
bool SetFlag( int &Flag, int const Value ) {
|
||||
|
||||
bool SetFlag(int &Flag, int Value) {
|
||||
|
||||
if (Value > 0)
|
||||
{
|
||||
if ((Flag & Value) == 0)
|
||||
{
|
||||
if( Value > 0 ) {
|
||||
if( false == TestFlag( Flag, Value ) ) {
|
||||
Flag |= Value;
|
||||
return true; // true, gdy było wcześniej 0 i zostało ustawione
|
||||
}
|
||||
}
|
||||
else if (Value < 0)
|
||||
{
|
||||
Value = abs(Value);
|
||||
if ((Flag & Value) == Value)
|
||||
{
|
||||
Flag &= ~Value; // Value jest ujemne, czyli zerowanie flagi
|
||||
return true; // true, gdy było wcześniej 1 i zostało wyzerowane
|
||||
}
|
||||
else if( Value < 0 ) {
|
||||
// Value jest ujemne, czyli zerowanie flagi
|
||||
return ClearFlag( Flag, -Value );
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UnSetFlag(int &Flag, int Value)
|
||||
{
|
||||
Flag &= ~Value;
|
||||
return true;
|
||||
bool ClearFlag( int &Flag, int const Value ) {
|
||||
|
||||
if( true == TestFlag( Flag, Value ) ) {
|
||||
Flag &= ~Value;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
inline double Random(double a, double b)
|
||||
|
||||
@@ -63,9 +63,9 @@ inline double BorlandTime()
|
||||
std::string Now();
|
||||
|
||||
/*funkcje logiczne*/
|
||||
bool TestFlag(int Flag, int Value);
|
||||
bool SetFlag( int & Flag, int Value);
|
||||
bool UnSetFlag(int &Flag, int Value);
|
||||
inline bool TestFlag( int const Flag, int const Value ) { return ( ( Flag & Value ) == Value ); }
|
||||
bool SetFlag( int &Flag, int const Value);
|
||||
bool ClearFlag(int &Flag, int const Value);
|
||||
|
||||
bool FuzzyLogic(double Test, double Threshold, double Probability);
|
||||
/*jesli Test>Threshold to losowanie*/
|
||||
|
||||
Reference in New Issue
Block a user