mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 02:49:19 +02:00
refactor(sonar): declare loop counters in the for statement (cpp:S5955)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1476,7 +1476,6 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
|
||||
double TMoverParameters::FastComputeMovement(double dt, const TTrackShape & /*Shape*/, TTrackParam & /*Track*/, TLocation const &NewLoc, TRotation const &NewRot)
|
||||
{
|
||||
int b;
|
||||
// T_MoverParameters::FastComputeMovement(dt, Shape, Track, NewLoc, NewRot);
|
||||
|
||||
Loc = NewLoc;
|
||||
@@ -1517,7 +1516,7 @@ double TMoverParameters::FastComputeMovement(double dt, const TTrackShape & /*Sh
|
||||
|
||||
dL = (3.0 * V - Vprev) * dt / 2.0; // metoda Adamsa-Bashfortha
|
||||
// ale jesli jest kolizja (zas. zach. pedu) to...
|
||||
for (b = 0; b < 2; b++)
|
||||
for (int b = 0; b < 2; b++)
|
||||
if (Couplers[b].CheckCollision)
|
||||
CollisionDetect(b, dt); // zmienia niejawnie AccS, V !!!
|
||||
} // liczone dL, predkosc i przyspieszenie
|
||||
@@ -11701,7 +11700,6 @@ TEngineType TMoverParameters::LoadFIZ_EngineDecode(std::string const &Engine) co
|
||||
bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
{
|
||||
WriteLog("check locomotive parameters...");
|
||||
int b;
|
||||
bool OK = true;
|
||||
|
||||
AutoRelayFlag = AutoRelayType == 1;
|
||||
@@ -12052,7 +12050,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int /*Dir*/)
|
||||
// yB: jesli pojazdy nie maja zadeklarowanych czasow, to wsadz z przepisow +-16,(6)%
|
||||
int DefBrakeTable[8] = {15, 4, 25, 25, 13, 3, 12, 2};
|
||||
|
||||
for (b = 1; b < 4; b++)
|
||||
for (int b = 1; b < 4; b++)
|
||||
{
|
||||
if (BrakeDelay[b] == 0)
|
||||
BrakeDelay[b] = DefBrakeTable[b];
|
||||
@@ -12739,7 +12737,6 @@ bool TMoverParameters::RunInternalCommand()
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::ShowCurrentP(int AmpN) const
|
||||
{
|
||||
int b;
|
||||
int Bn;
|
||||
bool Grupowy;
|
||||
|
||||
@@ -12764,7 +12761,7 @@ double TMoverParameters::ShowCurrentP(int AmpN) const
|
||||
else // pobor pradu jezeli niema mocy
|
||||
{
|
||||
int current = 0;
|
||||
for (b = 0; b < 2; b++)
|
||||
for (int b = 0; b < 2; b++)
|
||||
// with Couplers[b] do
|
||||
if (TestFlag(Couplers[b].CouplingFlag, coupling::control) && Couplers[b].Connected->Power > 0.01)
|
||||
current = static_cast<int>(Couplers[b].Connected->ShowCurrent(AmpN));
|
||||
|
||||
@@ -2055,7 +2055,6 @@ double TEStED::GetPF(double const PP, double const dt, double const Vel)
|
||||
void TEStED::Init(double const PP, double const HPP, double const LPP, double const BP, int const BDF)
|
||||
{
|
||||
TLSt::Init(PP, HPP, LPP, BP, BDF);
|
||||
int i;
|
||||
|
||||
ValveRes->CreatePress(PP);
|
||||
BrakeCyl->CreatePress(BP);
|
||||
@@ -2090,7 +2089,7 @@ void TEStED::Init(double const PP, double const HPP, double const LPP, double co
|
||||
Nozzles[6] = 0.9;
|
||||
|
||||
{
|
||||
for (i = 0; i < 11; ++i)
|
||||
for (int i = 0; i < 11; ++i)
|
||||
{
|
||||
Nozzles[i] = Nozzles[i] * Nozzles[i] * 3.14159 / 4000;
|
||||
}
|
||||
|
||||
@@ -127,8 +127,6 @@ void flip_dxt45_block(struct dxt45_block *block)
|
||||
*/
|
||||
void flip_dxt1_image(void *data, int width, int height)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
struct dxt1_block temp1;
|
||||
struct dxt1_block temp2;
|
||||
auto blocks = (struct dxt1_block *)data;
|
||||
@@ -136,9 +134,9 @@ void flip_dxt1_image(void *data, int width, int height)
|
||||
width = (width + 3) / 4;
|
||||
height = (height + 3) / 4;
|
||||
|
||||
for (y = 0; y < height / 2; ++y)
|
||||
for (int y = 0; y < height / 2; ++y)
|
||||
{
|
||||
for (x = 0; x < width; ++x)
|
||||
for (int x = 0; x < width; ++x)
|
||||
{
|
||||
temp1 = blocks[y * width + x];
|
||||
temp2 = blocks[(height - y - 1) * width + x];
|
||||
@@ -158,8 +156,6 @@ void flip_dxt1_image(void *data, int width, int height)
|
||||
*/
|
||||
void flip_dxt23_image(void *data, int width, int height)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
struct dxt23_block temp1;
|
||||
struct dxt23_block temp2;
|
||||
auto blocks = (struct dxt23_block *)data;
|
||||
@@ -167,9 +163,9 @@ void flip_dxt23_image(void *data, int width, int height)
|
||||
width = (width + 3) / 4;
|
||||
height = (height + 3) / 4;
|
||||
|
||||
for (y = 0; y < height / 2; ++y)
|
||||
for (int y = 0; y < height / 2; ++y)
|
||||
{
|
||||
for (x = 0; x < width; ++x)
|
||||
for (int x = 0; x < width; ++x)
|
||||
{
|
||||
temp1 = blocks[y * width + x];
|
||||
temp2 = blocks[(height - y - 1) * width + x];
|
||||
@@ -189,8 +185,6 @@ void flip_dxt23_image(void *data, int width, int height)
|
||||
*/
|
||||
void flip_dxt45_image(void *data, int width, int height)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
struct dxt45_block temp1;
|
||||
struct dxt45_block temp2;
|
||||
auto blocks = (struct dxt45_block *)data;
|
||||
@@ -198,9 +192,9 @@ void flip_dxt45_image(void *data, int width, int height)
|
||||
width = (width + 3) / 4;
|
||||
height = (height + 3) / 4;
|
||||
|
||||
for (y = 0; y < height / 2; ++y)
|
||||
for (int y = 0; y < height / 2; ++y)
|
||||
{
|
||||
for (x = 0; x < width; ++x)
|
||||
for (int x = 0; x < width; ++x)
|
||||
{
|
||||
temp1 = blocks[y * width + x];
|
||||
temp2 = blocks[(height - y - 1) * width + x];
|
||||
|
||||
@@ -565,11 +565,10 @@ void TSegment::render_lines(std::vector<gfx::basic_vertex> &out, float quality)
|
||||
{
|
||||
float step = 1.0f / static_cast<float>(iSegCount) / quality;
|
||||
|
||||
float x;
|
||||
|
||||
glm::vec3 previous = FastGetPoint(0.0);
|
||||
|
||||
for (x = step; x <= 1.0f; x += step) {
|
||||
for (float x = step; x <= 1.0f; x += step) {
|
||||
out.emplace_back(previous, glm::vec3(0.0f), glm::vec2(0.0f));
|
||||
|
||||
previous = glm::vec3(FastGetPoint(x));
|
||||
@@ -586,12 +585,11 @@ glm::vec3 TSegment::get_nearest_point(const glm::dvec3 &point, float quality) co
|
||||
{
|
||||
float step = 1.0f / static_cast<float>(iSegCount) / quality;
|
||||
|
||||
float x;
|
||||
|
||||
glm::vec3 nearest;
|
||||
float min = std::numeric_limits<float>::max();
|
||||
|
||||
for (x = step; x <= 1.0f; x += step) {
|
||||
for (float x = step; x <= 1.0f; x += step) {
|
||||
glm::vec3 p1 = FastGetPoint(x);
|
||||
|
||||
if (glm::vec3 p2 = FastGetPoint(glm::min(1.0f, x + step)); p1 != p2) {
|
||||
|
||||
Reference in New Issue
Block a user