Merge pull request #481 from sfall-team/feature/fo-ini-reader

INI Config reader:
- Replaced GetPrivateProfile* functions for reading ini with vanilla-based INI reader.
- Changed IniReader classes to read INI files once using new Config class and cache results until GameReset (going to main menu).
- Added metarule to read entire INI file in one operation and return as two-dimensional map array.
- Increased limits for INI strings to 1021.
This commit is contained in:
NovaRain
2023-06-19 11:22:27 +08:00
committed by GitHub
32 changed files with 774 additions and 292 deletions
+18 -2
View File
@@ -1855,11 +1855,27 @@
opcode: 0x81eb
- name: get_ini_section
detail: array get_ini_section(string file, string sect)
doc: 'Returns an associative array of keys and values for a given INI file and section. NOTE: all keys and their values will be of String type.'
doc: |
Returns an associative array of keys and values for a given INI file and section.
- If INI file is not found, will return an empty array.
- All keys and their values will be of String type.
macro: sfall.h
- name: get_ini_sections
detail: array get_ini_sections(string file)
doc: Returns an array of names of all sections in a given INI file.
doc: |
Returns an array of names of all sections in a given INI file.
- If INI file is not found, will return an empty array.
macro: sfall.h
- name: get_ini_config
detail: array get_ini_config(string file)
doc: |
Loads given INI file and returns a permanent array (map) where keys are section names and values are other permanent arrays (maps) where keys and values are strings.
- File will be searched in normal file system like with all other ini-related functions.
- Subsequent calls for the same file will return the same array, unless it was disposed using free_array.
macro: sfall.h
- name: get_ini_config_db
detail: array get_ini_config_db(string file)
doc: Works exactly like get_ini_config except files are loaded from database (DAT) instead of regular file system.
macro: sfall.h
- name: set_ini_setting
detail: void set_ini_setting(string setting, int/string value)
+2
View File
@@ -307,6 +307,8 @@
#define get_current_terrain_name sfall_func0("get_terrain_name")
#define get_cursor_mode sfall_func0("get_cursor_mode")
#define get_flags(obj) sfall_func1("get_flags", obj)
#define get_ini_config(file) sfall_func2("get_ini_config", file, 0)
#define get_ini_config_db(file) sfall_func2("get_ini_config", file, 1)
#define get_ini_section(file, sect) sfall_func2("get_ini_section", file, sect)
#define get_ini_sections(file) sfall_func1("get_ini_sections", file)
#define get_interface_rect(winType) sfall_func2("get_window_attribute", winType, -1)