DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс PluginRecipesManagerBase

Защищенные члены

void GenerateRecipeCache ()
 
void WalkRecipes ()
 
void MatchItems (TStringArray full_path)
 
void PerformRecipeServer (int id, ItemBase item_a, ItemBase item_b, PlayerBase player)
 
void GenerateHumanReadableRecipeList ()
 
array< RecipeBaseGetRecipesForItem (string itemName)
 
bool RecipeSanityCheck (int num_of_ingredients, InventoryItemBase items[], PlayerBase player)
 
void RegisterRecipe (RecipeBase recipe)
 
void UnregisterRecipe (string clasname)
 
bool CheckRecipe (int id, ItemBase item1, ItemBase item2, PlayerBase player)
 
void PrintCache ()
 
bool SortIngredientsInRecipe (int id, int num_of_ingredients, ItemBase ingredients_unsorted[], ItemBase ingredients_sorted[])
 sorts ingredients correctly as either first or second ingredient based on their masks
 
void ClearResults ()
 
bool ResolveIngredients (int num_of_ingredients, int passes=0)
 
void PrintResultMasks (int num)
 
int GetRecipeIntersection (int num_of_ingredients, ItemBase items[])
 fills an array with recipe IDs which 'item_a' and 'item_b' share
 
int SortIngredients (int num_of_ingredients, ItemBase items_unsorted[], int resolved_recipes[])
 
void CreateAllRecipes ()
 
string GetSoundCategory (int recipeID, ItemBase item1, ItemBase item2)
 
int GetAnimationCommandUID (int recipeID)
 

Защищенные статические члены

static int RecipeIDFromClassname (string classname)
 

Защищенные данные

ref array< intm_RcpsArray
 
string m_BaseName
 
int m_RecipeID
 
int item_mask
 
int m_BaseMask
 
string m_ItemName
 
ref CacheObject m_CoItem
 
ref CacheObject m_CoBase
 

Закрытые члены

void PluginRecipesManager ()
 
void ~PluginRecipesManager ()
 
bool IsEnableDebugCrafting ()
 
void SetEnableDebugCrafting (bool enable)
 
string GetRecipeName (int recipe_id)
 
int GetValidRecipes (ItemBase item1, ItemBase item2, array< int > ids, PlayerBase player)
 
int GetValidRecipesProper (int num_of_items, ItemBase items[], array< int > ids, PlayerBase player)
 
float GetRecipeLengthInSecs (int recipe_id)
 
float GetRecipeSpecialty (int recipe_id)
 
bool GetIsInstaRecipe (int recipe_id)
 
override void OnInit ()
 
void CallbackGenerateCache ()
 

Закрытые статические члены

static int GetMaxNumberOfRecipes ()
 

Закрытые данные

ref Timer m_TestTimer
 
const int MAX_NUMBER_OF_RECIPES = GetMaxNumberOfRecipes()
 
const int MAX_CONCURENT_RECIPES = 128
 
const int MAX_INGREDIENTS = 5
 
int m_RegRecipeIndex
 
int m_ResolvedRecipes [MAX_CONCURENT_RECIPES]
 
bool m_EnableDebugCrafting = false
 
ItemBase m_Ingredients [MAX_INGREDIENTS]
 
int m_IngredientBitMask [MAX_INGREDIENTS]
 
int m_IngredientBitMaskSize [MAX_INGREDIENTS]
 
int m_BitsResults [MAX_INGREDIENTS]
 
ItemBase m_ingredient1 [MAX_CONCURENT_RECIPES]
 
ItemBase m_ingredient2 [MAX_CONCURENT_RECIPES]
 
ItemBase m_ingredient3 [MAX_CONCURENT_RECIPES]
 
ItemBase m_sortedIngredients [MAX_NUMBER_OF_INGREDIENTS]
 
ref array< intm_RecipesMatched = new array<int>
 
ref array< stringm_CachedItems = new array<string>
 
ref array< ref RecipeBasem_RecipeList = new array<ref RecipeBase>
 
ref Timer myTimer1
 

Закрытые статические данные

static ref map< string, ref CacheObjectm_RecipeCache = new map<string,ref CacheObject >
 
static ref map< typename, boolm_RecipesInitializedItem = new ref map<typename, bool>
 
static ref map< string, intm_RecipeNamesList = new map<string, int>
 

Подробное описание

Конструктор(ы)

◆ ~PluginRecipesManager()

void ~PluginRecipesManager ( )
inlineprivate
62 {
63 }

Методы

◆ CallbackGenerateCache()

void CallbackGenerateCache ( )
inlineprivate
160 {
161 Debug.Log("CallbackGenerateCache","recipes");
163 //SaveCacheToFile(PATH_CACHE_FILE);//generate the cache and save it to a file
164 //ReadCacheFromFile(PATH_CACHE_FILE);
165 }
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:136
void GenerateRecipeCache()
Definition PluginRecipesManager.c:167

Перекрестные ссылки GenerateRecipeCache() и Debug::Log().

◆ CheckRecipe()

bool CheckRecipe ( int id,
ItemBase item1,
ItemBase item2,
PlayerBase player )
inlineprotected
444 {
446 return p_recipe.CheckRecipe(item1,item2, player);
447 }
Definition EntityAI.c:95
ref array< ref RecipeBase > m_RecipeList
Definition PluginRecipesManager.c:42
Definition RecipeBase.c:5

Используется в PerformRecipeServer().

◆ ClearResults()

void ClearResults ( )
inlineprotected
488 {
489 for (int i = 0; i < MAX_INGREDIENTS; i++)
490 {
491 m_BitsResults[i] = 0;
492 }
493
494 }
const int MAX_INGREDIENTS
Definition PluginRecipesManager.c:21
int m_BitsResults[MAX_INGREDIENTS]
Definition PluginRecipesManager.c:31

Перекрестные ссылки MAX_INGREDIENTS.

Используется в SortIngredientsInRecipe().

◆ CreateAllRecipes()

void CreateAllRecipes ( )
inlineprotected
627 {
629 }
void RegisterRecipies()
Please do not delete commented recipes, they are usually commented out for a reason.
Definition PluginRecipesManagerBase.c:14

Перекрестные ссылки RegisterRecipies().

Используется в PluginRecipesManager().

◆ GenerateHumanReadableRecipeList()

void GenerateHumanReadableRecipeList ( )
inlineprotected
316 {
318
319 FileHandle file = OpenFile("$profile:RecipeDump.txt", FileMode.WRITE);
320 if ( file == 0 )
321 {
322 //error message
323 PrintString("failed to open file RecipeDump");
324 return;
325 }
327 for (int i = 0; i < PluginRecipesManager.m_RecipeCache.Count(); i++)
328 {
329 string key = PluginRecipesManager.m_RecipeCache.GetKey(i);
330 CacheObject value = PluginRecipesManager.m_RecipeCache.GetElement(i);
331
332 string line = key;
333 recipes.Clear();
334 recipes.InsertAll( value.GetRecipes() );
335
336 //PrintString("Item: " + key);
337
338 for (int x = 0; x < recipes.Count(); x++)
339 {
340 int recipe_id = recipes.Get(x);
341 string recipe_name = Widget.TranslateString(GetRecipeName(recipe_id));
342 testset.Insert(recipe_name);
343
344 line += "," +recipe_name;
345 }
347
348 }
349
350 // generate localized list of recipe names
351 foreach ( string st : testset)
352 {
353 FPrintln(file, st);
354 }
355
357 }
void CacheObject()
Definition CacheObject.c:35
Icon x
void PluginRecipesManager()
Definition PluginRecipesManager.c:52
string GetRecipeName(int recipe_id)
Definition PluginRecipesManager.c:76
Definition EnWidgets.c:190
void PrintString(string s)
Helper for printing out string expression. Example: PrintString("Hello " + var);.
Definition EnScript.c:345
FileMode
Definition EnSystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.

Перекрестные ссылки CacheObject(), CloseFile(), FPrintln(), GetRecipeName(), OpenFile(), PrintString() и x.

◆ GenerateRecipeCache()

