00001 /* $Id: upload_log.hpp 26489 2008-05-09 18:23:21Z suokko $ */ 00002 /* 00003 Copyright (C) 2005 - 2008 by Rusty Russell <rusty@rustcorp.com.au> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License version 2 00008 or at your option any later version. 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY. 00011 00012 See the COPYING file for more details. 00013 */ 00014 00015 #ifndef UPLOAD_LOG_H_INCLUDED 00016 #define UPLOAD_LOG_H_INCLUDED 00017 #include "thread.hpp" 00018 00019 class config; 00020 class display; 00021 class t_string; 00022 class team; 00023 class unit_map; 00024 00025 struct upload_log 00026 { 00027 public: 00028 struct manager { 00029 manager() {upload_log::manager_ = this;} 00030 ~manager(); 00031 void manage(); 00032 }; 00033 00034 // We only enable logging when playing campaigns. 00035 upload_log(bool enable); 00036 ~upload_log(); 00037 00038 // User starts a game (may be new campaign or saved). 00039 void start(game_state &state, const team &team, 00040 unsigned int team_number, const unit_map &map, const t_string &turn, 00041 int num_turns); 00042 00043 // User finishes a level. 00044 void defeat(int turn); 00045 void victory(int turn, int gold); 00046 void quit(int turn); 00047 00048 // Argument passed to upload thread. 00049 struct thread_info { 00050 threading::thread *t; 00051 bool shutdown; 00052 std::string lastfile; 00053 }; 00054 00055 private: 00056 config &add_game_result(const std::string &str, int turn); 00057 bool game_finished(config *game); 00058 00059 static struct thread_info thread_; 00060 static manager* manager_; 00061 friend struct manager; 00062 00063 config config_; 00064 config *game_; 00065 std::string filename_; 00066 bool enabled_; 00067 }; 00068 00069 namespace upload_log_dialog 00070 { 00071 // Please please please upload stats? 00072 void show_beg_dialog(display& disp); 00073 } 00074 00075 #endif // UPLOAD_LOG_H_INCLUDED
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |