131 lines
3.7 KiB
Diff
131 lines
3.7 KiB
Diff
--- a/lib/warmux/net/network.cpp
|
|
+++ b/lib/warmux/net/network.cpp
|
|
@@ -19,6 +19,7 @@
|
|
* Network layer for warmux.
|
|
*****************************************************************************/
|
|
|
|
+#include <sys/time.h>
|
|
#include <sys/types.h>
|
|
#include <iostream>
|
|
|
|
--- a/lib/warmux/tools/file_tools.cpp
|
|
+++ b/lib/warmux/tools/file_tools.cpp
|
|
@@ -88,7 +88,7 @@
|
|
|
|
if (subdir.size() != 0) {
|
|
// Create the directory if it doesn't exist
|
|
- if (MKDIR(subdir.c_str()) != 0 && errno != EEXIST)
|
|
+ if (!DoesFolderExist(subdir.c_str()) && MKDIR(subdir.c_str()) != 0 && errno != EEXIST)
|
|
return false;
|
|
}
|
|
pos = dir.find("/", pos+1);
|
|
@@ -277,6 +277,8 @@
|
|
struct dirent *file;
|
|
#ifdef __SYMBIAN32__
|
|
std::string dname;
|
|
+#elif __HAIKU__
|
|
+ struct stat st;
|
|
#endif
|
|
};
|
|
|
|
@@ -302,6 +304,9 @@
|
|
|
|
#ifdef __SYMBIAN32__
|
|
if (f->file->d_namlen && DoesFolderExist(f->dname+"/"+std::string(f->file->d_name))) {
|
|
+#elif __HAIKU__
|
|
+ stat(f->file->d_name, &f->st);
|
|
+ if (S_ISDIR(f->st.st_mode)) {
|
|
#else
|
|
if (f->file->d_type == DT_DIR) {
|
|
#endif
|
|
@@ -318,6 +323,8 @@
|
|
// This is a file and we do search for file
|
|
#ifdef __SYMBIAN32__
|
|
if (f->file->d_namlen && DoesFileExist(f->dname+"/"+std::string(f->file->d_name))) {
|
|
+#elif __HAIKU__
|
|
+ if (S_ISREG(f->st.st_mode)) {
|
|
#else
|
|
if (f->file->d_type == DT_REG) {
|
|
#endif
|
|
--- a/src/game/config.cpp
|
|
+++ b/src/game/config.cpp
|
|
@@ -37,6 +37,11 @@
|
|
# include <direct.h>
|
|
#endif
|
|
|
|
+#ifdef __HAIKU__
|
|
+# include <FindDirectory.h>
|
|
+# include <libgen.h>
|
|
+#endif
|
|
+
|
|
#include <WARMUX_file_tools.h>
|
|
#include <WARMUX_team_config.h>
|
|
|
|
@@ -201,7 +206,24 @@
|
|
personal_config_dir = GetHome() + PATH_SEPARATOR "Warmux" PATH_SEPARATOR;
|
|
personal_data_dir = personal_config_dir;
|
|
|
|
-#else //Neither WIN32, ANDROID or __APPLE__
|
|
+#elif __HAIKU__
|
|
+ char path[B_PATH_NAME_LENGTH];
|
|
+ find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "warmux/", path, B_PATH_NAME_LENGTH);
|
|
+ data_dir = path;
|
|
+
|
|
+# ifdef ENABLE_NLS
|
|
+ find_path(B_APP_IMAGE_SYMBOL, B_FIND_PATH_DATA_DIRECTORY, "locale/", path, B_PATH_NAME_LENGTH);
|
|
+ locale_dir = path;
|
|
+# endif
|
|
+
|
|
+ font_dir = data_dir + "font/";
|
|
+ ttf_filename = font_dir + basename(FONT_FILE);
|
|
+
|
|
+ find_directory(B_USER_SETTINGS_DIRECTORY, 0, false, path, B_PATH_NAME_LENGTH);
|
|
+ personal_config_dir = std::string(path) + "/warmux/";
|
|
+ personal_data_dir = data_dir;
|
|
+
|
|
+#else //Neither WIN32, ANDROID, __APPLE__ or __HAIKU__
|
|
data_dir = GetEnv(Constants::ENV_DATADIR, INSTALL_DATADIR);
|
|
# ifdef ENABLE_NLS
|
|
locale_dir = GetEnv(Constants::ENV_LOCALEDIR, INSTALL_LOCALEDIR);
|
|
@@ -393,6 +415,8 @@
|
|
m_default_config = GetDataDir() + "warmux_default_maemo_config.xml";
|
|
#elif __SYMBIAN32__
|
|
m_default_config = GetDataDir() + "warmux_default_symbian_config.xml";
|
|
+#elif __HAIKU__
|
|
+ m_default_config = personal_data_dir + "warmux_default_config.xml";
|
|
#else
|
|
m_default_config = GetDataDir() + "warmux_default_config.xml";
|
|
#endif
|
|
--- a/src/graphic/surface.cpp
|
|
+++ b/src/graphic/surface.cpp
|
|
@@ -25,6 +25,7 @@
|
|
#include <SDL_image.h>
|
|
#include <SDL_rotozoom.h>
|
|
#include <png.h>
|
|
+#include <zlib.h>
|
|
|
|
#include "graphic/surface.h"
|
|
#include "tool/math_tools.h"
|
|
--- a/src/interface/weapon_menu.cpp
|
|
+++ b/src/interface/weapon_menu.cpp
|
|
@@ -391,7 +391,7 @@
|
|
Weapon * WeaponsMenu::UpdateCurrentOverflyItem(const Polygon * poly)
|
|
{
|
|
if (!show)
|
|
- return false;
|
|
+ return NULL;
|
|
const std::vector<PolygonItem *>& items = poly->GetItem();
|
|
WeaponMenuItem * tmp;
|
|
Interface::GetInstance()->SetCurrentOverflyWeapon(NULL);
|
|
--- a/src/menu/network_teams_selection_box.cpp
|
|
+++ b/src/menu/network_teams_selection_box.cpp
|
|
@@ -114,6 +114,8 @@
|
|
result = "Android";
|
|
#elif defined(__SYMBIAN32__)
|
|
result = "Symbian";
|
|
+#elif defined(__HAIKU__)
|
|
+ result = "Haiku";
|
|
#else
|
|
result = getenv("USER");
|
|
#endif
|