Fix charpanel always showing player 0 stats
This commit is contained in:
parent
41f6b62caa
commit
2d47c12515
5 changed files with 8 additions and 3 deletions
|
|
@ -427,6 +427,7 @@ bool InitSingle(GameData *gameData)
|
|||
}
|
||||
|
||||
MyPlayerId = 0;
|
||||
MyPlayer = &Players[MyPlayerId];
|
||||
gbIsMultiplayer = false;
|
||||
|
||||
return true;
|
||||
|
|
@ -452,9 +453,10 @@ bool InitMulti(GameData *gameData)
|
|||
return false;
|
||||
}
|
||||
MyPlayerId = playerId;
|
||||
MyPlayer = &Players[MyPlayerId];
|
||||
gbIsMultiplayer = true;
|
||||
|
||||
pfile_read_player_from_save(gSaveNumber, Players[MyPlayerId]);
|
||||
pfile_read_player_from_save(gSaveNumber, *MyPlayer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "DiabloUI/art_draw.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "player.h"
|
||||
#include "utils/display.h"
|
||||
#include "engine/render/cel_render.hpp"
|
||||
#include "engine/render/text_render.hpp"
|
||||
|
|
@ -41,8 +42,6 @@ struct PanelEntry {
|
|||
std::function<StyledText()> statDisplayFunc = nullptr; // function responsible for displaying stat
|
||||
};
|
||||
|
||||
Player *MyPlayer = &Players[MyPlayerId];
|
||||
|
||||
UiFlags GetBaseStatColor(CharacterAttribute attr)
|
||||
{
|
||||
UiFlags style = UiFlags::ColorSilver;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
namespace devilution {
|
||||
|
||||
int MyPlayerId;
|
||||
Player *MyPlayer;
|
||||
Player Players[MAX_PLRS];
|
||||
bool MyPlayerIsDead;
|
||||
int deathdelay;
|
||||
|
|
|
|||
|
|
@ -576,6 +576,7 @@ struct Player {
|
|||
};
|
||||
|
||||
extern int MyPlayerId;
|
||||
extern Player *MyPlayer;
|
||||
extern Player Players[MAX_PLRS];
|
||||
extern bool MyPlayerIsDead;
|
||||
extern int BlockBonuses[enum_size<HeroClass>::value];
|
||||
|
|
|
|||
|
|
@ -333,6 +333,8 @@ TEST(Writehero, pfile_write_hero)
|
|||
leveltype = DTYPE_TOWN;
|
||||
|
||||
MyPlayerId = 0;
|
||||
MyPlayer = &Players[MyPlayerId];
|
||||
|
||||
_uiheroinfo info {};
|
||||
strcpy(info.name, "TestPlayer");
|
||||
info.heroclass = HeroClass::Rogue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue