Fixed usage of uninitialized variables.

This commit is contained in:
Exynox 2022-11-27 11:56:23 +02:00
parent 972530f3a7
commit 868b8394bb
4 changed files with 10 additions and 14 deletions

View File

@ -22,8 +22,6 @@
#include "ani.h"
#include "locale_service.h"
int battle_hit(LPCHARACTER ch, LPCHARACTER victim, int & iRetDam);
bool battle_distance_valid_by_xy(int x, int y, int tx, int ty)
{
int distance = DISTANCE_APPROX(x - tx, y - ty);
@ -161,9 +159,7 @@ int battle_melee_attack(LPCHARACTER ch, LPCHARACTER victim)
const PIXEL_POSITION & vpos = victim->GetXYZ();
ch->SetRotationToXY(vpos.x, vpos.y);
int dam;
int ret = battle_hit(ch, victim, dam);
return (ret);
return battle_hit(ch, victim);
}
// 실제 GET_BATTLE_VICTIM을 NULL로 만들고 이벤트를 캔슬 시킨다.
@ -633,12 +629,8 @@ void NormalAttackAffect(LPCHARACTER pkAttacker, LPCHARACTER pkVictim)
AttackAffect(pkAttacker, pkVictim, POINT_SLOW_PCT, IMMUNE_SLOW, AFFECT_SLOW, POINT_MOV_SPEED, -30, AFF_SLOW, 20, "SLOW");
}
int battle_hit(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, int & iRetDam)
int battle_hit(LPCHARACTER pkAttacker, LPCHARACTER pkVictim)
{
//PROF_UNIT puHit("Hit");
if (test_server)
sys_log(0, "battle_hit : [%s] attack to [%s] : dam :%d type :%d", pkAttacker->GetName(), pkVictim->GetName(), iRetDam);
int iDam = CalcMeleeDamage(pkAttacker, pkVictim);
if (iDam <= 0)
@ -684,7 +676,9 @@ int battle_hit(LPCHARACTER pkAttacker, LPCHARACTER pkVictim, int & iRetDam)
float tempIDam = iDam;
iDam = attMul * tempIDam + 0.5f;
iRetDam = iDam;
//PROF_UNIT puHit("Hit");
if (test_server)
sys_log(0, "battle_hit : [%s] attack to [%s] : dam: %d", pkAttacker->GetName(), pkVictim->GetName(), iDam);
//PROF_UNIT puDam("Dam");
if (pkVictim->Damage(pkAttacker, iDam, DAMAGE_TYPE_NORMAL))

View File

@ -28,6 +28,8 @@ extern int battle_count_attackers(LPCHARACTER ch);
extern void NormalAttackAffect(LPCHARACTER pkAttacker, LPCHARACTER pkVictim);
extern int battle_hit(LPCHARACTER ch, LPCHARACTER victim);
// 특성 공격
inline void AttackAffect(LPCHARACTER pkAttacker,
LPCHARACTER pkVictim,

View File

@ -1982,8 +1982,8 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
//독일 선물 기능 패킷 임시 저장
private:
unsigned int itemAward_vnum;
char itemAward_cmd[20];
unsigned int itemAward_vnum = 0;
char itemAward_cmd[20] = "";
//bool itemAward_flag;
public:
unsigned int GetItemAward_vnum() { return itemAward_vnum; }