Advertisement
Luciano_fuentes

Limpiar

Dec 12th, 2016
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Type CleanWorld
  4.     Map As Integer
  5.     X As Integer
  6.     Y As Integer
  7. End Type
  8.  
  9. Private Const MAX_OBJS_CLEAR As Integer = 100
  10. Public LastOBJ As Integer
  11.  
  12. Public tClearWorld(1 To MAX_OBJS_CLEAR) As CleanWorld
  13.  
  14. Public Sub CleanWorld_AddItem(ByVal Map As Integer, ByVal X As Integer, ByVal Y As Integer)
  15.  
  16.     LastOBJ = LastOBJ + 1
  17.  
  18.     With tClearWorld(LastOBJ)
  19.         .Map = Map
  20.         .X = X
  21.         .Y = Y
  22.     End With
  23.    
  24.     If LastOBJ = 100 Then _
  25.         CleanWorld_Clear
  26.    
  27. End Sub
  28.  
  29. Public Sub CleanWorld_Clear()
  30.  
  31.     SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Limpieza> Limpiando el mundo.", FontTypeNames.FONTTYPE_TALK)
  32.     SendData SendTarget.ToAll, 0, PrepareMessagePauseToggle
  33.    
  34.     Dim i As Long
  35.     Dim timeStart As Long
  36.     Dim timeFinish As Long
  37.     Dim tmpString As String
  38.    
  39.     timeStart = GetTickCount
  40.  
  41.     For i = 1 To LastOBJ
  42.  
  43.         With tClearWorld(i)
  44.             If MapData(.Map, .X, .Y).ObjInfo.ObjIndex > 0 Then
  45.                 EraseObj 10000, .Map, .X, .Y
  46.                 .Map = 0
  47.                 .X = 0
  48.                 .Y = 0
  49.             End If
  50.         End With
  51.         LastOBJ = 0
  52.     Next i
  53.  
  54.     timeFinish = GetTickCount - timeStart
  55.  
  56.     If (timeFinish / 1000) > 0 Then
  57.         tmpString = " Finalizó en " & Round(timeFinish / 1000) & " segundos."
  58.     Else
  59.         tmpString = " Finalizó en " & timeFinish & " milisegundos."
  60.     End If
  61.     SendData SendTarget.ToAll, 0, PrepareMessageConsoleMsg("Limpieza " & tmpString, FontTypeNames.FONTTYPE_TALK)
  62.     SendData SendTarget.ToAll, 0, PrepareMessagePauseToggle
  63.  
  64. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement