DayZ 1.24
Loading...
Searching...
No Matches
CacheObject.c
Go to the documentation of this file.
1
3{
4 int m_Mask;
6
8 {
10 }
11
12 int GetMask()
13 {
14 return m_Mask;
15 }
16
18 {
19 return m_BitCount;
20 }
21
22 void SetMask(int mask)
23 {
24 m_Mask = mask;
26 }
27
28}
29
30class CacheObject
31{
34 //RecipeCacheData data;
40
41 bool AddRecipe(int recipe_id, int mask)
42 {
44 if (data)
46 else
47 {
49 m_RecipeIDs.Insert(recipe_id);
50
51 }
52 return true;
53 }
54
55
56 void UpdateMask(int recipe_id, int mask)
57 {
59 data.SetMask(data.GetMask() | mask);
60
61 }
62
63
65 {
66 return m_Recipes.Count();
67 }
68
70 {
71 return m_RecipeIDs;
72 }
73
75 {
76 return m_Recipes.Contains(recipe_id);
77 }
78
80 {
82 if (cache_data)
83 return cache_data.GetMask();
84 return 0;
85 }
86
88 {
90 if (cache_data)
91 return cache_data.GetBitCount();
92 return 0;
93 }
94
96 {
97 for (int i = 0; i < m_Recipes.Count(); i++)
98 {
99 Print("recipeID:" + m_Recipes.GetKey(i).ToString());
100 Print("mask:" + m_Recipes.GetElement(i).m_Mask.ToString());
101 Print("m_BitCount:" + m_Recipes.GetElement(i).m_BitCount.ToString());
102
103 }
104 }
105}
bool IsContainRecipe(int recipe_id)
Definition CacheObject.c:74
array< int > GetRecipes()
Definition CacheObject.c:69
ref array< int > m_RecipeIDs
Definition CacheObject.c:33
int GetBitCountByRecipeID(int recipe_id)
Definition CacheObject.c:87
int GetNumberOfRecipes()
Definition CacheObject.c:64
class RecipeCacheData m_Recipes
int GetMaskByRecipeID(int recipe_id)
Definition CacheObject.c:79
void DebugPrint()
Definition CacheObject.c:95
void CacheObject()
Definition CacheObject.c:35
void UpdateMask(int recipe_id, int mask)
Definition CacheObject.c:56
bool AddRecipe(int recipe_id, int mask)
Definition CacheObject.c:41
Definition EnMath.c:7
void SetMask(int mask)
Definition CacheObject.c:22
void RecipeCacheData(int mask)
Definition CacheObject.c:7
proto void Print(void var)
Prints content of variable to console/log.
static proto int GetNumberOfSetBits(int i)
returns the number of bits set in a bitmask i