void GenerateRecipeCache ( )
inlineprotected
168 {
169 GetGame().ProfilerStart("m_RecipeCache");
170
171 //m_CacheBasesMap.Clear();
172 m_CachedItems.Clear();
173 PluginRecipesManager.m_RecipeCache.Clear();
174
176
180 //Debug.Log("Got here 0","caching");
181 string config_path;
182 string child_name;
183 int scope;
185 WalkRecipes();
186 for (int i = 0; i < all_config_paths.Count(); i++)
187 {
189 int children_count = GetGame().ConfigGetChildrenCount(config_path);
190
191 for (int x = 0; x < children_count; x++)
192 {
193 GetGame().ConfigGetChildName(config_path, x, child_name);
194 scope = GetGame().ConfigGetInt( config_path + " " + child_name + " scope" );
195
196 if ( scope == 2 )
197 {
198 GetGame().ConfigGetFullPath(config_path +" "+ child_name,/*out*/ full_path);
200 }
201 }
202 }
203 GetGame().ProfilerStop("m_RecipeCache");
204 }
void WalkRecipes()
Definition PluginRecipesManager.c:206
ref array< string > m_CachedItems
Definition PluginRecipesManager.c:40
void MatchItems(TStringArray full_path)
Definition PluginRecipesManager.c:250
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:28
proto native CGame GetGame()
array< string > TStringArray
Definition EnScript.c:685
const string CFG_VEHICLESPATH
Definition constants.c:217
const string CFG_WEAPONSPATH
Definition constants.c:218
const string CFG_MAGAZINESPATH
Definition constants.c:219

Перекрестные ссылки CFG_MAGAZINESPATH, CFG_VEHICLESPATH, CFG_WEAPONSPATH, GetGame(), MatchItems(), WalkRecipes() и x.

Используется в CallbackGenerateCache() и PluginRecipesManager().

◆ GetAnimationCommandUID()

int GetAnimationCommandUID ( int recipeID)
inlineprotected
654 {
655 return m_RecipeList[recipeID].GetAnimationCommandUID();
656 }

◆ GetIsInstaRecipe()

bool GetIsInstaRecipe ( int recipe_id)
inlineprivate
146 {
147 if ( m_RecipeList[recipe_id] ) return m_RecipeList[recipe_id].IsInstaRecipe();
148 else return false;
149 }

◆ GetMaxNumberOfRecipes()

static int GetMaxNumberOfRecipes ( )
inlinestaticprivate
48 {
49 return 2048;
50 }

◆ GetRecipeIntersection()

int GetRecipeIntersection ( int num_of_ingredients,
ItemBase items[] )
inlineprotected

fills an array with recipe IDs which 'item_a' and 'item_b' share

557 {
558 int count = 0;
559 int smallest = 9999;
560 int smallest_index = 0;
561 m_RecipesMatched.Clear();
562
563 /*
564 m_Ingredients[0] = item_a;
565 m_Ingredients[1] = item_b;
566 */
567 //find the item with smallest number of recipes
569
570 for (int i = 0; i < num_of_ingredients; i++)
571 {
572 CacheObject cobject = PluginRecipesManager.m_RecipeCache.Get( items[i].GetType() );
573 if (!cobject)
574 {
575 return 0;
576 }
577 if (cobject.GetNumberOfRecipes() < smallest)
578 {
579 smallest = cobject.GetNumberOfRecipes();
582 }
583 }
584
585 //look for matches
586 array<int> recipes = co_least_recipes.GetRecipes();
587 for (int x = 0; x < recipes.Count(); x++)
588 {
589 int id = recipes.Get(x);
590 for (int z = 0; z < num_of_ingredients; z++)
591 {
592 if ( z!= smallest_index)
593 {
594 CacheObject cobject2 = PluginRecipesManager.m_RecipeCache.Get( items[z].GetType() );
595 if ( cobject2.IsContainRecipe(id) )
596 {
597 m_RecipesMatched.Insert(id);
598 count++;
599 }
600 }
601 }
602 }
603 return count;
604 }
eBleedingSourceType GetType()
Definition BleedingSource.c:63
ref array< int > m_RecipesMatched
Definition PluginRecipesManager.c:39

Перекрестные ссылки CacheObject(), GetType() и x.

Используется в GetValidRecipesProper().

◆ GetRecipeLengthInSecs()

float GetRecipeLengthInSecs ( int recipe_id)
inlineprivate
134 {
135 if ( m_RecipeList[recipe_id] ) return m_RecipeList[recipe_id].GetLengthInSecs();
136 return 0;
137 }

◆ GetRecipeName()

string GetRecipeName ( int recipe_id)
inlineprivate
77 {
79 return m_RecipeList[recipe_id].GetName();
80
81 return "";
82 }

Используется в GenerateHumanReadableRecipeList().

◆ GetRecipesForItem()

array< RecipeBase > GetRecipesForItem ( string itemName)
inlineprotected
360 {
361 CacheObject co = PluginRecipesManager.m_RecipeCache.Get(itemName);
362 array<int> ids = co.GetRecipes();
363
365 foreach (int recipeID : ids)
366 {
368 }
369
370 return recipes;
371 }

Перекрестные ссылки CacheObject().

◆ GetRecipeSpecialty()

float GetRecipeSpecialty ( int recipe_id)
inlineprivate
140 {
141 if ( m_RecipeList[recipe_id] ) return m_RecipeList[recipe_id].GetSpecialty();
142 return 0;
143 }

◆ GetSoundCategory()

string GetSoundCategory ( int recipeID,
ItemBase item1,
ItemBase item2 )
inlineprotected
633 {
635 ItemBase sorted[2];
636
637 unsorted[0] = item1;
638 unsorted[1] = item2;
639
641
643 string soundCat = recipe.GetSoundCategory(0,sorted[0]);
644
645 if (!soundCat)
646 {
647 soundCat = recipe.GetSoundCategory(1,sorted[1]);
648 }
649
650 return soundCat;
651 }
Definition InventoryItem.c:731
bool SortIngredientsInRecipe(int id, int num_of_ingredients, ItemBase ingredients_unsorted[], ItemBase ingredients_sorted[])
sorts ingredients correctly as either first or second ingredient based on their masks
Definition PluginRecipesManager.c:462

Перекрестные ссылки SortIngredientsInRecipe().

◆ GetValidRecipes()

int GetValidRecipes ( ItemBase item1,
ItemBase item2,
array< int > ids,
PlayerBase player )
inlineprivate
87 {
88 if ( item1 == NULL || item2 == NULL )
89 {
90 if (ids) ids.Clear();
91 return 0;
92 }
93
94 if ( ( item1.GetInventory().IsAttachment() && item1.GetHierarchyParent().DisassembleOnLastDetach() ) || ( item2.GetInventory().IsAttachment() && item2.GetHierarchyParent().DisassembleOnLastDetach() ) )
95 {
96 if (ids) ids.Clear();
97 return 0;
98 }
100 m_Ingredients[1] = item2;
101
103 }
ItemBase m_Ingredients[MAX_INGREDIENTS]
Definition PluginRecipesManager.c:27
int GetValidRecipesProper(int num_of_items, ItemBase items[], array< int > ids, PlayerBase player)
Definition PluginRecipesManager.c:105

Перекрестные ссылки GetValidRecipesProper().

◆ GetValidRecipesProper()

int GetValidRecipesProper ( int num_of_items,
ItemBase items[],
array< int > ids,
PlayerBase player )
inlineprivate
106 {
107 if (ids) ids.Clear();
110 //will return number of cached recipes for the 2 items being considered,
111 //and save their indexes in m_ResolvedRecipes, please note the m_ResolvedRecipes is a static array,
112 //and does not clear up with each query, so the number of recipes returned is critical to make sure we don't accidentally
113 //mix in some other indexes from previous queries(and obviously loop only as far as we have to)
114 //this also saves the ingredients in the correct assignment as ingredient 1/2 into m_ingredient1/m_ingredient2 arrays, these 3 arrays
115 //therefore provide you with information per each index with: recipeid,ingredient1,ingredient2
116 if ( numOfRecipes == 0 ) return 0;
117 int found = 0;
119 for (int i = 0; i < numOfRecipes; i++)
120 {
122
123 if ( p_recipe.CheckRecipe(m_ingredient1[i],m_ingredient2[i], player) == true )
124 {
125 if (ids) ids.Insert( p_recipe.GetID() );
126 found++;
127 }
128 }
129 return found;
130 }
int GetRecipeIntersection(int num_of_ingredients, ItemBase items[])
fills an array with recipe IDs which 'item_a' and 'item_b' share
Definition PluginRecipesManager.c:556
int SortIngredients(int num_of_ingredients, ItemBase items_unsorted[], int resolved_recipes[])
Definition PluginRecipesManager.c:606
int m_ResolvedRecipes[MAX_CONCURENT_RECIPES]
Definition PluginRecipesManager.c:24
ItemBase m_ingredient2[MAX_CONCURENT_RECIPES]
Definition PluginRecipesManager.c:34
ItemBase m_ingredient1[MAX_CONCURENT_RECIPES]
Definition PluginRecipesManager.c:33

Перекрестные ссылки GetRecipeIntersection() и SortIngredients().

Используется в GetValidRecipes().

◆ IsEnableDebugCrafting()

bool IsEnableDebugCrafting ( )
inlineprivate
67 {
69 }
bool m_EnableDebugCrafting
Definition PluginRecipesManager.c:26

Перекрестные ссылки m_EnableDebugCrafting.

◆ MatchItems()

void MatchItems ( TStringArray full_path)
inlineprotected
251 {
252 m_ItemName = full_path.Get(0);
254 //Print(m_ItemName);
255 if ( !m_CoItem )
256 {
257 m_CoItem = new CacheObject;
259 }
260 for (int i = 1; i < full_path.Count(); i++)
261 {
262 m_BaseName = full_path.Get(i);
264 if ( m_CoBase )//resolve new base classes
265 {
266 m_RcpsArray = m_RecipeCache.Get(m_BaseName).GetRecipes();
267
268 for ( int x = 0; x < m_RcpsArray.Count(); x++ )//base recipes
269 {
270 m_RecipeID = m_RcpsArray.Get(x);
271
272 //item_mask = m_CoItem.GetMaskByRecipeID(m_RecipeID);
273 m_BaseMask = m_CoBase.GetMaskByRecipeID(m_RecipeID);
274
275 m_CoItem.AddRecipe(m_RecipeID,m_BaseMask);
276 }
277 }
278 }
279
280
281 }
string m_BaseName
Definition PluginRecipesManager.c:241
static ref map< string, ref CacheObject > m_RecipeCache
Definition PluginRecipesManager.c:14
ref CacheObject m_CoItem
Definition PluginRecipesManager.c:246
ref CacheObject m_CoBase
Definition PluginRecipesManager.c:247
string m_ItemName
Definition PluginRecipesManager.c:245
int m_BaseMask
Definition PluginRecipesManager.c:244
ref array< int > m_RcpsArray
Definition PluginRecipesManager.c:240
int m_RecipeID
Definition PluginRecipesManager.c:242

Перекрестные ссылки CacheObject(), m_ItemName, m_RecipeID и x.

Используется в GenerateRecipeCache().

◆ OnInit()

override void OnInit ( )
inlineprivate
152 {
153 super.OnInit();
154 //ReadCacheFromFile(PATH_CACHE_FILE);//read the cache from a file
155 //GenerateHumanReadableRecipeList();
156 }

◆ PerformRecipeServer()

void PerformRecipeServer ( int id,
ItemBase item_a,
ItemBase item_b,
PlayerBase player )
inlineprotected
284 {
287
288 if ( !item_a || !item_b )
289 {
290 Error("PerformRecipeServer - one of the items null !!");
291 return;
292 }
293
295
298
299 if ( !is_recipe_valid )
300 {
301 Error("PerformRecipeServer - recipe not valid !!");
302 return;
303 }
304 if ( !passed_sanity_check )
305 {
306 Error("PerformRecipeServer - recipe failed to pass sanity check !!");
307 return;
308 }
311 //player.RequestCraftingDisable();
312
313 }
bool RecipeSanityCheck(int num_of_ingredients, InventoryItemBase items[], PlayerBase player)
Definition PluginRecipesManager.c:373
bool CheckRecipe(int id, ItemBase item1, ItemBase item2, PlayerBase player)
Definition PluginRecipesManager.c:443
ItemBase m_sortedIngredients[MAX_NUMBER_OF_INGREDIENTS]
Definition PluginRecipesManager.c:37
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки CheckRecipe(), Error(), RecipeSanityCheck() и SortIngredientsInRecipe().

◆ PluginRecipesManager()

void PluginRecipesManager ( )
inlineprivate
53 {
54
57
58 myTimer1 = new Timer();
59 }
void CreateAllRecipes()
Definition PluginRecipesManager.c:626
ref Timer myTimer1
Definition PluginRecipesManager.c:45
Definition DayZPlayerImplement.c:63

Перекрестные ссылки CreateAllRecipes(), GenerateRecipeCache() и myTimer1.

◆ PrintCache()

void PrintCache ( )
inlineprotected
450 {
451 for (int i = 0; i < PluginRecipesManager.m_RecipeCache.Count(); i++)
452 {
453 string key = PluginRecipesManager.m_RecipeCache.GetKey(i);
454 CacheObject co = PluginRecipesManager.m_RecipeCache.GetElement(i);
455
456 PrintString("Item: " + key);
457 co.DebugPrint();
458 PrintString("----------------");
459 }
460 }

Перекрестные ссылки CacheObject() и PrintString().

◆ PrintResultMasks()

void PrintResultMasks ( int num)
inlineprotected
548 {
549 for (int i = 0; i < num; i++)
550 {
551 Debug.Log("results mask("+i.ToString()+") = " +m_BitsResults[i].ToString() );
552 }
553 }

Перекрестные ссылки Debug::Log().

◆ RecipeIDFromClassname()

static int RecipeIDFromClassname ( string classname)
inlinestaticprotected
437 {
438 if (m_RecipeNamesList.Contains(classname))
439 return m_RecipeNamesList.Get(classname);
440 return -1;
441 }
static ref map< string, int > m_RecipeNamesList
Definition PluginRecipesManager.c:43

Используется в UnregisterRecipe().

◆ RecipeSanityCheck()

bool RecipeSanityCheck ( int num_of_ingredients,
InventoryItemBase items[],
PlayerBase player )
inlineprotected
374 {
376
377 for (int i = 0; i < num_of_ingredients;i++)
378 {
379 ItemBase item = items[i];
380 Man item_owner_player = item.GetHierarchyRootPlayer();
381 vector item_pos = item.GetPosition();
382 vector player_pos = player.GetPosition();
383
385 {
386 check_results[i] = check_results[i] | ERecipeSanityCheck.IS_IN_PLAYER_INVENTORY;
387 }
388
390 {
391 check_results[i] = check_results[i] | ERecipeSanityCheck.NOT_OWNED_BY_ANOTHER_LIVE_PLAYER;
392 }
393
395 {
397 }
398 }
399 for (i = 0; i < num_of_ingredients;i++)
400 {
402 {
403 return false;
404 }
405 }
406 return true;
407 }
const int SANITY_CHECK_ACCEPTABLE_RESULT
Definition PluginRecipesManager.c:10
ERecipeSanityCheck
Definition PluginRecipesManager.c:2
enum ERecipeSanityCheck ACCEPTABLE_DISTANCE
Definition EnConvert.c:106
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

Перекрестные ссылки ACCEPTABLE_DISTANCE, vector::Distance(), MAX_INGREDIENTS и SANITY_CHECK_ACCEPTABLE_RESULT.

Используется в PerformRecipeServer().

◆ RegisterRecipe()

void RegisterRecipe ( RecipeBase recipe)
inlineprotected
410 {
411
413 {
414 Error("Exceeded max. number of recipes, max set to: "+MAX_NUMBER_OF_RECIPES.ToString());
415 }
416
419 m_RecipeNamesList.Insert(recipe.ClassName(), m_RegRecipeIndex);
420 //Print("RegisterRecipe: " +recipe.ClassName() + ", "+ m_RegRecipeIndex.ToString());
421 }
int m_RegRecipeIndex
Definition PluginRecipesManager.c:23
const int MAX_NUMBER_OF_RECIPES
Definition PluginRecipesManager.c:19

Перекрестные ссылки Error().

Используется в RegisterRecipies().

◆ ResolveIngredients()

bool ResolveIngredients ( int num_of_ingredients,
int passes = 0 )
inlineprotected
497 {
498 int rightmost_bit;
499 int smallest = 99999;
500 int smallest_index = 0;
501
502 for (int i = 0; i < num_of_ingredients; i++)
503 {
505 if ( count != 0 && count < smallest)
506 {
509 }
510 }
511
514
515 for (int x = 0; x < num_of_ingredients; x++)
516 {
520 }
521
522 // check validity
523 int check_sum_vertical = 0;
524
525 for (int z = 0; z < num_of_ingredients; z++)
526 {
529 if ((m_IngredientBitMask[z] | m_BitsResults[z]) == 0)
530 {
531 return false;//horizontal check
532 }
533 }
534
535 if ( check_sum_vertical != (Math.Pow(2, num_of_ingredients) - 1)) return false;//vertical check
536
537 passes++;
538
540 {
541 if ( !ResolveIngredients(num_of_ingredients, passes) ) return false;
542 }
543 return true;
544 }
Definition EnMath.c:7
int m_IngredientBitMask[MAX_INGREDIENTS]
Definition PluginRecipesManager.c:28
int m_IngredientBitMaskSize[MAX_INGREDIENTS]
Definition PluginRecipesManager.c:29
bool ResolveIngredients(int num_of_ingredients, int passes=0)
Definition PluginRecipesManager.c:496
static proto float Pow(float v, float power)
Return power of v ^ power.

Перекрестные ссылки Math::Pow(), ResolveIngredients() и x.

Используется в ResolveIngredients() и SortIngredientsInRecipe().

◆ SetEnableDebugCrafting()

void SetEnableDebugCrafting ( bool enable)
inlineprivate
72 {
74 }

◆ SortIngredients()

int SortIngredients ( int num_of_ingredients,
ItemBase items_unsorted[],
int resolved_recipes[] )
inlineprotected
607 {
608 int count = 0;
609 for (int i = 0; i < m_RecipesMatched.Count() && i < MAX_CONCURENT_RECIPES; i++)
610 {
611 int recipe_id = m_RecipesMatched.Get(i);
612
613 if (SortIngredientsInRecipe(recipe_id, num_of_ingredients, items_unsorted, m_sortedIngredients))//...and now we need to determine which item will be which ingredient number
614 {
618 //m_ingredient3[count] = m_sortedIngredients[2];
619 count++;
620 }
621 }
622 return count;
623 }
const int MAX_CONCURENT_RECIPES
Definition PluginRecipesManager.c:20

Перекрестные ссылки SortIngredientsInRecipe().

Используется в GetValidRecipesProper().

◆ SortIngredientsInRecipe()

bool SortIngredientsInRecipe ( int id,
int num_of_ingredients,
ItemBase ingredients_unsorted[],
ItemBase ingredients_sorted[] )
inlineprotected

sorts ingredients correctly as either first or second ingredient based on their masks

463 {
464 ClearResults();
465
466 for (int i = 0; i < num_of_ingredients; i++)
467 {
469 m_IngredientBitMask[i] = co_item.GetMaskByRecipeID(id);
470 m_IngredientBitMaskSize[i] = co_item.GetBitCountByRecipeID(id);
471 }
472
474
475 if (result)
476 {
477 for (i = 0; i < num_of_ingredients; i++)
478 {
479 int index = Math.Log2( m_BitsResults[i]);
481 }
482 }
483 //PrintResultMasks(num_of_ingredients);
484 return result;
485 }
void ClearResults()
Definition PluginRecipesManager.c:487
static proto float Log2(float x)
Returns the binary (base-2) logarithm of x.

Перекрестные ссылки CacheObject(), ClearResults(), GetType(), Math::Log2() и ResolveIngredients().

Используется в GetSoundCategory(), PerformRecipeServer() и SortIngredients().

◆ UnregisterRecipe()

void UnregisterRecipe ( string clasname)
inlineprotected
424 {
426 //Print("UnregisterRecipe: " + recipe_id.ToString());
427 if (recipe_id != -1)
428 {
430 //Print(m_RecipeList[recipe_id]);
432 //Print(m_RecipeList[recipe_id]);
433 }
434 }
static int RecipeIDFromClassname(string classname)
Definition PluginRecipesManager.c:436

Перекрестные ссылки RecipeIDFromClassname().

◆ WalkRecipes()

void WalkRecipes ( )
inlineprotected
207 {
208 //Print("------------- WalkRecipes --------------");
209 for (int c = 0; c < m_RecipeList.Count(); c++)
210 {
212 if (recipe)
213 {
214 //Print(recipe.ClassName());
215 int recipe_id = recipe.GetID();
216 for (int i = 0; i < MAX_NUMBER_OF_INGREDIENTS; i++)
217 {
218 array<string> list = recipe.m_Ingredients[i];
219
220 for (int x = 0; x < list.Count(); x++)
221 {
222 string ingredient = list.Get(x);
223 int mask = Math.Pow(2,i);
225
226 if (!co)
227 {
228 co = new CacheObject;
230 }
231 co.AddRecipe(recipe_id, mask);
232 }
233 }
234 }
235 }
236 }
const int MAX_NUMBER_OF_INGREDIENTS
Definition RecipeBase.c:1

Перекрестные ссылки CacheObject(), MAX_NUMBER_OF_INGREDIENTS, Math::Pow() и x.

Используется в GenerateRecipeCache().

Поля

◆ item_mask

int item_mask
protected

◆ m_BaseMask

int m_BaseMask
protected

◆ m_BaseName

string m_BaseName
protected

◆ m_BitsResults

int m_BitsResults[MAX_INGREDIENTS]
private

◆ m_CachedItems

ref array<string> m_CachedItems = new array<string>
private

◆ m_CoBase

ref CacheObject m_CoBase
protected

◆ m_CoItem

ref CacheObject m_CoItem
protected

◆ m_EnableDebugCrafting

bool m_EnableDebugCrafting = false
private

Используется в IsEnableDebugCrafting().

◆ m_ingredient1

ItemBase m_ingredient1[MAX_CONCURENT_RECIPES]
private

◆ m_ingredient2

ItemBase m_ingredient2[MAX_CONCURENT_RECIPES]
private

◆ m_ingredient3

ItemBase m_ingredient3[MAX_CONCURENT_RECIPES]
private

◆ m_IngredientBitMask

int m_IngredientBitMask[MAX_INGREDIENTS]
private

◆ m_IngredientBitMaskSize

int m_IngredientBitMaskSize[MAX_INGREDIENTS]
private

◆ m_Ingredients

ItemBase m_Ingredients[MAX_INGREDIENTS]
private

◆ m_ItemName

string m_ItemName
protected

◆ m_RcpsArray

ref array<int> m_RcpsArray
protected

◆ m_RecipeCache

ref map<string,ref CacheObject > m_RecipeCache = new map<string,ref CacheObject >
staticprivate

◆ m_RecipeID

int m_RecipeID
protected

◆ m_RecipeList

ref array<ref RecipeBase> m_RecipeList = new array<ref RecipeBase>
private

◆ m_RecipeNamesList

ref map<string, int> m_RecipeNamesList = new map<string, int>
staticprivate

◆ m_RecipesInitializedItem

ref map<typename, bool> m_RecipesInitializedItem = new ref map<typename, bool>
staticprivate

◆ m_RecipesMatched

ref array<int> m_RecipesMatched = new array<int>
private

◆ m_RegRecipeIndex

int m_RegRecipeIndex
private

◆ m_ResolvedRecipes

int m_ResolvedRecipes[MAX_CONCURENT_RECIPES]
private

◆ m_sortedIngredients

ItemBase m_sortedIngredients[MAX_NUMBER_OF_INGREDIENTS]
private

◆ m_TestTimer

ref Timer m_TestTimer
private

◆ MAX_CONCURENT_RECIPES

const int MAX_CONCURENT_RECIPES = 128
private

◆ MAX_INGREDIENTS

const int MAX_INGREDIENTS = 5
private

Используется в ClearResults() и RecipeSanityCheck().

◆ MAX_NUMBER_OF_RECIPES

const int MAX_NUMBER_OF_RECIPES = GetMaxNumberOfRecipes()
private

◆ myTimer1

ref Timer myTimer1
private

Объявления и описания членов класса находятся в файле: