Author: suokko
Date: Mon Aug 11 03:16:11 2008
New Revision: 28454
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28454&view=rev
Log:
* Made map labels not to register if having empty text. (labels are still
needing rewrite)
* Fixed filter check for missing tags report
* Made SDL_Init(TIMER) called in all platforms (This initializes variables in
sdl; eg SDL_GetTicks counter)
* Added campaignd server cr encoding conbersion so old data is converted to new
format
* Made Unit test website find old error with less strict parameters
Modified:
trunk/src/campaign_server/campaign_server.cpp
trunk/src/game.cpp
trunk/src/game_events.cpp
trunk/src/game_events.hpp
trunk/src/map_label.cpp
trunk/src/tests/test_network_worker.cpp
trunk/src/video.cpp
trunk/src/video.hpp
trunk/utils/tests/autotester/run_unit_tests.php
trunk/utils/tests/autotester/run_unit_tests.sh
trunk/utils/tests/htdocs/styles/unit_test.css
trunk/utils/tests/include/DBCreator.php
trunk/utils/tests/include/TestError.php
Modified: trunk/src/campaign_server/campaign_server.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/campaign_server/campaign_server.cpp?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/src/campaign_server/campaign_server.cpp (original)
+++ trunk/src/campaign_server/campaign_server.cpp Mon Aug 11 03:16:11 2008
@@ -31,6 +31,8 @@
#include <iostream>
#include <map>
#include <algorithm> // Required for gcc 4.3.0
+
+#include <boost/iostreams/filter/gzip.hpp>
// the fork execute is unix specific only tested on Linux quite sure it won't
// work on Windows not sure which other platforms have a problem with it.
@@ -289,6 +291,41 @@
cfg_["converted_to_gzipped_data"] = "yes";
}
+ if (cfg_["cr_encoded"] != "yes")
+ {
+ // Convert all addons to gzip
+ config::child_list camps =
campaigns().get_children("campaign");
+ LOG_CS << "Encoding CR in all stored campaigns. Number
of addons: " << camps.size() <<"\n";
+
+ const char escape_char = '\x01'; //!< Binary escape
char.
+ for (config::child_list::iterator itor = camps.begin();
+ itor != camps.end(); ++itor)
+ {
+ LOG_CS << "Encoding " << (**itor)["name"] <<
"\n";
+ std::string data =
read_file((**itor)["filename"]);
+ std::string copy;
+ copy.reserve(data.size());
+ int n = 0;
+ for(std::string::iterator ch = data.begin();
+ ch != data.end(); ++ch)
+ {
+ if (*ch == '\x0D')
+ {
+ copy[n++] = escape_char;
+ copy[n++] = *ch + 1;
+ }else {
+ copy[n++] = *ch;
+ }
+ }
+ scoped_ostream out_file =
ostream_file((**itor)["filename"]);
+
boost::iostreams::filtering_stream<boost::iostreams::output> filter_;
+
filter_.push(boost::iostreams::gzip_compressor(boost::iostreams::gzip_params(compress_level_)));
+ filter_.push(*out_file);
+ filter_ << copy;
+ }
+
+ cfg_["cr_encoded"] = "yes";
+ }
}
void campaign_server::run()
Modified: trunk/src/game.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Mon Aug 11 03:16:11 2008
@@ -2297,12 +2297,10 @@
int main(int argc, char** argv)
{
-#ifdef OS2 /* required for SDL_GetTicks to work on OS/2 */
- if(SDL_Init(SDL_INIT_TIMER) < 0) {
+ if(SDL_Init(SDL_INIT_TIMER) < 0) {
fprintf(stderr, "Couldn't initialize SDL: %s\n",
SDL_GetError());
return(1);
}
-#endif
try {
//trigger any one-time static initializations
Modified: trunk/src/game_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Mon Aug 11 03:16:11 2008
@@ -166,15 +166,11 @@
namespace game_events {
- command_handlers* command_handlers::manager_ = 0;
+ command_handlers command_handlers::manager_;
command_handlers& command_handlers::get()
{
- if (!manager_)
- {
- manager_ = new command_handlers();
- }
- return *manager_;
+ return manager_;
}
command_handlers::command_handlers() :
@@ -210,7 +206,7 @@
return true;
}
// Return true if we have /^filter.*/ tag
- return cmd.compare(0, strlen("filter"),"filter");
+ return cmd.compare(0, strlen("filter"),"filter") == 0;
}
static bool unit_matches_filter(const unit& u, const vconfig
filter,const gamemap::location& loc);
Modified: trunk/src/game_events.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.hpp?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/src/game_events.hpp (original)
+++ trunk/src/game_events.hpp Mon Aug 11 03:16:11 2008
@@ -208,8 +208,9 @@
{ \
wml_func_register_ ## pname () \
{ \
+ const std::string name(# pname); \
game_events::command_handlers::get().add_handler( \
- # pname , &wml_func_ ## pname ); \
+ name , &wml_func_ ## pname ); \
}\
} wml_func_register_ ## pname ; \
void wml_func_ ## pname \
@@ -237,7 +238,7 @@
// runtime_handlers runtime_;
// bool in_scenario_;
- static command_handlers* manager_;
+ static command_handlers manager_;
// It might be good optimization to use hash instead
// of string as key for map
Modified: trunk/src/map_label.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/map_label.cpp?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/src/map_label.cpp (original)
+++ trunk/src/map_label.cpp Mon Aug 11 03:16:11 2008
@@ -473,6 +473,8 @@
void terrain_label::draw()
{
+ if (text_.empty())
+ return;
clear();
if (visible())
{
@@ -499,8 +501,8 @@
bool terrain_label::visible() const
{
- return parent_->team_name() == team_name_
- || (team_name_.empty() &&
parent_->visible_global_label(loc_));
+ return (parent_->team_name() == team_name_
+ || (team_name_.empty() &&
parent_->visible_global_label(loc_)));
}
void terrain_label::check_text_length()
Modified: trunk/src/tests/test_network_worker.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tests/test_network_worker.cpp?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/src/tests/test_network_worker.cpp (original)
+++ trunk/src/tests/test_network_worker.cpp Mon Aug 11 03:16:11 2008
@@ -138,6 +138,7 @@
BOOST_AUTO_TEST_CASE( test_sdl_thread_wait_crash )
{
+
delete wes_server;
wes_server = 0;
delete wes_manager;
@@ -182,11 +183,9 @@
}
sendfile_param sendfile_sizes[] = {sendfile_param(1*1024,true),
-
sendfile_param(500*1024,true),
-
sendfile_param(30*1024*1024,true),
+
sendfile_param(5*1024*1024,true),
sendfile_param(1*1024,false),
-
sendfile_param(500*1024,false),
-
sendfile_param(30*1024*1024,false)};
+
sendfile_param(5*1024*1024,false)};
std::string create_random_sendfile(size_t size)
{
Modified: trunk/src/video.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/video.cpp?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/src/video.cpp (original)
+++ trunk/src/video.cpp Mon Aug 11 03:16:11 2008
@@ -232,12 +232,7 @@
}
CVideo::CVideo(FAKE_TYPES type) : mode_changed_(false), bpp_(0),
fake_screen_(false), help_string_(0), updatesLocked_(0)
{
- const int res = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
-
- if(res < 0) {
- ERR_DP << "Could not initialize SDL: " << SDL_GetError() <<
"\n";
- throw CVideo::error();
- }
+ initSDL();
switch(type)
{
case NO_FAKE:
@@ -254,15 +249,21 @@
CVideo::CVideo( int x, int y, int bits_per_pixel, int flags)
: mode_changed_(false), bpp_(0), fake_screen_(false),
help_string_(0), updatesLocked_(0)
{
- const int res = SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE);
- if(res < 0) {
- ERR_DP << "Could not initialize SDL: " << SDL_GetError() <<
"\n";
- throw CVideo::error();
- }
+ initSDL();
const int mode_res = setMode( x, y, bits_per_pixel, flags );
if (mode_res == 0) {
ERR_DP << "Could not set Video Mode\n";
+ throw CVideo::error();
+ }
+}
+
+void CVideo::initSDL()
+{
+ const int res = SDL_InitSubSystem(SDL_INIT_VIDEO |
SDL_INIT_NOPARACHUTE);
+
+ if(res < 0) {
+ ERR_DP << "Could not initialize SDL_video: " << SDL_GetError()
<< "\n";
throw CVideo::error();
}
}
Modified: trunk/src/video.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/video.hpp?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/src/video.hpp (original)
+++ trunk/src/video.hpp Mon Aug 11 03:16:11 2008
@@ -44,6 +44,7 @@
CVideo(FAKE_TYPES type = NO_FAKE);
CVideo(int x, int y, int bits_per_pixel, int flags);
~CVideo();
+
int modePossible( int x, int y, int bits_per_pixel, int flags );
int setMode( int x, int y, int bits_per_pixel, int flags );
@@ -103,6 +104,8 @@
bool update_locked() const;
private:
+
+ void initSDL();
bool mode_changed_;
Modified: trunk/utils/tests/autotester/run_unit_tests.php
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/tests/autotester/run_unit_tests.php?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/utils/tests/autotester/run_unit_tests.php (original)
+++ trunk/utils/tests/autotester/run_unit_tests.php Mon Aug 11 03:16:11 2008
@@ -24,7 +24,8 @@
$build = new Build($svn->getRevision());
-if (!$build->Exists())
+if (!$build->Exists()
+ || $build->getStatus() != Build::S_GOOD)
{
// Only run tests if build doesn't exists
if ($build->compile($svn->getRevision()))
Modified: trunk/utils/tests/autotester/run_unit_tests.sh
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/tests/autotester/run_unit_tests.sh?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/utils/tests/autotester/run_unit_tests.sh (original)
+++ trunk/utils/tests/autotester/run_unit_tests.sh Mon Aug 11 03:16:11 2008
@@ -6,4 +6,5 @@
export DISPLAY=:0.0
cd $SVNDIR
-nice php -f ${AUTOTESTDIR}/run_unit_tests.php $WEBDIR > $FULL_PATH/err.log
+nice php -f ${AUTOTESTDIR}/run_unit_tests.php $WEBDIR
+# > $FULL_PATH/err.log
Modified: trunk/utils/tests/htdocs/styles/unit_test.css
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/tests/htdocs/styles/unit_test.css?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/utils/tests/htdocs/styles/unit_test.css (original)
+++ trunk/utils/tests/htdocs/styles/unit_test.css Mon Aug 11 03:16:11 2008
@@ -26,7 +26,7 @@
color: #00FF00;
}
-.build .failed {
+.build .failed, .aborted {
color: #FF0000;
}
@@ -49,7 +49,15 @@
}
.test_error .Warning {
- color: #FF00FF;
+ color: #FF4000;
+}
+
+.test_error .Exception {
+ color: #A00000;
+}
+
+.test_error .Message {
+ color: #00FF00;
}
.test_error td {
Modified: trunk/utils/tests/include/DBCreator.php
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/tests/include/DBCreator.php?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/utils/tests/include/DBCreator.php (original)
+++ trunk/utils/tests/include/DBCreator.php Mon Aug 11 03:16:11 2008
@@ -347,7 +347,6 @@
public function checkDB()
{
- $this->db->StartTrans();
$this->format->checkDB($this->db);
$build = new Build();
@@ -355,7 +354,6 @@
$config = new Config();
$config->insertDefaults();
- $this->db->CompleteTrans();
}
}
Modified: trunk/utils/tests/include/TestError.php
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/tests/include/TestError.php?rev=28454&r1=28453&r2=28454&view=diff
==============================================================================
--- trunk/utils/tests/include/TestError.php (original)
+++ trunk/utils/tests/include/TestError.php Mon Aug 11 03:16:11 2008
@@ -26,18 +26,17 @@
$this->file = (string)$data->attributes()->file;
$this->line = (string)$data->attributes()->line;
$this->error_msg = (string)$data[0];
- $result = $this->db->Execute('SELECT id, before_id,
last_id FROM test_errors
- WHERE error_type=?
- AND file=?
- AND line=?
- AND error_msg=?
- AND last_id=?
+ $result = $this->db->Execute('SELECT t.id as id,
before_id, last_id FROM test_errors t, builds b
+ WHERE t.error_type=?
+ AND t.file=?
+ AND t.error_msg=?
+ AND t.last_id=b.id
+ AND b.time > ?
LIMIT 1',
array($this->error_type,
$this->file,
- $this->line,
$this->error_msg,
- $build->getPreviousId()
+ $this->db->DBTimeStamp(time()
- 24*60*60)
));
if (!$result->EOF())
{
@@ -92,7 +91,7 @@
$this->last_id = $build->getId();
$this->insert();
} else {
- $this->db->Execute('UPDATE test_errors SET last_id=?
WHERE id=?', array($build->getid(), $this->id));
+ $this->db->Execute('UPDATE test_errors SET last_id=?,
line=? WHERE id=?', array($build->getid(), $this->line, $this->id));
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits