Fix save loading.

https://stackoverflow.com/a/44888113/632035

Pickle can't deal with loading sets (and probably dicts) of objects with
custom __hash__ functions that depend on their state because __hash__
can be called before __setstate__. Make the hash function stupider (but
still correct) by just relying on the object ID.
This commit is contained in:
Dan Albert 2022-03-06 00:14:20 -08:00
parent 738cf1f381
commit 605d8f057f

View File

@ -78,7 +78,7 @@ class FrontLine(MissionTarget):
return (self.blue_cp, self.red_cp) == (other.blue_cp, other.red_cp)
def __hash__(self) -> int:
return hash((self.blue_cp, self.red_cp))
return hash(id(self))
def _compute_position(self) -> Point:
return self.point_from_a(self._position_distance)