mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-18 22:57:15 -05:00
Fixed a race condition allowing one Pokémon to go to two people.
(And the first offer gets overwritten.)
This commit is contained in:
parent
6d2cdf81d8
commit
123e665c7e
|
|
@ -377,7 +377,7 @@ namespace PkmnFoundations.GTS
|
|||
int targetPid = BitConverter.ToInt32(data, 296);
|
||||
GtsRecord4 result = DataAbstract.Instance.GtsDataForUser4(targetPid);
|
||||
|
||||
if (result == null)
|
||||
if (result == null || result.IsExchanged != 0)
|
||||
{
|
||||
// Pokémon is traded (or was never here to begin with)
|
||||
// todo: I only checked this on GenV. Check that this
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ namespace PkmnFoundations.GTS
|
|||
int targetPid = BitConverter.ToInt32(data, 304);
|
||||
GtsRecord5 result = DataAbstract.Instance.GtsDataForUser5(targetPid);
|
||||
|
||||
if (result == null)
|
||||
if (result == null || result.IsExchanged != 0)
|
||||
{
|
||||
// Pokémon is traded (or was never here to begin with)
|
||||
manager.Remove(session);
|
||||
|
|
|
|||
|
|
@ -159,6 +159,8 @@ namespace PkmnFoundations.Structures
|
|||
|
||||
public bool CanTrade(GtsRecord4 other)
|
||||
{
|
||||
if (IsExchanged != 0 || other.IsExchanged != 0) return false;
|
||||
|
||||
if (Species != other.RequestedSpecies) return false;
|
||||
if (other.RequestedGender != Genders.Either && Gender != other.RequestedGender) return false;
|
||||
if (!CheckLevels(other.RequestedMinLevel, other.RequestedMaxLevel, Level)) return false;
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ namespace PkmnFoundations.Structures
|
|||
|
||||
public bool CanTrade(GtsRecord5 other)
|
||||
{
|
||||
if (IsExchanged != 0 || other.IsExchanged != 0) return false;
|
||||
|
||||
if (Species != other.RequestedSpecies) return false;
|
||||
if (other.RequestedGender != Genders.Either && Gender != other.RequestedGender) return false;
|
||||
if (!CheckLevels(other.RequestedMinLevel, other.RequestedMaxLevel, Level)) return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user