Skip to content

Commit

Permalink
Optimizo los llamados a GetTickCount
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis Caraballo committed Mar 4, 2024
1 parent 4bc8824 commit 34507d8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Codigo/EffectProvoked.cls
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Public Sub Setup(ByVal SourceIndex As Integer, ByVal SourceType As e_ReferenceTy
If SourceType = eUser Then
Call SetUserRef(NpcList(TargetIndex).TargetUser, SourceIndex)
NpcList(TargetIndex).flags.AttackedBy = UserList(SourceIndex).name
NpcList(TargetIndex).flags.AttackedTime = GetTickCount
NpcList(TargetIndex).flags.AttackedTime = GlobalFrameTime
Else
Call SetNpcRef(NpcList(TargetIndex).TargetNPC, SourceIndex)
End If
Expand Down
4 changes: 2 additions & 2 deletions Codigo/MODULO_NPCs.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ Sub DoFollow(ByVal NpcIndex As Integer, ByVal UserName As String)
player = NameIndex(username)
If IsValidUserRef(player) Then
114 .flags.AttackedBy = username
115 .flags.AttackedTime = GetTickCount
115 .flags.AttackedTime = GlobalFrameTime
116 .targetUser = player
118 .flags.Follow = True
120 Call SetMovement(NpcIndex, e_TipoAI.NpcDefensa)
Expand Down Expand Up @@ -2383,7 +2383,7 @@ Public Function GetOwnedBy(ByVal NpcIndex As Integer) As Integer
GetOwnedBy = 0
With NpcList(NpcIndex).flags
If .AttackedBy = vbNullString Then Exit Function
If GetTickCount - .AttackedTime > IntervaloNpcOwner Then Exit Function
If GlobalFrameTime - .AttackedTime > IntervaloNpcOwner Then Exit Function
Dim Attacker As t_UserReference: Attacker = NameIndex(.AttackedBy)
If Not IsValidUserRef(Attacker) Then Exit Function
GetOwnedBy = Attacker.ArrayIndex
Expand Down
2 changes: 1 addition & 1 deletion Codigo/Modulo_UsUaRiOs.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,7 @@ Sub NPCAtacado(ByVal NpcIndex As Integer, ByVal UserIndex As Integer, Optional B
108 NpcList(NpcIndex).Hostile = 1
110 If AffectsOwner Then
NpcList(NpcIndex).flags.AttackedBy = UserList(UserIndex).name
NpcList(NpcIndex).flags.AttackedTime = GetTickCount
NpcList(NpcIndex).flags.AttackedTime = GlobalFrameTime
End If
End If

Expand Down
4 changes: 2 additions & 2 deletions Codigo/SistemaCombate.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ Sub AllMascotasAtacanUser(ByVal victim As Integer, ByVal Maestro As Integer)
If IsValidNpcRef(.MascotasIndex(iCount)) Then
108 If IsSet(NpcList(mascotaIndex).flags.BehaviorFlags, e_BehaviorFlags.eAttackUsers) Then
110 NpcList(mascotaIndex).flags.AttackedBy = UserList(victim).Name
111 NpcList(mascotaIndex).flags.AttackedTime = GetTickCount
111 NpcList(mascotaIndex).flags.AttackedTime = GlobalFrameTime
112 Call SetUserRef(NpcList(mascotaIndex).TargetUser, victim)
114 Call SetMovement(mascotaIndex, e_TipoAI.NpcDefensa)
116 NpcList(mascotaIndex).Hostile = 0
Expand Down Expand Up @@ -2127,7 +2127,7 @@ Public Sub AllMascotasAtacanNPC(ByVal NpcIndex As Integer, ByVal UserIndex As In
110 Call SetNpcRef(.TargetNPC, NpcIndex)
112 Call SetMovement(mascotaIdx, e_TipoAI.NpcAtacaNpc)
NpcList(NpcIndex).flags.AttackedBy = UserList(UserIndex).name
NpcList(NpcIndex).flags.AttackedTime = GetTickCount
NpcList(NpcIndex).flags.AttackedTime = GlobalFrameTime
Call SetNpcRef(UserList(UserIndex).flags.NPCAtacado, NpcIndex)
End If
End With
Expand Down

0 comments on commit 34507d8

Please sign in to comment.