clintbellanger / flare

Free Libre Action Roleplaying Engine
http://clintbellanger.net/rpg/
GNU General Public License v3.0
166 stars 41 forks source link

Unable to compile EnemyGroupManager on windows. #68

Closed Paul-Wortmann closed 13 years ago

Paul-Wortmann commented 13 years ago

With regards to the "Merge pull request #67 from pennomi/master":

Unfortunately it does not appear possible to compile EnemyGroupManager on windows. (GNU gcc complier) On attempting to compile the following error is reported:

C:git\flare\src\EnemyGroupManager.cpp|27|error: 'struct dirent' has no member named 'd_type'|

I had a look at the file "dirent.h", and the struct dirent definitely doesn't have a member named d_type. I did a bit of googling and this appears to be a known cross platform issue with regards to windows. Apparently the solution to this is to use sys/stat.h instead. I hope the following links may prove useful:

http://www.jenkinssoftware.com/forum/index.php?topic=1609.0 http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstat.h.html http://groups.google.com/group/comp.os.msdos.djgpp/browse_thread/thread/4becb5bcda3771ee

pennomi commented 13 years ago

Aha! (I was afraid this might be the case). Could someone please look into this for me, as I do not have a Windows box?

clintbellanger commented 13 years ago

Hm my main dev environment is OSX. I can probably work this out on a Windows machine. If someone else gets to it first, feel free.

clintbellanger commented 13 years ago

Rather than rewrite a lot of this code...

How about instead of checking d_type for files, we check for ".txt" in filenames?

clintbellanger commented 13 years ago

So I tried to change the function to check for a specified extension in the name instead of for d_type. See if this solution works under Windows?

Paul-Wortmann commented 13 years ago

Nice solution. :) It now compiles under windows, and the game world is populated with the appropriate enemies. So as far as I can tell everything is as it should be.