Skip to content

Commit

Permalink
Adding ini_file luabind override.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloreck committed Jul 17, 2023
1 parent d19b743 commit 4781b9e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/xrServerEntities/script_ini_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@

CScriptIniFile::CScriptIniFile(IReader* F, LPCSTR path) : inherited(F, path) {}
CScriptIniFile::CScriptIniFile(LPCSTR szFileName, BOOL ReadOnly, BOOL bLoadAtStart, BOOL SaveAtEnd)
: inherited(update(szFileName), ReadOnly, bLoadAtStart, SaveAtEnd)
: inherited(update("$game_config$", szFileName), ReadOnly, bLoadAtStart, SaveAtEnd)
{}
CScriptIniFile::CScriptIniFile(LPCSTR initial, LPCSTR szFileName, BOOL ReadOnly, BOOL bLoadAtStart, BOOL SaveAtEnd)
: inherited(update(initial, szFileName), ReadOnly, bLoadAtStart, SaveAtEnd)
{
}

CScriptIniFile::~CScriptIniFile() {}
LPCSTR CScriptIniFile::update(LPCSTR file_name)
LPCSTR CScriptIniFile::update(LPCSTR initial, LPCSTR file_name)
{
string_path S1;
FS.update_path(S1, "$game_config$", file_name);
FS.update_path(S1, initial, file_name);
return *shared_str(S1);
}

Expand Down
3 changes: 2 additions & 1 deletion src/xrServerEntities/script_ini_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ class CScriptIniFile : public CInifile
public:
CScriptIniFile(IReader* F, LPCSTR path = nullptr);
CScriptIniFile(LPCSTR szFileName, BOOL ReadOnly = TRUE, BOOL bLoadAtStart = TRUE, BOOL SaveAtEnd = TRUE);
CScriptIniFile(LPCSTR initial, LPCSTR szFileName, BOOL ReadOnly = TRUE, BOOL bLoadAtStart = TRUE, BOOL SaveAtEnd = TRUE);
virtual ~CScriptIniFile();
bool line_exist(LPCSTR S, LPCSTR L);
bool section_exist(LPCSTR S);
int r_clsid(LPCSTR S, LPCSTR L);
bool r_bool(LPCSTR S, LPCSTR L);
int r_token(LPCSTR S, LPCSTR L, const CScriptTokenList& token_list);
LPCSTR r_string_wb(LPCSTR S, LPCSTR L);
LPCSTR update(LPCSTR file_name);
LPCSTR update(LPCSTR initial, LPCSTR file_name);
u32 line_count(LPCSTR S);
LPCSTR r_string(LPCSTR S, LPCSTR L);
u32 r_u32(LPCSTR S, LPCSTR L);
Expand Down
1 change: 1 addition & 0 deletions src/xrServerEntities/script_ini_file_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ static void CScriptIniFile_Export(lua_State* luaState)
[
class_<CScriptIniFile>("ini_file")
.def(constructor<pcstr>())
.def(constructor<pcstr, pcstr>())
//Alundaio: Extend script ini file
.def("w_bool", &CScriptIniFile::w_bool)
.def("w_color", &CScriptIniFile::w_color)
Expand Down

0 comments on commit 4781b9e

Please sign in to comment.