FreeCol / freecol

FreeCol: FreeCol is a turn-based strategy game based on the old game Colonization, and similar to Civilization. The objective of the game is to create an independent nation.
GNU General Public License v2.0
581 stars 170 forks source link

3 strange code fragments #103

Closed mjunix closed 2 years ago

mjunix commented 2 years ago

(I don't have any experience with this codebase so maybe these are not bugs.)

  1. https://github.com/FreeCol/freecol/blob/ef483bd4d41b4076f6a595adb52cbfe139419d81/src/net/sf/freecol/client/control/InGameController.java#L975 The formatting is strange, the if-statement start on same line as a closing brace, is an else missing before the if? If no else is missing then the if-statement should probably moved to a line of its own.
  2. https://github.com/FreeCol/freecol/blob/ef483bd4d41b4076f6a595adb52cbfe139419d81/src/net/sf/freecol/server/ai/ColonyPlan.java#L1054-L1060 The two if-statements have the same condition.
  3. https://github.com/FreeCol/freecol/blob/ef483bd4d41b4076f6a595adb52cbfe139419d81/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java#L496 Identical expressions (tcb.getBottomRightDirtyTile().getY()) on both sides of subtraction operator.
mpope042 commented 2 years ago

Correct on all counts I think. #1 is a typo/omission, #2 is a logic error (long time since I wrote that code, glad I put a comment above), and #3 looks like the second getY is on the wrong corner of the box. All three are fixed in commits 56e3d260, 4b418cd2, 5c4bafb9 respectively (note: sourceforge git repository commits, SF is the freecol development master, github merely contains a mirror, please prefer the SF bug tracker for further such issues).