Permalink
Browse files

Initial changes required to make Wesnoth build for Playbook.

  • Loading branch information...
1 parent d9f9a43 commit 305720fb2ce62d0a6a02046a98e2499c5d24e3d2 @jnicholl jnicholl committed Oct 3, 2011
Showing with 1,579 additions and 1,469 deletions.
  1. +4 −4 src/SConstruct
  2. +4 −4 src/ai/SConstruct
  3. +1 −1 src/ai/contexts.cpp
  4. +1 −1 src/ai/formula/ai.cpp
  5. 0 src/{animated.i → animated.inc}
  6. +5 −0 src/animated_game.cpp
  7. +4 −0 src/campaign_server/campaign_server.cpp
  8. +1 −1 src/chat_events.hpp
  9. +8 −0 src/construct_dialog.hpp
  10. +4 −0 src/filechooser.cpp
  11. +1 −1 src/filesystem.cpp
  12. 0 src/{filesystem_win32.ii → filesystem_win32.ii.backup}
  13. +1 −1 src/floating_textbox.cpp
  14. +3 −3 src/formula.cpp
  15. +6 −2 src/game.cpp
  16. +1 −1 src/game_display.cpp
  17. +2 −2 src/game_events.cpp
  18. +8 −0 src/global.hpp
  19. +8 −0 src/gui/auxiliary/iterator/exception.hpp
  20. +2 −2 src/gui/dialogs/lobby_main.cpp
  21. +2 −2 src/language.cpp
  22. 0 src/{language_win32.ii → language_win32.ii.backup}
  23. +1 −1 src/log.cpp
  24. +1 −1 src/log.hpp
  25. +8 −0 src/malloc.c
  26. +1 −1 src/map_location.cpp
  27. +1 −1 src/map_location.hpp
  28. +12 −12 src/menu_events.cpp
  29. +2 −2 src/multiplayer_ui.cpp
  30. +4 −0 src/network.cpp
  31. +245 −245 src/pathfind/teleport.cpp
  32. +177 −177 src/pathfind/teleport.hpp
  33. +2 −2 src/playturn.cpp
  34. +8 −0 src/poolalloc.c
  35. +2 −0 src/preferences_display.cpp
  36. +3 −3 src/replay.cpp
  37. +1 −1 src/scripting/lua.cpp
  38. +4 −0 src/sdl_utils.cpp
  39. +4 −0 src/serialization/parser.cpp
  40. +1 −1 src/serialization/string_utils.cpp
  41. +4 −0 src/server/input_stream.cpp
  42. +5 −0 src/server/server.cpp
  43. +5 −0 src/server/simple_wml.cpp
  44. +4 −0 src/server/simple_wml.hpp
  45. +993 −993 src/tests/test_image_modifications.cpp
  46. +5 −0 src/tstring.cpp
  47. +4 −0 src/unit_id.hpp
  48. +4 −0 src/unit_map.hpp
  49. +2 −2 src/util.hpp
  50. +5 −0 src/variant.cpp
  51. +3 −0 src/version.hpp
  52. +1 −1 src/wesconfig.h
  53. +1 −1 src/whiteboard/manager.cpp
View
@@ -1,4 +1,4 @@
-import sys
-from subprocess import call
-print "scons --directory=.. " + " ".join(sys.argv[1:])
-Exit(call(Split("scons --directory=..") + sys.argv[1:]))
+import sys
+from subprocess import call
+print "scons --directory=.. " + " ".join(sys.argv[1:])
+Exit(call(Split("scons --directory=..") + sys.argv[1:]))
View
@@ -1,4 +1,4 @@
-import sys
-from subprocess import call
-print "scons --directory=../.. " + " ".join(sys.argv[1:])
-Exit(call(Split("scons --directory=../..") + sys.argv[1:]))
+import sys
+from subprocess import call
+print "scons --directory=../.. " + " ".join(sys.argv[1:])
+Exit(call(Split("scons --directory=../..") + sys.argv[1:]))
View
@@ -300,7 +300,7 @@ const team& readonly_context_impl::current_team() const
void readonly_context_impl::log_message(const std::string& msg)
{
if(game_config::debug) {
- resources::screen->add_chat_message(time(NULL), "ai", get_side(), msg,
+ resources::screen->add_chat_message(std::time(NULL), "ai", get_side(), msg,
events::chat_handler::MESSAGE_PUBLIC, false);
}
}
View
@@ -102,7 +102,7 @@ void formula_ai::handle_exception(game_logic::formula_error& e, const std::strin
void formula_ai::display_message(const std::string& msg) const
{
- resources::screen->add_chat_message(time(NULL), "fai", get_side(), msg,
+ resources::screen->add_chat_message(std::time(NULL), "fai", get_side(), msg,
events::chat_handler::MESSAGE_PUBLIC, false);
}
File renamed without changes.
View
@@ -18,7 +18,12 @@
* Template instantiations for wesnoth-game.
*/
+#ifdef __PLAYBOOK__
+#include "animated.inc"
+#else
#include "animated.i"
+#endif
+
// Force compilation of the following template instantiations
#include "unit_frame.hpp"
@@ -35,6 +35,10 @@
#include <csignal>
+#ifdef __PLAYBOOK__
+using ::std::signal;
+#endif
+
#include <boost/iostreams/filter/gzip.hpp>
// the fork execute is unix specific only tested on Linux quite sure it won't
View
@@ -36,7 +36,7 @@ class chat_handler
void do_speak(const std::string& message, bool allies_only=false);
//called from do_speak
- virtual void add_chat_message(const time_t& time,
+ virtual void add_chat_message(const std::time_t& time,
const std::string& speaker, int side, const std::string& message,
MESSAGE_TYPE type=MESSAGE_PRIVATE)=0;
View
@@ -190,11 +190,19 @@ class dialog {
int x, y;
SDL_Rect interior, message, textbox;
unsigned int menu_width;
+#ifdef __PLAYBOOK__
+ std::map<preview_pane *, SDL_Rect > panes;
+#else
std::map<preview_pane *const, SDL_Rect > panes;
+#endif
int label_x, label_y;
int menu_x, menu_y, menu_height;
int image_x, image_y, caption_x, caption_y;
+#ifdef __PLAYBOOK__
+ std::map<dialog_button *, std::pair<int,int> > buttons;
+#else
std::map<dialog_button *const, std::pair<int,int> > buttons;
+#endif
//use get_frame().get_layout() to check frame dimensions
};
typedef dialog_frame::style style;
View
@@ -95,7 +95,11 @@ gui::dialog::dimension_measurements file_dialog::layout(int xloc, int yloc)
//shift the extra buttons up
if (show_directory_buttons_)
{
+#ifdef __PLAYBOOK__
+ std::map<gui::dialog_button *, std::pair<int,int> >::iterator i;
+#else
std::map<gui::dialog_button *const, std::pair<int,int> >::iterator i;
+#endif
for(i = dim.buttons.begin(); i != dim.buttons.end(); ++i)
{
const int btn_h = i->first->height();
View
@@ -29,7 +29,7 @@
#include <sys/stat.h>
#ifdef _WIN32
-#include "filesystem_win32.ii"
+#include "filesystem_win32.ii.backup"
#include <cctype>
#else /* !_WIN32 */
#include <unistd.h>
File renamed without changes.
View
@@ -137,7 +137,7 @@ namespace gui{
text.append(line_start ? ": " : " ");
} else if (matches.size() > 1) {
std::string completion_list = utils::join(matches, " ");
- resources::screen->add_chat_message(time(NULL), "", 0, completion_list,
+ resources::screen->add_chat_message(std::time(NULL), "", 0, completion_list,
events::chat_handler::MESSAGE_PRIVATE, false);
}
box_->set_text(text);
View
@@ -402,7 +402,7 @@ class operator_expression : public formula_expression {
static int dice_roll(int num_rolls, int faces) {
int res = 0;
while(faces > 0 && num_rolls-- > 0) {
- res += (rand()%faces)+1;
+ res += (std::rand()%faces)+1;
}
return res;
}
@@ -908,14 +908,14 @@ expression_ptr parse_expression(const token* i1, const token* i2, function_symbo
return expression_ptr(new identifier_expression(
std::string(i1->begin,i1->end)));
} else if(i1->type == TOKEN_INTEGER) {
- int n = atoi(std::string(i1->begin,i1->end).c_str());
+ int n = std::atoi(std::string(i1->begin,i1->end).c_str());
return expression_ptr(new integer_expression(n));
} else if(i1->type == TOKEN_DECIMAL) {
iterator dot = i1->begin;
while( *dot != '.' )
++dot;
- int n = atoi(std::string(i1->begin,dot).c_str());
+ int n = std::atoi(std::string(i1->begin,dot).c_str());
iterator end = i1->end;
View
@@ -2384,6 +2384,10 @@ static int do_gameloop(int argc, char** argv)
}
#ifndef DISABLE_POOL_ALLOC
+#define DISABLE_POOL_ALLOC 1
+#endif
+
+#ifndef DISABLE_POOL_ALLOC
extern "C" {
void init_custom_malloc();
}
@@ -2458,10 +2462,10 @@ int main(int argc, char** argv)
} catch(game::error &) {
// A message has already been displayed.
return 1;
- } catch(std::bad_alloc&) {
+ } /*catch(std::bad_alloc&) {
std::cerr << "Ran out of memory. Aborted.\n";
return ENOMEM;
- }
+ }*/
return 0;
} // end main
View
@@ -1308,7 +1308,7 @@ namespace {
const SDL_Color chat_message_bg = {0,0,0,140};
}
-void game_display::add_chat_message(const time_t& time, const std::string& speaker,
+void game_display::add_chat_message(const std::time_t& time, const std::string& speaker,
int side, const std::string& message, events::chat_handler::MESSAGE_TYPE type,
bool bell)
{
View
@@ -244,7 +244,7 @@ static void show_wml_errors()
msg << " (" << itor->second << ")";
}
- resources::screen->add_chat_message(time(NULL), caption, 0, msg.str(),
+ resources::screen->add_chat_message(std::time(NULL), caption, 0, msg.str(),
events::chat_handler::MESSAGE_PUBLIC, false);
std::cerr << caption << ": " << msg.str() << '\n';
}
@@ -268,7 +268,7 @@ static void show_wml_messages()
msg << " (" << itor->second << ")";
}
- resources::screen->add_chat_message(time(NULL), caption, 0, msg.str(),
+ resources::screen->add_chat_message(std::time(NULL), caption, 0, msg.str(),
events::chat_handler::MESSAGE_PUBLIC, false);
}
}
View
@@ -29,4 +29,12 @@
#endif
+#ifdef __PLAYBOOK__
+#include <sys/types.h>
+#include <time.h>
+using std::size_t;
+using std::time;
+using std::ctime;
+#endif
+
#endif
@@ -46,6 +46,10 @@ class tlogic_error
{
}
+#ifdef __PLAYBOOK__
+ ~tlogic_error() throw() {}
+#endif
+
private:
IMPLEMENT_LUA_JAILBREAK_EXCEPTION(tlogic_error)
@@ -67,6 +71,10 @@ class trange_error
{
}
+#ifdef __PLAYBOOK__
+ ~trange_error() throw() {}
+#endif
+
private:
IMPLEMENT_LUA_JAILBREAK_EXCEPTION(trange_error)
@@ -198,7 +198,7 @@ void tlobby_main::send_chat_message(const std::string& message, bool /*allies_on
msg["sender"] = preferences::login();
data.add_child("message", msg);
- add_chat_message(time(NULL), preferences::login(), 0, message); //local echo
+ add_chat_message(std::time(NULL), preferences::login(), 0, message); //local echo
network::send_data(data, 0);
}
@@ -207,7 +207,7 @@ void tlobby_main::user_relation_changed(const std::string& /*name*/)
player_list_dirty_ = true;
}
-void tlobby_main::add_chat_message(const time_t& /*time*/, const std::string& speaker,
+void tlobby_main::add_chat_message(const std::time_t& /*time*/, const std::string& speaker,
int /*side*/, const std::string& message, events::chat_handler::MESSAGE_TYPE /*type*/)
{
std::stringstream ss;
View
@@ -141,7 +141,7 @@ static void wesnoth_setlocale(int category, std::string const &slocale,
#ifdef _WIN32
std::string win_locale(locale, 0, 2);
- #include "language_win32.ii"
+ #include "language_win32.ii.backup"
if(category == LC_MESSAGES) {
std::string env = "LANG=" + locale;
_putenv(env.c_str());
@@ -263,7 +263,7 @@ const language_def& get_locale()
const char* const locale = getenv("LANG");
#ifdef _WIN32
std::string win_locale = locale
- #include "language_win32.ii"
+ #include "language_win32.ii.backup"
return win_locale;
#endif
if(locale != NULL && strlen(locale) >= 2) {
File renamed without changes.
View
@@ -115,7 +115,7 @@ std::string list_logdomains(const std::string& filter)
return res.str();
}
-std::string get_timestamp(const time_t& t, const std::string& format) {
+std::string get_timestamp(const std::time_t& t, const std::string& format) {
char buf[100] = {0};
tm* lt = localtime(&t);
if (lt) {
View
@@ -93,7 +93,7 @@ class logger {
};
void timestamps(bool);
-std::string get_timestamp(const time_t& t, const std::string& format="%Y%m%d %H:%M:%S ");
+std::string get_timestamp(const std::time_t& t, const std::string& format="%Y%m%d %H:%M:%S ");
extern logger err, warn, info, debug;
extern log_domain general;
View
@@ -1,6 +1,10 @@
/* $Id: malloc.c 47608 2010-11-21 01:56:29Z shadowmaster $ */
#ifndef DISABLE_POOL_ALLOC
+#define DISABLE_POOL_ALLOC 1
+#endif
+
+#ifndef DISABLE_POOL_ALLOC
#define USE_DL_PREFIX
@@ -444,6 +448,10 @@ DEFAULT_MMAP_THRESHOLD default: 256K
*/
+#ifdef __PLAYBOOK__
+#define NO_MALLINFO 1
+#endif
+
#ifndef WIN32
#ifdef _WIN32
#define WIN32 1
View
@@ -338,7 +338,7 @@ bool tiles_adjacent(const map_location& a, const map_location& b)
(xdiff == 1 && ydiff == 1 && (a.y > b.y ? is_even(a.x) : is_even(b.x)));
}
-size_t distance_between(const map_location& a, const map_location& b)
+std::size_t distance_between(const map_location& a, const map_location& b)
{
const size_t hdistance = abs(a.x - b.x);
View
@@ -114,7 +114,7 @@ void get_adjacent_tiles(const map_location& a, map_location* res);
* (i.e. the minimum number of hexes that have to be traversed
* to get from one hex to the other).
*/
-size_t distance_between(const map_location& a, const map_location& b);
+std::size_t distance_between(const map_location& a, const map_location& b);
/** Parses ranges of locations into a vector of locations. */
std::vector<map_location> parse_location_range(const std::string& xvals,
Oops, something went wrong.

0 comments on commit 305720f

Please sign in to comment.