Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Adding ini_file luabind constructor override. #1401

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,13 +15,17 @@

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)
{
}

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,10 +18,11 @@ 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);

int r_clsid(LPCSTR S, LPCSTR L);
int r_token(LPCSTR S, LPCSTR L, const CScriptTokenList& token_list);
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