mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-19 20:26:18 +00:00
Made progress counter output on stderr be done via the display logdomain...
...(level = info/error)
This commit is contained in:
parent
9d6b72fee5
commit
2478a1c807
@ -17,6 +17,7 @@
|
||||
|
||||
#include "loadscreen.hpp"
|
||||
|
||||
#include "log.hpp"
|
||||
#include "font.hpp"
|
||||
#include "marked-up_text.hpp"
|
||||
#include "gettext.hpp"
|
||||
@ -27,6 +28,9 @@
|
||||
|
||||
#include <SDL_image.h>
|
||||
|
||||
#define INFO_DISP LOG_STREAM(info, display)
|
||||
#define ERR_DISP LOG_STREAM(err, display)
|
||||
|
||||
#define MIN_PERCENTAGE 0
|
||||
#define MAX_PERCENTAGE 100
|
||||
|
||||
@ -72,7 +76,7 @@ loadscreen::loadscreen(CVideo &screen, const int &percent):
|
||||
std::string path = get_binary_file_location("images","misc/logo.png");
|
||||
logo_surface_ = IMG_Load(path.c_str());
|
||||
if (!logo_surface_) {
|
||||
std::cerr << "loadscreen: Failed to load the logo: " << path << std::endl;
|
||||
ERR_DISP << "loadscreen: Failed to load the logo: " << path << std::endl;
|
||||
}
|
||||
textarea_.x = textarea_.y = textarea_.w = textarea_.h = 0;
|
||||
}
|
||||
@ -106,7 +110,7 @@ void loadscreen::set_progress(const int percentage, const std::string &text, con
|
||||
pby_offset_ = (pbh + area.h)/2;
|
||||
SDL_BlitSurface (logo_surface_, 0, gdis, &area);
|
||||
} else {
|
||||
std::cerr << "loadscreen: Logo image is too big." << std::endl;
|
||||
ERR_DISP << "loadscreen: Logo image is too big." << std::endl;
|
||||
}
|
||||
logo_drawn_ = true;
|
||||
SDL_UpdateRect(gdis, area.x, area.y, area.w, area.h);
|
||||
@ -190,6 +194,14 @@ void loadscreen::clear_screen(const bool commit)
|
||||
|
||||
loadscreen *loadscreen::global_loadscreen = 0;
|
||||
|
||||
void loadscreen::dump_counters() const
|
||||
{
|
||||
INFO_DISP << "loadscreen: filesystem counter = " << filesystem_counter << '\n';
|
||||
INFO_DISP << "loadscreen: binarywml counter = " << binarywml_counter << '\n';
|
||||
INFO_DISP << "loadscreen: setconfig counter = " << setconfig_counter << '\n';
|
||||
INFO_DISP << "loadscreen: parser counter = " << parser_counter << '\n';
|
||||
}
|
||||
|
||||
// Amount of work to expect during the startup-stages,
|
||||
// for scaling the progressbars:
|
||||
#define CALLS_TO_FILESYSTEM 112
|
||||
|
@ -38,10 +38,7 @@ class loadscreen {
|
||||
// Destructor, dumps the counter values to stderr
|
||||
~loadscreen()
|
||||
{
|
||||
std::cerr << "loadscreen: filesystem counter = " << filesystem_counter << std::endl;
|
||||
std::cerr << "loadscreen: binarywml counter = " << binarywml_counter << std::endl;
|
||||
std::cerr << "loadscreen: setconfig counter = " << setconfig_counter << std::endl;
|
||||
std::cerr << "loadscreen: parser counter = " << parser_counter << std::endl;
|
||||
dump_counters();
|
||||
if (logo_surface_) {
|
||||
SDL_FreeSurface (logo_surface_);
|
||||
}
|
||||
@ -85,6 +82,8 @@ private:
|
||||
bool logo_drawn_;
|
||||
int pby_offset_;
|
||||
int prcnt_;
|
||||
|
||||
void dump_counters() const;
|
||||
};
|
||||
|
||||
// Global accessible functions that centralize the loadscreen related work.
|
||||
|
Loading…
x
Reference in New Issue
Block a user