diff --git a/README.md b/README.md index e0ca88b..63550a1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ This game is inspired by classic 2D RPGs (Final Fantasy, The Legend of Zelda), a ## Releases -The most recent stable build for Windows can be found [here](https://dl.dropboxusercontent.com/u/46669050/Tortuga.rar). +* The most recent stable build for Windows can be found [here](https://dl.dropboxusercontent.com/u/46669050/Tortuga-win.rar). +* The most recent stable build for Linux can be found [here](https://dl.dropboxusercontent.com/u/46669050/Tortuga-linux.tar). ## Documentation @@ -16,13 +17,14 @@ The most recent stable build for Windows can be found [here](https://dl.dropboxu ## External Dependencies * [SDL 1.2](http://www.libsdl.org/) - Simple DirectMedia Layer API -* [SDL_net 1.2](http://www.libsdl.org/projects/SDL_net/) - SDL's networking extension +* [SDL_net 2.0](http://www.libsdl.org/projects/SDL_net/) - SDL's networking extension * [lua 5.2](http://www.lua.org/) - The lua programming language * [SQLite3](http://www.sqlite.org/) - A lightweight SQL database engine ## Tools -* [WinRAR](http://www.rarlab.com/) - The best compression tool available IMO; only needed for distribution +* [WinRAR](http://www.rarlab.com/) - The best compression tool available IMO; only needed for Windows distribution +* [Dropbox](https://www.dropbox.com/) - For hosting and distribution ## Copyright diff --git a/client/client_application.cpp b/client/client_application.cpp index cbb670d..4e7ea67 100644 --- a/client/client_application.cpp +++ b/client/client_application.cpp @@ -27,6 +27,7 @@ #include #include #include +#include //------------------------- //Scene headers @@ -57,7 +58,9 @@ void ClientApplication::Init(int argc, char* argv[]) { //initialize SDL if (SDL_Init(SDL_INIT_VIDEO)) { - throw(std::runtime_error("Failed to initialize SDL")); + std::ostringstream os; + os << "Failed to initialize SDL: " << SDL_GetError(); + throw(std::runtime_error(os.str())); } std::cout << "Initialized SDL" << std::endl; diff --git a/client/client_utilities/makefile b/client/client_utilities/makefile index 4a01dcd..803bbcf 100644 --- a/client/client_utilities/makefile +++ b/client/client_utilities/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/client/entities/makefile b/client/entities/makefile index a426eda..6d25c17 100644 --- a/client/entities/makefile +++ b/client/entities/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/client/gameplay_scenes/makefile b/client/gameplay_scenes/makefile index c11a607..40fc4ee 100644 --- a/client/gameplay_scenes/makefile +++ b/client/gameplay_scenes/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/client/gameplay_scenes/world_characters.cpp b/client/gameplay_scenes/world_characters.cpp index fe6459e..377bc05 100644 --- a/client/gameplay_scenes/world_characters.cpp +++ b/client/gameplay_scenes/world_characters.cpp @@ -23,6 +23,7 @@ #include "channels.hpp" +#include #include #include #include diff --git a/client/gameplay_scenes/world_logic.cpp b/client/gameplay_scenes/world_logic.cpp index c0ff20e..a75833e 100644 --- a/client/gameplay_scenes/world_logic.cpp +++ b/client/gameplay_scenes/world_logic.cpp @@ -22,11 +22,12 @@ #include "world.hpp" #include "channels.hpp" - #include "terminal_error.hpp" + #include #include #include +#include #include #include diff --git a/client/makefile b/client/makefile index b931b13..5013094 100644 --- a/client/makefile +++ b/client/makefile @@ -1,5 +1,5 @@ #include directories -INCLUDES+=. client_utilities entities gameplay_scenes menu_scenes ../common/debugging ../common/gameplay ../common/graphics ../common/map ../common/network ../common/network/packet_types ../common/ui ../common/utilities +INCLUDES+=SDL . client_utilities entities gameplay_scenes menu_scenes ../common/debugging ../common/gameplay ../common/graphics ../common/map ../common/network ../common/network/packet_types ../common/ui ../common/utilities #libraries #the order of the $(LIBS) is important, at least for MinGW @@ -45,6 +45,12 @@ $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< clean: +ifeq ($(OS),Windows_NT) $(RM) *.o *.a *.exe +else ifeq ($(shell uname), Linux) + find . -type f -name *.o -exec rm -f -r -v {} \; + find . -type f -name *.a -exec rm -f -r -v {} \; + rm -f -v out/client out/server +endif rebuild: clean all diff --git a/client/menu_scenes/makefile b/client/menu_scenes/makefile index 24dfb60..e006dc4 100644 --- a/client/menu_scenes/makefile +++ b/client/menu_scenes/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/debugging/makefile b/common/debugging/makefile index 9013447..104b518 100644 --- a/common/debugging/makefile +++ b/common/debugging/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/gameplay/makefile b/common/gameplay/makefile index 9013447..104b518 100644 --- a/common/gameplay/makefile +++ b/common/gameplay/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/graphics/makefile b/common/graphics/makefile index afcde11..0d2afc1 100644 --- a/common/graphics/makefile +++ b/common/graphics/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/makefile b/common/makefile index bdb1406..e2d1029 100644 --- a/common/makefile +++ b/common/makefile @@ -6,8 +6,3 @@ all: $(MAKE) -C network $(MAKE) -C ui $(MAKE) -C utilities - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/map/makefile b/common/map/makefile index 769709e..2020f4a 100644 --- a/common/map/makefile +++ b/common/map/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/network/makefile b/common/network/makefile index 2caa8d4..f1d2063 100644 --- a/common/network/makefile +++ b/common/network/makefile @@ -31,8 +31,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/network/packet_types/makefile b/common/network/packet_types/makefile index 21223de..241fc55 100644 --- a/common/network/packet_types/makefile +++ b/common/network/packet_types/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/network/packet_types/serial_packet_base.hpp b/common/network/packet_types/serial_packet_base.hpp index 711fce2..9fc7e8f 100644 --- a/common/network/packet_types/serial_packet_base.hpp +++ b/common/network/packet_types/serial_packet_base.hpp @@ -24,7 +24,7 @@ #include "serial_packet_type.hpp" -#include "SDL/SDL_net.h" +#include "SDL_net.h" constexpr int PACKET_STRING_SIZE = 100; diff --git a/common/network/udp_network_utility.hpp b/common/network/udp_network_utility.hpp index a162d89..a4452ae 100644 --- a/common/network/udp_network_utility.hpp +++ b/common/network/udp_network_utility.hpp @@ -27,7 +27,7 @@ #include "singleton.hpp" //APIs -#include "SDL/SDL_net.h" +#include "SDL_net.h" class UDPNetworkUtility : public Singleton { public: diff --git a/common/ui/makefile b/common/ui/makefile index bd9ffd1..03a0db8 100644 --- a/common/ui/makefile +++ b/common/ui/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/common/utilities/ip_operators.hpp b/common/utilities/ip_operators.hpp index cdfff9e..eeef881 100644 --- a/common/utilities/ip_operators.hpp +++ b/common/utilities/ip_operators.hpp @@ -22,7 +22,7 @@ #ifndef IPOPERATORS_HPP_ #define IPOPERATORS_HPP_ -#include "SDL/SDL_net.h" +#include "SDL_net.h" //these should've come standard bool operator==(IPaddress lhs, IPaddress rhs); diff --git a/common/utilities/makefile b/common/utilities/makefile index 9013447..104b518 100644 --- a/common/utilities/makefile +++ b/common/utilities/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/makefile b/makefile index bc3a86b..600f1a7 100644 --- a/makefile +++ b/makefile @@ -19,13 +19,23 @@ release: clean all package #For use on my machine ONLY package: - rar a -r -ep Tortuga.rar $(OUTDIR)/*.exe $(OUTDIR)/*.dll - rar a -r Tortuga.rar rsc/* copyright.txt instructions.txt +ifeq ($(OS),Windows_NT) + rar a -r -ep Tortuga-win.rar $(OUTDIR)/*.exe $(OUTDIR)/*.dll + rar a -r Tortuga-win.rar rsc/* copyright.txt instructions.txt +else ifeq ($(shell uname), Linux) + tar -C $(OUTDIR) -zcvf Tortuga-linux.tar client server ../rsc ../copyright.txt ../instructions.txt +endif $(OUTDIR): mkdir $(OUTDIR) clean: +ifeq ($(OS),Windows_NT) $(RM) *.o *.a *.exe +else ifeq ($(shell uname), Linux) + find . -type f -name *.o -exec rm -f -r -v {} \; + find . -type f -name *.a -exec rm -f -r -v {} \; + rm -f -v out/client out/server +endif rebuild: clean all diff --git a/server/accounts/makefile b/server/accounts/makefile index 2a5c671..635dbd4 100644 --- a/server/accounts/makefile +++ b/server/accounts/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/server/characters/character_manager.cpp b/server/characters/character_manager.cpp index 2f9d150..0108b43 100644 --- a/server/characters/character_manager.cpp +++ b/server/characters/character_manager.cpp @@ -26,6 +26,7 @@ #include "character_defines.hpp" #include +#include #include //------------------------- diff --git a/server/characters/makefile b/server/characters/makefile index f686f51..ecf6192 100644 --- a/server/characters/makefile +++ b/server/characters/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/server/clients/client_data.hpp b/server/clients/client_data.hpp index 18b93ef..fe7482e 100644 --- a/server/clients/client_data.hpp +++ b/server/clients/client_data.hpp @@ -22,7 +22,7 @@ #ifndef CLIENTDATA_HPP_ #define CLIENTDATA_HPP_ -#include "SDL/SDL_net.h" +#include "SDL_net.h" #include diff --git a/server/clients/client_manager.hpp b/server/clients/client_manager.hpp index 9dcec7c..94af3c5 100644 --- a/server/clients/client_manager.hpp +++ b/server/clients/client_manager.hpp @@ -26,7 +26,7 @@ #include "server_packet.hpp" #include "singleton.hpp" -#include "SDL/SDL_net.h" +#include "SDL_net.h" #include #include diff --git a/server/clients/makefile b/server/clients/makefile index 4eb98bd..1384da7 100644 --- a/server/clients/makefile +++ b/server/clients/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/server/entities/makefile b/server/entities/makefile index f24e1ba..1b92ad0 100644 --- a/server/entities/makefile +++ b/server/entities/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/server/makefile b/server/makefile index c579660..cd4b993 100644 --- a/server/makefile +++ b/server/makefile @@ -1,5 +1,5 @@ #include directories -INCLUDES+=. accounts characters clients entities monsters rooms server_utilities triggers ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities +INCLUDES+=SDL . accounts characters clients entities monsters rooms server_utilities triggers ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities #libraries #the order of the $(LIBS) is important, at least for MinGW @@ -8,6 +8,10 @@ ifeq ($(OS),Windows_NT) LIBS+=-lwsock32 -liphlpapi -lmingw32 endif LIBS+=-lSDLmain -lSDL -llua -lsqlite3 +ifeq ($(shell uname), Linux) + #I don't know what this does, but Ubuntu needs it + LIBS+=-ldl +endif #flags CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES)) @@ -49,6 +53,12 @@ $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< clean: +ifeq ($(OS),Windows_NT) $(RM) *.o *.a *.exe +else ifeq ($(shell uname), Linux) + find . -type f -name *.o -exec rm -f -r -v {} \; + find . -type f -name *.a -exec rm -f -r -v {} \; + rm -f -v out/client out/server +endif rebuild: clean all diff --git a/server/monsters/makefile b/server/monsters/makefile index 7e666d5..efc3852 100644 --- a/server/monsters/makefile +++ b/server/monsters/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/server/rooms/makefile b/server/rooms/makefile index e428985..048c575 100644 --- a/server/rooms/makefile +++ b/server/rooms/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/server/server_character_methods.cpp b/server/server_character_methods.cpp index 36839ac..4e85ee6 100644 --- a/server/server_character_methods.cpp +++ b/server/server_character_methods.cpp @@ -21,6 +21,7 @@ */ #include "server_application.hpp" +#include #include #include diff --git a/server/server_connections.cpp b/server/server_connections.cpp index c35fbaa..e88c1dd 100644 --- a/server/server_connections.cpp +++ b/server/server_connections.cpp @@ -21,6 +21,7 @@ */ #include "server_application.hpp" +#include #include #include diff --git a/server/server_data_queries.cpp b/server/server_data_queries.cpp index e911c59..721925a 100644 --- a/server/server_data_queries.cpp +++ b/server/server_data_queries.cpp @@ -21,6 +21,7 @@ */ #include "server_application.hpp" +#include #include #include diff --git a/server/server_logic.cpp b/server/server_logic.cpp index 8a0bd24..d0a4283 100644 --- a/server/server_logic.cpp +++ b/server/server_logic.cpp @@ -27,6 +27,7 @@ //std & STL #include #include + #include #include #include #include @@ -51,7 +52,9 @@ void ServerApplication::Init(int argc, char* argv[]) { //Init SDL if (SDL_Init(0)) { - throw(std::runtime_error("Failed to initialize SDL")); + std::ostringstream os; + os << "Failed to initialize SDL: " << SDL_GetError(); + throw(std::runtime_error(os.str())); } std::cout << "Initialized SDL" << std::endl; diff --git a/server/server_methods.cpp b/server/server_methods.cpp index d71c2ad..d23c13b 100644 --- a/server/server_methods.cpp +++ b/server/server_methods.cpp @@ -22,6 +22,7 @@ #include "server_application.hpp" #include + #include #include #include diff --git a/server/server_utilities/makefile b/server/server_utilities/makefile index 2093a63..7a87443 100644 --- a/server/server_utilities/makefile +++ b/server/server_utilities/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/server/server_utilities/network_api.cpp b/server/server_utilities/network_api.cpp index 83d2d80..c1fe6ac 100644 --- a/server/server_utilities/network_api.cpp +++ b/server/server_utilities/network_api.cpp @@ -25,6 +25,8 @@ #include "character_manager.hpp" #include "server_utilities.hpp" +#include + static int pumpCharacterUpdate(lua_State* L) { CharacterData* characterData = static_cast(lua_touserdata(L, 1)); diff --git a/server/server_utilities/server_utilities.cpp b/server/server_utilities/server_utilities.cpp index 5207d4f..698ed29 100644 --- a/server/server_utilities/server_utilities.cpp +++ b/server/server_utilities/server_utilities.cpp @@ -27,6 +27,8 @@ #include "room_manager.hpp" #include "udp_network_utility.hpp" +#include + //------------------------- //manager unload functions //------------------------- diff --git a/server/triggers/makefile b/server/triggers/makefile index 3585271..16035a5 100644 --- a/server/triggers/makefile +++ b/server/triggers/makefile @@ -30,8 +30,3 @@ $(OUTDIR): $(OBJDIR)/%.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< - -clean: - $(RM) *.o *.a *.exe - -rebuild: clean all diff --git a/todo.txt b/todo.txt index 580efed..3bbb4dd 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,5 @@ TODO: upgrade to lua 5.3 +TODO: upgrade to SDL 2.0 TODO: Split config.cfg in two, one for the server and the client TODO: Consistency for bounds names