Fix PokedexScreen crash after catch
This commit is contained in:
parent
5b774623c5
commit
6d9138ee38
|
@ -1984,46 +1984,49 @@ Public Class PokedexViewScreen
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Controls.ShiftPressed = True Or ControllerHandler.ButtonPressed(Buttons.Back) Then
|
If Controls.ShiftPressed = True Or ControllerHandler.ButtonPressed(Buttons.Back) Then
|
||||||
Dim OriginalFormIndex As Integer = Me.FormIndex
|
If Me.Forms.Count > 0 Then
|
||||||
Me.FormIndex += 1
|
|
||||||
|
|
||||||
If Me.FormIndex > Me.Forms.Count - 1 Then
|
Dim OriginalFormIndex As Integer = Me.FormIndex
|
||||||
Me.FormIndex = 0
|
Me.FormIndex += 1
|
||||||
End If
|
|
||||||
|
|
||||||
Dim formID As String = Me.Forms(Me.FormIndex)
|
If Me.FormIndex > Me.Forms.Count - 1 Then
|
||||||
If formID <> "" AndAlso Pokedex.GetEntryType(Core.Player.PokedexData, formID) = 0 Then
|
Me.FormIndex = 0
|
||||||
While Pokedex.GetEntryType(Core.Player.PokedexData, formID) = 0
|
End If
|
||||||
Me.FormIndex += 1
|
|
||||||
|
|
||||||
If Me.FormIndex > Me.Forms.Count - 1 Then
|
Dim formID As String = Me.Forms(Me.FormIndex)
|
||||||
Me.FormIndex = 0
|
If formID <> "" AndAlso Pokedex.GetEntryType(Core.Player.PokedexData, formID) = 0 Then
|
||||||
|
While Pokedex.GetEntryType(Core.Player.PokedexData, formID) = 0
|
||||||
|
Me.FormIndex += 1
|
||||||
|
|
||||||
|
If Me.FormIndex > Me.Forms.Count - 1 Then
|
||||||
|
Me.FormIndex = 0
|
||||||
|
End If
|
||||||
|
formID = Me.Forms(Me.FormIndex)
|
||||||
|
If FormIndex = OriginalFormIndex Then
|
||||||
|
Exit While
|
||||||
|
End If
|
||||||
|
End While
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Me.Forms(Me.FormIndex) IsNot "" Then
|
||||||
|
Dim PokeID As Integer = CInt(Me.Forms(Me.FormIndex).GetSplit(0, "_").GetSplit(0, ";"))
|
||||||
|
Dim PokeAD As String = ""
|
||||||
|
|
||||||
|
If Me.Forms(Me.FormIndex).Contains("_") Then
|
||||||
|
PokeAD = PokemonForms.GetAdditionalValueFromDataFile(Me.Forms(Me.FormIndex))
|
||||||
|
ElseIf Me.Forms(Me.FormIndex).Contains(";") Then
|
||||||
|
PokeAD = Me.Forms(Me.FormIndex).GetSplit(1, ";")
|
||||||
End If
|
End If
|
||||||
formID = Me.Forms(Me.FormIndex)
|
|
||||||
|
Dim newPokemon As Pokemon = Pokemon.GetPokemonByID(PokeID, PokeAD, True)
|
||||||
|
|
||||||
|
Dim playCry As Boolean = True
|
||||||
If FormIndex = OriginalFormIndex Then
|
If FormIndex = OriginalFormIndex Then
|
||||||
Exit While
|
playCry = False
|
||||||
End If
|
End If
|
||||||
End While
|
LoadPokemonData(-1, newPokemon, playCry)
|
||||||
End If
|
|
||||||
|
|
||||||
If Me.Forms(Me.FormIndex) IsNot "" Then
|
|
||||||
Dim PokeID As Integer = CInt(Me.Forms(Me.FormIndex).GetSplit(0, "_").GetSplit(0, ";"))
|
|
||||||
Dim PokeAD As String = ""
|
|
||||||
|
|
||||||
If Me.Forms(Me.FormIndex).Contains("_") Then
|
|
||||||
PokeAD = PokemonForms.GetAdditionalValueFromDataFile(Me.Forms(Me.FormIndex))
|
|
||||||
ElseIf Me.Forms(Me.FormIndex).Contains(";") Then
|
|
||||||
PokeAD = Me.Forms(Me.FormIndex).GetSplit(1, ";")
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim newPokemon As Pokemon = Pokemon.GetPokemonByID(PokeID, PokeAD, True)
|
|
||||||
|
|
||||||
Dim playCry As Boolean = True
|
|
||||||
If FormIndex = OriginalFormIndex Then
|
|
||||||
playCry = False
|
|
||||||
End If
|
|
||||||
LoadPokemonData(-1, newPokemon, playCry)
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
@ -2170,7 +2173,7 @@ Public Class PokedexViewScreen
|
||||||
|
|
||||||
Private Sub UpdatePage3()
|
Private Sub UpdatePage3()
|
||||||
|
|
||||||
If Controls.Accept(True, False, False) = True Then
|
If Controls.Accept(True, False, False) = True AndAlso Me.DexIndex > -1 Then
|
||||||
Dim centerVector As Vector2 = Core.GetMiddlePosition(New Size(CInt(64 * scale), CInt(64 * scale)))
|
Dim centerVector As Vector2 = Core.GetMiddlePosition(New Size(CInt(64 * scale), CInt(64 * scale)))
|
||||||
|
|
||||||
Dim pokemon As Pokemon = Nothing
|
Dim pokemon As Pokemon = Nothing
|
||||||
|
|
Loading…
Reference in New Issue