LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
282 stars 157 forks source link

Duplicates (cppcheck) #11093

Open JohnsterID opened 3 weeks ago

JohnsterID commented 3 weeks ago

A few duplicates identified by cppcheck (not all). https://github.com/LoneGazebo/Community-Patch-DLL/actions/runs/9823065412

Id: duplicateExpression
CWE: 398
Finding the same expression on both sides of an operator is suspicious and might indicate a cut and paste or logic error. Please examine this code carefully to determine if it is correct.

https://github.com/LoneGazebo/Community-Patch-DLL/blob/827313328d18bdefc3c12688ea1db16f1384a7f6/CvGameCoreDLL_Expansion2/CvBarbarians.cpp#L1209

Id: duplicateExpression
CWE: 398
'iMinSpawnRadius' is assigned value '1' here.

https://github.com/LoneGazebo/Community-Patch-DLL/blob/827313328d18bdefc3c12688ea1db16f1384a7f6/CvGameCoreDLL_Expansion2/CvBarbarians.cpp#L1010

Id: duplicateExpression

https://github.com/LoneGazebo/Community-Patch-DLL/blob/827313328d18bdefc3c12688ea1db16f1384a7f6/CvGameCoreDLL_Expansion2/CvUnit.cpp#L2049

Id: duplicateCondition
CWE: 398
The if condition is the same as the previous if condition

https://github.com/LoneGazebo/Community-Patch-DLL/blob/827313328d18bdefc3c12688ea1db16f1384a7f6/CvGameCoreDLL_Expansion2/CvCultureClasses.cpp#L4730 https://github.com/LoneGazebo/Community-Patch-DLL/blob/827313328d18bdefc3c12688ea1db16f1384a7f6/CvGameCoreDLL_Expansion2/CvCultureClasses.cpp#L4720 https://github.com/LoneGazebo/Community-Patch-DLL/blob/827313328d18bdefc3c12688ea1db16f1384a7f6/CvGameCoreDLL_Expansion2/CvPlot.cpp#L3036 https://github.com/LoneGazebo/Community-Patch-DLL/blob/827313328d18bdefc3c12688ea1db16f1384a7f6/CvGameCoreDLL_Expansion2/CvPlot.cpp#L2984