diff options
| author | Mosder <xmosder12@gmail.com> | 2026-07-14 17:25:04 +0200 |
|---|---|---|
| committer | Mosder <xmosder12@gmail.com> | 2026-07-14 17:25:04 +0200 |
| commit | 189fd56b24859a89d71899e070f885e93ffabd97 (patch) | |
| tree | 41c1ed6470731a959d0168951b3c156071800ffa /analyzer/parser | |
| parent | c7277e7654c0d8d0e7a4665373c0762c6e8a038d (diff) | |
feat: created converter from CSV files to a C header files containing static arrays. Used for creating ID to STR conversion for saturations and items.
Diffstat (limited to 'analyzer/parser')
| -rw-r--r-- | analyzer/parser/fight_results.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/analyzer/parser/fight_results.c b/analyzer/parser/fight_results.c index 65e72ea..b3227e2 100644 --- a/analyzer/parser/fight_results.c +++ b/analyzer/parser/fight_results.c @@ -4,6 +4,9 @@ #include <stdlib.h> #include <string.h> +#include "csv/id_to_item_name.h" +#include "csv/id_to_saturation_type.h" + // function to cleanup fight results to be used in ParsedData struct void cleanup_fight_results(void *data) { FightResults *fight_results = data; @@ -79,6 +82,14 @@ EntityResults get_entity_results(byte_t *data, size_t length) { return results; } +char *get_item_name(int item_id) { + return item_id < id_to_item_name_len ? id_to_item_name[item_id] : "item_id out of bounds"; +} + +char *get_saturation_type(int saturation_id) { + return saturation_id < id_to_saturation_type_len ? id_to_saturation_type[saturation_id] : "saturation_id out of bounds"; +} + // parse EntityResults to FriendlyResults FriendlyResults parse_to_friendly(EntityResults entity_results) { FriendlyResults results; @@ -100,8 +111,7 @@ FriendlyResults parse_to_friendly(EntityResults entity_results) { if (strlen(entity_results.saturation) > 0) { int saturation_id; sscanf(entity_results.saturation, "%d,%d", &saturation_id, &results.saturation); - // TODO: determine type - results.saturation_type = "typ"; + results.saturation_type = get_saturation_type(saturation_id); } return results; |
