1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-26 09:05:24 +00:00

Fix crash on exiting "select hero class" screen (#64)

* Fix crash on exiting select hero screen

* Remove unneeded using

* Revert mistake on ChangeScene
This commit is contained in:
Matheus Cardoso 2019-01-09 10:27:59 -03:00 committed by Tim Sarbin
parent bd4c95c28d
commit b722405d53
2 changed files with 15 additions and 6 deletions

View File

@ -33,15 +33,25 @@ namespace OpenDiablo2.Common.Enums
public static class eHeroExtensions public static class eHeroExtensions
{ {
public readonly static eHero[] all = {
eHero.Barbarian,
eHero.Necromancer,
eHero.Paladin,
eHero.Assassin,
eHero.Sorceress,
eHero.Amazon,
eHero.Druid,
};
public readonly static Dictionary<eHero, string> tokens = new Dictionary<eHero, string> public readonly static Dictionary<eHero, string> tokens = new Dictionary<eHero, string>
{ {
{ eHero.Amazon , "AM" }, { eHero.Barbarian , "BA" },
{ eHero.Sorceress , "SO" },
{ eHero.Necromancer , "NE" }, { eHero.Necromancer , "NE" },
{ eHero.Paladin , "PA" }, { eHero.Paladin , "PA" },
{ eHero.Barbarian , "BA" }, { eHero.Assassin , "AI" },
{ eHero.Sorceress , "SO" },
{ eHero.Amazon , "AM" },
{ eHero.Druid , "DZ" }, { eHero.Druid , "DZ" },
{ eHero.Assassin , "AI" }
}; };
public static string ToToken(this eHero source) => tokens[source]; public static string ToToken(this eHero source) => tokens[source];

View File

@ -279,8 +279,7 @@ namespace OpenDiablo2.Scenes
{ {
StopSfx(); StopSfx();
var heros = Enum.GetValues(typeof(eHero)).Cast<eHero>(); foreach (var hero in eHeroExtensions.all)
foreach (var hero in heros)
{ {
heroRenderInfo[hero].SpecialFrameTime = 0; heroRenderInfo[hero].SpecialFrameTime = 0;
heroRenderInfo[hero].Stance = eHeroStance.Idle; heroRenderInfo[hero].Stance = eHeroStance.Idle;