prevent some protocol crashs
This commit is contained in:
parent
c33741d324
commit
cb890e8cb1
|
@ -42,7 +42,6 @@ void Graphics::init()
|
|||
const char *requiredExtensions[] = {
|
||||
"GL_ARB_vertex_program",
|
||||
"GL_ARB_vertex_shader",
|
||||
"GL_ARB_fragment_program",
|
||||
"GL_ARB_fragment_shader",
|
||||
"GL_ARB_texture_non_power_of_two",
|
||||
"GL_ARB_multitexture"
|
||||
|
@ -58,7 +57,10 @@ void Graphics::init()
|
|||
}
|
||||
|
||||
if(unsupported)
|
||||
logFatal("The following OpenGL 2.0 extensions are not supported by your system graphics, please try updating your video drivers or buy a new hardware:\n", ss.str());
|
||||
logFatal("The following OpenGL 2.0 extensions are not supported by your system graphics, please try updating your video drivers or buy a new hardware:\n",
|
||||
ss.str(),
|
||||
"Graphics card: ", glGetString(GL_RENDERER),
|
||||
"\nOpenGL driver: ", glGetString(GL_VERSION));
|
||||
|
||||
m_useFBO = m_useFBO && GLEW_ARB_framebuffer_object;
|
||||
m_generateHardwareMipmaps = m_generateHardwareMipmaps && m_useFBO; // glGenerateMipmap is supported when FBO is
|
||||
|
|
|
@ -278,6 +278,7 @@ void ProtocolGame::parseMessage(InputMessage& msg)
|
|||
|
||||
void ProtocolGame::parseInitGame(InputMessage& msg)
|
||||
{
|
||||
logTraceDebug();
|
||||
uint playerId = msg.getU32();
|
||||
int serverBeat = msg.getU16();
|
||||
msg.getU8(); // can report bugs, ignored
|
||||
|
@ -291,6 +292,7 @@ void ProtocolGame::parseInitGame(InputMessage& msg)
|
|||
void ProtocolGame::parseGMActions(InputMessage& msg)
|
||||
{
|
||||
// not used
|
||||
logTraceDebug();
|
||||
for(int i = 0; i < Proto::NumViolationReasons; ++i)
|
||||
msg.getU8();
|
||||
}
|
||||
|
@ -747,18 +749,28 @@ void ProtocolGame::parsePlayerStats(InputMessage& msg)
|
|||
double soul = msg.getU8();
|
||||
double stamina = msg.getU16();
|
||||
|
||||
if(!m_localPlayer) {
|
||||
logTraceError("there is no local player");
|
||||
return;
|
||||
}
|
||||
|
||||
m_localPlayer->setHealth(health, maxHealth);
|
||||
m_localPlayer->setFreeCapacity(freeCapacity);
|
||||
m_localPlayer->setExperience(experience);
|
||||
m_localPlayer->setLevel(level, levelPercent);
|
||||
m_localPlayer->setMana(mana, maxMana);
|
||||
m_localPlayer->setMagicLevel(magicLevel, magicLevelPercent);
|
||||
m_localPlayer->setSoul(soul);
|
||||
m_localPlayer->setStamina(stamina);
|
||||
m_localPlayer->setSoul(soul);
|
||||
}
|
||||
|
||||
void ProtocolGame::parsePlayerSkills(InputMessage& msg)
|
||||
{
|
||||
if(!m_localPlayer) {
|
||||
logTraceError("there is no local player");
|
||||
return;
|
||||
}
|
||||
|
||||
for(int skill = 0; skill < Otc::LastSkill; skill++) {
|
||||
int level = msg.getU8();
|
||||
int levelPercent = msg.getU8();
|
||||
|
@ -769,6 +781,11 @@ void ProtocolGame::parsePlayerSkills(InputMessage& msg)
|
|||
|
||||
void ProtocolGame::parsePlayerState(InputMessage& msg)
|
||||
{
|
||||
if(!m_localPlayer) {
|
||||
logTraceError("there is no local player");
|
||||
return;
|
||||
}
|
||||
|
||||
int states = msg.getU16();
|
||||
m_localPlayer->setStates((Otc::PlayerStates)states);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue