Tenative port for Linux

This commit is contained in:
2015-05-17 09:18:46 +10:00
parent 0bf5ccee4d
commit 99b35483f8
40 changed files with 53 additions and 115 deletions
+4 -1
View File
@@ -27,6 +27,7 @@
#include <stdexcept> #include <stdexcept>
#include <chrono> #include <chrono>
#include <iostream> #include <iostream>
#include <sstream>
//------------------------- //-------------------------
//Scene headers //Scene headers
@@ -57,7 +58,9 @@ void ClientApplication::Init(int argc, char* argv[]) {
//initialize SDL //initialize SDL
if (SDL_Init(SDL_INIT_VIDEO)) { 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; std::cout << "Initialized SDL" << std::endl;
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
@@ -23,6 +23,7 @@
#include "channels.hpp" #include "channels.hpp"
#include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
+2 -1
View File
@@ -22,11 +22,12 @@
#include "world.hpp" #include "world.hpp"
#include "channels.hpp" #include "channels.hpp"
#include "terminal_error.hpp" #include "terminal_error.hpp"
#include <stdexcept> #include <stdexcept>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
+7 -1
View File
@@ -1,5 +1,5 @@
#include directories #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 #libraries
#the order of the $(LIBS) is important, at least for MinGW #the order of the $(LIBS) is important, at least for MinGW
@@ -45,6 +45,12 @@ $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean: clean:
ifeq ($(OS),Windows_NT)
$(RM) *.o *.a *.exe $(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 rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -6,8 +6,3 @@ all:
$(MAKE) -C network $(MAKE) -C network
$(MAKE) -C ui $(MAKE) -C ui
$(MAKE) -C utilities $(MAKE) -C utilities
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -31,8 +31,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
@@ -24,7 +24,7 @@
#include "serial_packet_type.hpp" #include "serial_packet_type.hpp"
#include "SDL/SDL_net.h" #include "SDL_net.h"
constexpr int PACKET_STRING_SIZE = 100; constexpr int PACKET_STRING_SIZE = 100;
+1 -1
View File
@@ -27,7 +27,7 @@
#include "singleton.hpp" #include "singleton.hpp"
//APIs //APIs
#include "SDL/SDL_net.h" #include "SDL_net.h"
class UDPNetworkUtility : public Singleton<UDPNetworkUtility> { class UDPNetworkUtility : public Singleton<UDPNetworkUtility> {
public: public:
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
+1 -1
View File
@@ -22,7 +22,7 @@
#ifndef IPOPERATORS_HPP_ #ifndef IPOPERATORS_HPP_
#define IPOPERATORS_HPP_ #define IPOPERATORS_HPP_
#include "SDL/SDL_net.h" #include "SDL_net.h"
//these should've come standard //these should've come standard
bool operator==(IPaddress lhs, IPaddress rhs); bool operator==(IPaddress lhs, IPaddress rhs);
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
+10
View File
@@ -19,13 +19,23 @@ release: clean all package
#For use on my machine ONLY #For use on my machine ONLY
package: package:
ifeq ($(OS),Windows_NT)
rar a -r -ep Tortuga.rar $(OUTDIR)/*.exe $(OUTDIR)/*.dll rar a -r -ep Tortuga.rar $(OUTDIR)/*.exe $(OUTDIR)/*.dll
rar a -r Tortuga.rar rsc/* copyright.txt instructions.txt rar a -r Tortuga.rar rsc/* copyright.txt instructions.txt
else ifeq ($(shell uname), Linux)
tar -C $(OUTDIR) -zcvf Tortuga.tar client server ../rsc ../copyright.txt ../instructions.txt
endif
$(OUTDIR): $(OUTDIR):
mkdir $(OUTDIR) mkdir $(OUTDIR)
clean: clean:
ifeq ($(OS),Windows_NT)
$(RM) *.o *.a *.exe $(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 rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
+1
View File
@@ -26,6 +26,7 @@
#include "character_defines.hpp" #include "character_defines.hpp"
#include <algorithm> #include <algorithm>
#include <cstring>
#include <stdexcept> #include <stdexcept>
//------------------------- //-------------------------
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
+1 -1
View File
@@ -22,7 +22,7 @@
#ifndef CLIENTDATA_HPP_ #ifndef CLIENTDATA_HPP_
#define CLIENTDATA_HPP_ #define CLIENTDATA_HPP_
#include "SDL/SDL_net.h" #include "SDL_net.h"
#include <chrono> #include <chrono>
+1 -1
View File
@@ -26,7 +26,7 @@
#include "server_packet.hpp" #include "server_packet.hpp"
#include "singleton.hpp" #include "singleton.hpp"
#include "SDL/SDL_net.h" #include "SDL_net.h"
#include <functional> #include <functional>
#include <list> #include <list>
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
+11 -1
View File
@@ -1,5 +1,5 @@
#include directories #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 #libraries
#the order of the $(LIBS) is important, at least for MinGW #the order of the $(LIBS) is important, at least for MinGW
@@ -8,6 +8,10 @@ ifeq ($(OS),Windows_NT)
LIBS+=-lwsock32 -liphlpapi -lmingw32 LIBS+=-lwsock32 -liphlpapi -lmingw32
endif endif
LIBS+=-lSDLmain -lSDL -llua -lsqlite3 LIBS+=-lSDLmain -lSDL -llua -lsqlite3
ifeq ($(shell uname), Linux)
#I don't know what this does, but Ubuntu needs it
LIBS+=-ldl
endif
#flags #flags
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES)) CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))
@@ -49,6 +53,12 @@ $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean: clean:
ifeq ($(OS),Windows_NT)
$(RM) *.o *.a *.exe $(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 rebuild: clean all
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
+2
View File
@@ -25,6 +25,8 @@
#include "character_manager.hpp" #include "character_manager.hpp"
#include "server_utilities.hpp" #include "server_utilities.hpp"
#include <cstring>
static int pumpCharacterUpdate(lua_State* L) { static int pumpCharacterUpdate(lua_State* L) {
CharacterData* characterData = static_cast<CharacterData*>(lua_touserdata(L, 1)); CharacterData* characterData = static_cast<CharacterData*>(lua_touserdata(L, 1));
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
+1
View File
@@ -21,6 +21,7 @@
*/ */
#include "server_application.hpp" #include "server_application.hpp"
#include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
+1
View File
@@ -21,6 +21,7 @@
*/ */
#include "server_application.hpp" #include "server_application.hpp"
#include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
+1
View File
@@ -21,6 +21,7 @@
*/ */
#include "server_application.hpp" #include "server_application.hpp"
#include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
+4 -1
View File
@@ -27,6 +27,7 @@
//std & STL //std & STL
#include <stdexcept> #include <stdexcept>
#include <chrono> #include <chrono>
#include <cstring>
#include <iostream> #include <iostream>
#include <list> #include <list>
#include <sstream> #include <sstream>
@@ -51,7 +52,9 @@ void ServerApplication::Init(int argc, char* argv[]) {
//Init SDL //Init SDL
if (SDL_Init(0)) { 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; std::cout << "Initialized SDL" << std::endl;
+1
View File
@@ -22,6 +22,7 @@
#include "server_application.hpp" #include "server_application.hpp"
#include <chrono> #include <chrono>
#include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all
@@ -27,6 +27,8 @@
#include "room_manager.hpp" #include "room_manager.hpp"
#include "udp_network_utility.hpp" #include "udp_network_utility.hpp"
#include <cstring>
//------------------------- //-------------------------
//manager unload functions //manager unload functions
//------------------------- //-------------------------
-5
View File
@@ -30,8 +30,3 @@ $(OUTDIR):
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $< $(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
$(RM) *.o *.a *.exe
rebuild: clean all