makeopensource / Classic-RPG

A classic role-playing game with an engine.
GNU General Public License v3.0
7 stars 19 forks source link

Equals function for tiles #35

Closed russella26 closed 2 years ago

russella26 commented 2 years ago

Override the equals function for tiles. If you're confused, look at Position.java for a well done implementation.

russella26 commented 2 years ago

actually, i'd love to see a second opinion on this, i can't see a reason why comparing simply by reference would be unsafe

Sploder12 commented 2 years ago

Comparing by reference covers checking if two Tiles are the exact same Tile. But it doesn't cover if you want to check if two different tiles have the same entities. So if we plan on checking for having the same entities (which doesn't really make much sense) then we should but otherwise there is no reason to since the Positions will be unique anyways, I think.

jakesavi commented 2 years ago

We should also consider tile Type. Ex.) A wall, water, a regular passable floor. I think these should definitely be added.

jakesavi commented 2 years ago

Fixed in a direct push.