[[big heap of miscellaneous fixes]]
* 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
This commit is contained in:
parent
a05c6a4e2b
commit
efab5f8300
13 changed files with 88 additions and 44 deletions
|
@ -32,6 +32,8 @@
|
|||
#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.
|
||||
#if !(defined(_WIN32))
|
||||
|
@ -289,6 +291,41 @@ namespace {
|
|||
|
||||
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()
|
||||
|
|
|
@ -2297,12 +2297,10 @@ static int play_game(int argc, char** argv)
|
|||
|
||||
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
|
||||
|
|
|
@ -166,15 +166,11 @@ static void show_wml_errors()
|
|||
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 @@ namespace game_events {
|
|||
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);
|
||||
|
|
|
@ -208,8 +208,9 @@ namespace game_events
|
|||
{ \
|
||||
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 @@ namespace game_events
|
|||
// 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
|
||||
|
|
|
@ -473,6 +473,8 @@ void terrain_label::calculate_shroud() const
|
|||
|
||||
void terrain_label::draw()
|
||||
{
|
||||
if (text_.empty())
|
||||
return;
|
||||
clear();
|
||||
if (visible())
|
||||
{
|
||||
|
@ -499,8 +501,8 @@ void terrain_label::draw()
|
|||
|
||||
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()
|
||||
|
|
|
@ -138,6 +138,7 @@ connect_aborter::ACTION connect_aborter::process()
|
|||
|
||||
BOOST_AUTO_TEST_CASE( test_sdl_thread_wait_crash )
|
||||
{
|
||||
|
||||
delete wes_server;
|
||||
wes_server = 0;
|
||||
delete wes_manager;
|
||||
|
@ -182,11 +183,9 @@ std::ostream& operator<<(std::ostream& s, const sendfile_param& p)
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -232,12 +232,7 @@ void update_whole_screen()
|
|||
}
|
||||
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,11 +249,7 @@ CVideo::CVideo(FAKE_TYPES type) : mode_changed_(false), bpp_(0), fake_screen_(fa
|
|||
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) {
|
||||
|
@ -267,6 +258,16 @@ CVideo::CVideo( int x, int y, int bits_per_pixel, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
CVideo::~CVideo()
|
||||
{
|
||||
LOG_DP << "calling SDL_Quit()\n";
|
||||
|
|
|
@ -45,6 +45,7 @@ class CVideo {
|
|||
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 @@ class CVideo {
|
|||
bool update_locked() const;
|
||||
|
||||
private:
|
||||
|
||||
void initSDL();
|
||||
|
||||
bool mode_changed_;
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ if ($svn->getRevision() === false)
|
|||
|
||||
$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()))
|
||||
|
|
|
@ -6,4 +6,5 @@ export SSH_AUTH_SOCK=`find /tmp/keyring* -name ssh`
|
|||
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
|
||||
|
|
|
@ -26,7 +26,7 @@ td.time {
|
|||
color: #00FF00;
|
||||
}
|
||||
|
||||
.build .failed {
|
||||
.build .failed, .aborted {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,15 @@ table.test_error {
|
|||
}
|
||||
|
||||
.test_error .Warning {
|
||||
color: #FF00FF;
|
||||
color: #FF4000;
|
||||
}
|
||||
|
||||
.test_error .Exception {
|
||||
color: #A00000;
|
||||
}
|
||||
|
||||
.test_error .Message {
|
||||
color: #00FF00;
|
||||
}
|
||||
|
||||
.test_error td {
|
||||
|
|
|
@ -347,7 +347,6 @@ class DBCreator {
|
|||
|
||||
public function checkDB()
|
||||
{
|
||||
$this->db->StartTrans();
|
||||
$this->format->checkDB($this->db);
|
||||
|
||||
$build = new Build();
|
||||
|
@ -355,7 +354,6 @@ class DBCreator {
|
|||
|
||||
$config = new Config();
|
||||
$config->insertDefaults();
|
||||
$this->db->CompleteTrans();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,18 +26,17 @@ class TestError {
|
|||
$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 @@ class TestError {
|
|||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue