DataManager: add DefaultScriptReader #2624
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
single mode will read the wrong script
In
single
1234.lua
In
expansions/abc.zip
single/1234.lua
choose 1234.lua in listbox
The single mode will read the file in
expansions/abc.zip
.如果存在以上檔名
在單人模式選擇1234.lua
將會讀取
expansions/abc.zip
內部的檔案而不是實體目錄
./single
的檔案gameConf.prefer_expansion_script
does not workIn
expansions/abc.zip
script/constant.lua
set
gameConf.prefer_expansion_script
to 0It will still read the file in
expansions/abc.zip
.即使
gameConf.prefer_expansion_script
設為0仍然會優先讀取
expansions/abc.zip
內部的constant.luaReason:
ygopro/gframe/game.cpp
Line 1162 in 298b43a
In dataManager.FileSystem,
./script/constant.lua
refers to the file in zip.ScriptReader uses dataManager.FileSystem to read the script, so it will always read the file in zip.
如果使用dataManager.FileSystem讀取
constant.lua會被加入
./script
取代原本的檔案ScriptReader使用dataManager.FileSystem
因此不管選項是on/off都會讀到zip內部的constant.lua
nested directive
In
expansions/abc.zip
expansions/script/constant.lua
set
gameConf.prefer_expansion_script
to 1It will read the file in
expansions/abc.zip
.如果
gameConf.prefer_expansion_script
設為1ScriptReader將會讀取zip內部的
expansions/script/constant.lua
solution
DefaultScriptReader
It will read the script by C function
fread
, and it will not read from zip file.使用fread,只讀取實體目錄而不包含zip
Single mode script
It will search from
./single
只在
./single
搜尋Card script
It will search from the following path
dataManager.FileSystem (including files in zip)
./script
./expansions/script
從以上路徑搜尋
@mercury233
@purerosefallen
@Wind2009-Louse
@fallenstardust