From 28fd553266e733443d92e9126b13d2469aeac818 Mon Sep 17 00:00:00 2001 From: ephphatha Date: Thu, 24 Aug 2023 23:47:16 +1000 Subject: [PATCH] Use HeroClass in UI functions --- Source/DiabloUI/diabloui.h | 4 ++-- Source/DiabloUI/hero/selhero.cpp | 10 +++++----- Source/pfile.cpp | 4 ++-- Source/pfile.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/DiabloUI/diabloui.h b/Source/DiabloUI/diabloui.h index 65a4f927c..7cbea8d5b 100644 --- a/Source/DiabloUI/diabloui.h +++ b/Source/DiabloUI/diabloui.h @@ -83,8 +83,8 @@ void UiTitleDialog(); void UnloadUiGFX(); void UiInitialize(); bool UiValidPlayerName(std::string_view name); /* check */ -void UiSelHeroMultDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(unsigned int, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber); -void UiSelHeroSingDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(unsigned int, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber, _difficulty *difficulty); +void UiSelHeroMultDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(HeroClass, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber); +void UiSelHeroSingDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(HeroClass, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber, _difficulty *difficulty); bool UiCreditsDialog(); bool UiSupportDialog(); bool UiMainMenuDialog(const char *name, _mainmenu_selections *pdwResult, int attractTimeOut); diff --git a/Source/DiabloUI/hero/selhero.cpp b/Source/DiabloUI/hero/selhero.cpp index e63478602..3e667b5fe 100644 --- a/Source/DiabloUI/hero/selhero.cpp +++ b/Source/DiabloUI/hero/selhero.cpp @@ -29,7 +29,7 @@ bool selhero_isMultiPlayer; bool (*gfnHeroInfo)(bool (*fninfofunc)(_uiheroinfo *)); bool (*gfnHeroCreate)(_uiheroinfo *); -void (*gfnHeroStats)(unsigned int, _uidefaultstats *); +void (*gfnHeroStats)(HeroClass, _uidefaultstats *); namespace { @@ -226,7 +226,7 @@ void SelheroClassSelectorFocus(int value) const auto heroClass = static_cast(vecSelHeroDlgItems[value]->m_value); _uidefaultstats defaults; - gfnHeroStats(static_cast(heroClass), &defaults); + gfnHeroStats(heroClass, &defaults); selhero_heroInfo.level = 1; selhero_heroInfo.heroclass = heroClass; @@ -546,7 +546,7 @@ void selhero_List_Init() static void UiSelHeroDialog( bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), - void (*fnstats)(unsigned int, _uidefaultstats *), + void (*fnstats)(HeroClass, _uidefaultstats *), bool (*fnremove)(_uiheroinfo *), _selhero_selections *dlgresult, uint32_t *saveNumber) @@ -607,7 +607,7 @@ void UiSelHeroSingDialog( bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), - void (*fnstats)(unsigned int, _uidefaultstats *), + void (*fnstats)(HeroClass, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber, _difficulty *difficulty) @@ -621,7 +621,7 @@ void UiSelHeroMultDialog( bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), - void (*fnstats)(unsigned int, _uidefaultstats *), + void (*fnstats)(HeroClass, _uidefaultstats *), _selhero_selections *dlgresult, uint32_t *saveNumber) { diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 9c5c1c68a..6ff842547 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -676,9 +676,9 @@ bool pfile_ui_set_hero_infos(bool (*uiAddHeroInfo)(_uiheroinfo *)) return true; } -void pfile_ui_set_class_stats(unsigned int playerClass, _uidefaultstats *classStats) +void pfile_ui_set_class_stats(HeroClass playerClass, _uidefaultstats *classStats) { - const ClassAttributes &classAttributes = GetClassAttributes(static_cast(playerClass)); + const ClassAttributes &classAttributes = GetClassAttributes(playerClass); classStats->strength = classAttributes.baseStr; classStats->magic = classAttributes.baseMag; classStats->dexterity = classAttributes.baseDex; diff --git a/Source/pfile.h b/Source/pfile.h index 5d84729d6..c025f0c93 100644 --- a/Source/pfile.h +++ b/Source/pfile.h @@ -116,7 +116,7 @@ HeroCompareResult pfile_compare_hero_demo(int demo, bool logDetails); void sfile_write_stash(); bool pfile_ui_set_hero_infos(bool (*uiAddHeroInfo)(_uiheroinfo *)); -void pfile_ui_set_class_stats(unsigned int playerClass, _uidefaultstats *classStats); +void pfile_ui_set_class_stats(HeroClass playerClass, _uidefaultstats *classStats); uint32_t pfile_ui_get_first_unused_save_num(); bool pfile_ui_save_create(_uiheroinfo *heroinfo); bool pfile_delete_save(_uiheroinfo *heroInfo);