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

support subdirectory #2152

Closed
wants to merge 29 commits into from
Closed

support subdirectory #2152

wants to merge 29 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 29, 2018

#2077
rewrite for linux(Sorry I caughtn't debug).

@ghost ghost mentioned this pull request Oct 29, 2018
@purerosefallen
Copy link
Collaborator

Too much grammar mistakes.

         ..\gframe\game.cpp(977): error C2144: 语法错误:“char”的前面应有“;” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\game.cpp(987): error C2143: 语法错误: 缺少“;”(在“}”的前面) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\game.cpp(1045): error C2144: 语法错误:“char”的前面应有“;” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\game.cpp(1055): error C2143: 语法错误: 缺少“;”(在“}”的前面) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\game.cpp(1078): error C2143: 语法错误: 缺少“;”(在“}”的前面) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\replay_mode.cpp(942): error C2589: “::”:“::”右边的非法标记 [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\replay_mode.cpp(942): error C2059: 语法错误:“::” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\replay_mode.cpp(942): error C2039: “ScriptReaderEx”: 不是“`global namespace'”的成员 [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\replay_mode.cpp(942): error C2143: 语法错误: 缺少“;”(在“{”的前面) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\replay_mode.cpp(942): error C2447: “{”: 缺少函数标题(是否是老式的形式表?) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\replay_mode.cpp(989): error C2440: “初始化”: 无法从“const char *”转换为“char [256]” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_duel.cpp(1555): error C2589: “::”:“::”右边的非法标记 [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_duel.cpp(1555): error C2059: 语法错误:“::” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_duel.cpp(1555): error C2039: “ScriptReaderEx”: 不是“`global namespace'”的成员 [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_duel.cpp(1555): error C2143: 语法错误: 缺少“;”(在“{”的前面) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_duel.cpp(1555): error C2447: “{”: 缺少函数标题(是否是老式的形式表?) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_duel.cpp(1602): error C2440: “初始化”: 无法从“const char *”转换为“char [256]” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_mode.cpp(863): error C2589: “::”:“::”右边的非法标记 [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_mode.cpp(863): error C2059: 语法错误:“::” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_mode.cpp(863): error C2039: “ScriptReaderEx”: 不是“`global namespace'”的成员 [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_mode.cpp(863): error C2143: 语法错误: 缺少“;”(在“{”的前面) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_mode.cpp(863): error C2447: “{”: 缺少函数标题(是否是老式的形式表?) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\single_mode.cpp(910): error C2440: “初始化”: 无法从“const char *”转换为“char [256]” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\tag_duel.cpp(1696): error C2589: “::”:“::”右边的非法标记 [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\tag_duel.cpp(1696): error C2059: 语法错误:“::” [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\tag_duel.cpp(1696): error C2039: “ScriptReaderEx”: 不是“`global namespace'”的成员 [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\tag_duel.cpp(1696): error C2143: 语法错误: 缺少“;”(在“{”的前面) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\tag_duel.cpp(1696): error C2447: “{”: 缺少函数标题(是否是老式的形式表?) [C:\ygo\ygopro\build\ygopro.vcxproj]
         ..\gframe\tag_duel.cpp(1743): error C2440: “初始化”: 无法从“const char *”转换为“char [256]” [C:\ygo\ygopro\build\ygopro.vcxproj]

    1 个警告
    29 个错误

@purerosefallen
Copy link
Collaborator

purerosefallen/ygopro@d2cfe7d
I fixed them for you, but in my fork.
Danm, so many of them

@ghost
Copy link
Author

ghost commented Nov 2, 2018

24bc8c0 Fixed. Thank you!

@purerosefallen
Copy link
Collaborator

purerosefallen commented Nov 2, 2018

There's one more problem.
. and .. are also counted as a directory, so expansions/strings.conf is loaded twice, the 2nd time as ./expansions/./strings.conf

@ghost
Copy link
Author

ghost commented Nov 3, 2018

50e01d7 fixed.

@purerosefallen
Copy link
Collaborator

https://github.com/nekrozar/ygopro/pull/1
I did the pics thing for you. LFList thing is still developing. 8f435ab perhaps some works around this commit works.

@ghost
Copy link
Author

ghost commented Nov 3, 2018

Sorry I forgot pictuer ditrectory. Thank you!

@purerosefallen
Copy link
Collaborator

Waiting for lflist and it's ready for merge

@mercury233
Copy link
Collaborator

It is a bit weird to write the folder loop 3 times in single_duel.cpp etc.

@purerosefallen
Copy link
Collaborator

You're doing LoadLFList("expansions/SOME_SUB_DIRECTORY/"); which will absolutely not work.

@ghost
Copy link
Author

ghost commented Nov 4, 2018

8464766 fixed.

@purerosefallen
Copy link
Collaborator

==== Building ygopro (release) ====
data_manager.cpp
deck_manager.cpp
game.cpp
gframe.cpp
netserver.cpp
replay.cpp
single_duel.cpp
tag_duel.cpp
../gframe/single_duel.cpp: In static member function ‘static byte* ygo::SingleDuel::ScriptReaderEx(const char*, int*)’:
../gframe/single_duel.cpp:2154:2: error: ‘DIR’ was not declared in this scope
  DIR * dir;
  ^~~
../gframe/single_duel.cpp:2154:2: note: suggested alternative: ‘_IOR’
  DIR * dir;
  ^~~
  _IOR
../gframe/game.cpp: In member function ‘void ygo::Game::LoadExpansionDB()’:
../gframe/game.cpp:1057:2: error: ‘LoadExpansionDBDirectry’ was not declared in this scope
  LoadExpansionDBDirectry("./expansions");
  ^~~~~~~~~~~~~~~~~~~~~~~
../gframe/single_duel.cpp:2154:8: error: ‘dir’ was not declared in this scope
  DIR * dir;
        ^~~
../gframe/single_duel.cpp:2154:8: note: suggested alternative: ‘div’
  DIR * dir;
        ^~~
        div
../gframe/single_duel.cpp:2156:12: error: ‘opendir’ was not declared in this scope
  if((dir = opendir("./expansions/")) != NULL) {
            ^~~~~~~
../gframe/single_duel.cpp:2156:12: note: suggested alternative: ‘open_file’
  if((dir = opendir("./expansions/")) != NULL) {
            ^~~~~~~
            open_file
../gframe/game.cpp:1057:2: note: suggested alternative: ‘LoadExpansionDB’
  LoadExpansionDBDirectry("./expansions");
  ^~~~~~~~~~~~~~~~~~~~~~~
  LoadExpansionDB
../gframe/single_duel.cpp:2157:17: error: ‘readdir’ was not declared in this scope
   while((dirp = readdir(dir)) != NULL) {
                 ^~~~~~~
../gframe/game.cpp: At global scope:
../gframe/game.cpp:1088:52: error: no ‘void ygo::Game::LoadExpansionDBDirectry(const char*)’ member function declared in class ‘ygo::Game’
 void Game::LoadExpansionDBDirectry(const char* path) {
                                                    ^
../gframe/single_duel.cpp:2157:17: note: suggested alternative: ‘ready’
   while((dirp = readdir(dir)) != NULL) {
                 ^~~~~~~
                 ready
../gframe/game.cpp:1124:33: error: no ‘void ygo::Game::LoadExpansionStrings()’ member function declared in class ‘ygo::Game’
 void Game::LoadExpansionStrings() {
                                 ^
../gframe/single_duel.cpp:2158:24: error: invalid use of incomplete type ‘struct ygo::SingleDuel::ScriptReaderEx(const char*, int*)::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                        ^~
../gframe/game.cpp:1156:57: error: no ‘void ygo::Game::LoadExpansionStringsDirectry(const char*)’ member function declared in class ‘ygo::Game’
 void Game::LoadExpansionStringsDirectry(const char* path) {
                                                         ^
../gframe/single_duel.cpp:2155:9: note: forward declaration of ‘struct ygo::SingleDuel::ScriptReaderEx(const char*, int*)::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/deck_manager.cpp: In member function ‘void ygo::DeckManager::LoadLFList()’:
../gframe/deck_manager.cpp:75:2: error: ‘DIR’ was not declared in this scope
  DIR * dir;
  ^~~
../gframe/game.cpp:1891:30: error: no ‘void ygo::Game::ErrorLog(char*)’ member function declared in class ‘ygo::Game’
 void Game::ErrorLog(char* msg) {
                              ^
../gframe/single_duel.cpp:2158:59: error: invalid use of incomplete type ‘struct ygo::SingleDuel::ScriptReaderEx(const char*, int*)::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                           ^~
../gframe/deck_manager.cpp:75:2: note: suggested alternative: ‘_IOR’
  DIR * dir;
  ^~~
  _IOR
../gframe/single_duel.cpp:2155:9: note: forward declaration of ‘struct ygo::SingleDuel::ScriptReaderEx(const char*, int*)::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/deck_manager.cpp:75:8: error: ‘dir’ was not declared in this scope
  DIR * dir;
        ^~~
../gframe/tag_duel.cpp: In static member function ‘static byte* ygo::TagDuel::ScriptReaderEx(const char*, int*)’:
../gframe/tag_duel.cpp:2314:2: error: ‘DIR’ was not declared in this scope
  DIR * dir;
  ^~~
../gframe/single_duel.cpp:2158:81: error: invalid use of incomplete type ‘struct ygo::SingleDuel::ScriptReaderEx(const char*, int*)::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                 ^~
../gframe/deck_manager.cpp:75:8: note: suggested alternative: ‘div’
  DIR * dir;
        ^~~
        div
../gframe/tag_duel.cpp:2314:2: note: suggested alternative: ‘_IOR’
  DIR * dir;
  ^~~
  _IOR
../gframe/single_duel.cpp:2155:9: note: forward declaration of ‘struct ygo::SingleDuel::ScriptReaderEx(const char*, int*)::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/deck_manager.cpp:77:12: error: ‘opendir’ was not declared in this scope
  if((dir = opendir("./expansions/")) != NULL) {
            ^~~~~~~
../gframe/tag_duel.cpp:2314:8: error: ‘dir’ was not declared in this scope
  DIR * dir;
        ^~~
../gframe/single_duel.cpp:2158:93: error: ‘DT_DIR’ was not declared in this scope
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                             ^~~~~~
../gframe/deck_manager.cpp:77:12: note: suggested alternative: ‘open_file’
  if((dir = opendir("./expansions/")) != NULL) {
            ^~~~~~~
            open_file
../gframe/tag_duel.cpp:2314:8: note: suggested alternative: ‘div’
  DIR * dir;
        ^~~
        div
../gframe/single_duel.cpp:2158:93: note: suggested alternative: ‘EISDIR’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                             ^~~~~~
                                                                                             EISDIR
../gframe/deck_manager.cpp:78:17: error: ‘readdir’ was not declared in this scope
   while((dirp = readdir(dir)) != NULL) {
                 ^~~~~~~
../gframe/tag_duel.cpp:2316:12: error: ‘opendir’ was not declared in this scope
  if((dir = opendir("./expansions/")) != NULL) {
            ^~~~~~~
../gframe/single_duel.cpp:2161:46: error: invalid use of incomplete type ‘struct ygo::SingleDuel::ScriptReaderEx(const char*, int*)::dirent’
    sprintf(filepath, "./expansions/%s/", dirp->d_name);
                                              ^~
../gframe/deck_manager.cpp:78:17: note: suggested alternative: ‘readv’
   while((dirp = readdir(dir)) != NULL) {
                 ^~~~~~~
                 readv
../gframe/tag_duel.cpp:2316:12: note: suggested alternative: ‘open_file’
  if((dir = opendir("./expansions/")) != NULL) {
            ^~~~~~~
            open_file
../gframe/single_duel.cpp:2155:9: note: forward declaration of ‘struct ygo::SingleDuel::ScriptReaderEx(const char*, int*)::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/deck_manager.cpp:79:24: error: invalid use of incomplete type ‘struct ygo::DeckManager::LoadLFList()::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                        ^~
../gframe/tag_duel.cpp:2317:17: error: ‘readdir’ was not declared in this scope
   while((dirp = readdir(dir)) != NULL) {
                 ^~~~~~~
../gframe/single_duel.cpp:2166:3: error: ‘closedir’ was not declared in this scope
   closedir(dir);
   ^~~~~~~~
../gframe/deck_manager.cpp:76:9: note: forward declaration of ‘struct ygo::DeckManager::LoadLFList()::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/tag_duel.cpp:2317:17: note: suggested alternative: ‘ready’
   while((dirp = readdir(dir)) != NULL) {
                 ^~~~~~~
                 ready
../gframe/single_duel.cpp:2166:3: note: suggested alternative: ‘close’
   closedir(dir);
   ^~~~~~~~
   close
../gframe/deck_manager.cpp:79:59: error: invalid use of incomplete type ‘struct ygo::DeckManager::LoadLFList()::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                           ^~
ygopro.make:141: recipe for target '../obj/Release/ygopro/game.o' failed
../gframe/tag_duel.cpp:2318:24: error: invalid use of incomplete type ‘struct ygo::TagDuel::ScriptReaderEx(const char*, int*)::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                        ^~
../gframe/deck_manager.cpp:76:9: note: forward declaration of ‘struct ygo::DeckManager::LoadLFList()::dirent’
  struct dirent * dirp;
         ^~~~~~
make[1]: *** [../obj/Release/ygopro/game.o] Error 1
../gframe/tag_duel.cpp:2315:9: note: forward declaration of ‘struct ygo::TagDuel::ScriptReaderEx(const char*, int*)::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/deck_manager.cpp:79:81: error: invalid use of incomplete type ‘struct ygo::DeckManager::LoadLFList()::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                 ^~
make[1]: *** 正在等待未完成的任务....
../gframe/tag_duel.cpp:2318:59: error: invalid use of incomplete type ‘struct ygo::TagDuel::ScriptReaderEx(const char*, int*)::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                           ^~
../gframe/deck_manager.cpp:76:9: note: forward declaration of ‘struct ygo::DeckManager::LoadLFList()::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/tag_duel.cpp:2315:9: note: forward declaration of ‘struct ygo::TagDuel::ScriptReaderEx(const char*, int*)::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/deck_manager.cpp:79:93: error: ‘DT_DIR’ was not declared in this scope
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                             ^~~~~~
../gframe/tag_duel.cpp:2318:81: error: invalid use of incomplete type ‘struct ygo::TagDuel::ScriptReaderEx(const char*, int*)::dirent’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                 ^~
../gframe/deck_manager.cpp:79:93: note: suggested alternative: ‘EISDIR’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                             ^~~~~~
                                                                                             EISDIR
../gframe/tag_duel.cpp:2315:9: note: forward declaration of ‘struct ygo::TagDuel::ScriptReaderEx(const char*, int*)::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/deck_manager.cpp:82:45: error: invalid use of incomplete type ‘struct ygo::DeckManager::LoadLFList()::dirent’
    sprintf(filepath, "./expansions/%s", dirp->d_name);
                                             ^~
../gframe/tag_duel.cpp:2318:93: error: ‘DT_DIR’ was not declared in this scope
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                             ^~~~~~
../gframe/deck_manager.cpp:76:9: note: forward declaration of ‘struct ygo::DeckManager::LoadLFList()::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/tag_duel.cpp:2318:93: note: suggested alternative: ‘EISDIR’
    if (strcmp(".", dirp->d_name) == 0 || strcmp("..", dirp->d_name) == 0 || dirp->d_type != DT_DIR)
                                                                                             ^~~~~~
                                                                                             EISDIR
../gframe/deck_manager.cpp:85:3: error: ‘closedir’ was not declared in this scope
   closedir(dir);
   ^~~~~~~~
../gframe/tag_duel.cpp:2321:46: error: invalid use of incomplete type ‘struct ygo::TagDuel::ScriptReaderEx(const char*, int*)::dirent’
    sprintf(filepath, "./expansions/%s/", dirp->d_name);
                                              ^~
../gframe/tag_duel.cpp:2315:9: note: forward declaration of ‘struct ygo::TagDuel::ScriptReaderEx(const char*, int*)::dirent’
  struct dirent * dirp;
         ^~~~~~
../gframe/deck_manager.cpp:85:3: note: suggested alternative: ‘close’
   closedir(dir);
   ^~~~~~~~
   close
../gframe/tag_duel.cpp:2326:3: error: ‘closedir’ was not declared in this scope
   closedir(dir);
   ^~~~~~~~
../gframe/tag_duel.cpp:2326:3: note: suggested alternative: ‘close’
   closedir(dir);
   ^~~~~~~~
   close
ygopro.make:153: recipe for target '../obj/Release/ygopro/single_duel.o' failed
make[1]: *** [../obj/Release/ygopro/single_duel.o] Error 1
ygopro.make:138: recipe for target '../obj/Release/ygopro/deck_manager.o' failed
make[1]: *** [../obj/Release/ygopro/deck_manager.o] Error 1
ygopro.make:156: recipe for target '../obj/Release/ygopro/tag_duel.o' failed
make[1]: *** [../obj/Release/ygopro/tag_duel.o] Error 1
Makefile:50: recipe for target 'ygopro' failed
make: *** [ygopro] Error 2

I'm sorry to say that it failed to compile on Linux (Using GCC 8.2.0).

@purerosefallen
Copy link
Collaborator

purerosefallen commented Nov 4, 2018

In addition, the script reader is broken in this way. 4b637e1 Here's an example. Please follow this to fix up in other script readers.

.. done for you

@purerosefallen
Copy link
Collaborator

Now everything is pretty fine. Just wait for @DailyShana and @mercury233 's opinion.

@DailyShana
Copy link
Contributor

so every subdirectory of ./expansion contains a complete set of configure files of ygopro?
it's terrible...
if there are pics, scripts, ... that have the same name, which one is actually loaded is out of control.

@purerosefallen
Copy link
Collaborator

purerosefallen commented Nov 4, 2018

It's for different extra packs. Like the 1st folder for pre-release cards, the 2nd for custom cards.. etc
Question: currently, what if 2 of the expansion databases contain the cards with same code?
Anyway, this feature is quite useful in server, especially when the folders under expansions folders are git repos.

@DailyShana
Copy link
Contributor

During the updating this branch, I found the expansions/pics, expansions/script,... directories are also treated as expansion directories, which is inappropriate.
So I think we should use zip files to expansion but not subdirectories.

@purerosefallen
Copy link
Collaborator

How to do zips? Any other libraries?
In addition, in server, zips are not very easy to manage, especially those script files. A single script update will make the server downloading the entire archive. So are the players.

@ghost ghost mentioned this pull request Jul 13, 2019
@ghost
Copy link
Author

ghost commented Jul 13, 2019

move #2223.

@ghost ghost closed this Jul 13, 2019
@ghost ghost deleted the patch-2 branch July 13, 2019 11:22
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants