X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fstatistics.cpp;h=beff2c2d1365dfa54919cbdbf7c110c54b6671a3;hb=d471366f1ac5e8fad47e6ce161edc4977f180704;hp=0b1498dc12e558acaadc01e05d2b5e8634013511;hpb=d46c78c842ab4090a3f46e560c891234167f124b;p=supertux.git diff --git a/src/statistics.cpp b/src/statistics.cpp index 0b1498dc1..beff2c2d1 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -19,12 +19,11 @@ #include -#include "utils/lispreader.h" -#include "utils/lispwriter.h" #include "video/drawing_context.h" -#include "app/gettext.h" -#include "app/globals.h" +#include "gettext.h" +#include "lisp/lisp.h" #include "resources.h" +#include "main.h" #include "statistics.h" Statistics global_stats; @@ -70,23 +69,21 @@ Statistics::~Statistics() } void -Statistics::parse(LispReader& reader) +Statistics::parse(const lisp::Lisp& reader) { - for(int i = 0; i < NUM_STATS; i++) - { - reader.read_int(stat_name_to_string(i).c_str(), stats[i][SPLAYER]); - reader.read_int((stat_name_to_string(i) + "-total").c_str(), stats[i][STOTAL]); - } + for(int i = 0; i < NUM_STATS; i++) { + reader.get(stat_name_to_string(i).c_str(), stats[i][SPLAYER]); + reader.get((stat_name_to_string(i) + "-total").c_str(), stats[i][STOTAL]); + } } void -Statistics::write(LispWriter& writer) +Statistics::write(lisp::Writer& writer) { - for(int i = 0; i < NUM_STATS; i++) - { + for(int i = 0; i < NUM_STATS; i++) { writer.write_int(stat_name_to_string(i), stats[i][SPLAYER]); writer.write_int(stat_name_to_string(i) + "-total", stats[i][STOTAL]); - } + } } #define TOTAL_DISPLAY_TIME 3400 @@ -164,12 +161,12 @@ Statistics::draw_message_info(DrawingContext& context, std::string title) if(stats[SCORE_STAT][SPLAYER] == -1) // not initialized yet return; - context.draw_text(gold_text, title, Vector(screen->w/2, 410), CENTER_ALLIGN, LAYER_GUI); + context.draw_text(gold_text, title, Vector(SCREEN_WIDTH/2, 410), CENTER_ALLIGN, LAYER_GUI); char str[128]; sprintf(str, _( "Max score: %d"), stats[SCORE_STAT][SPLAYER]); - context.draw_text(white_text, str, Vector(screen->w/2, 450), CENTER_ALLIGN, LAYER_GUI); + context.draw_text(white_text, str, Vector(SCREEN_WIDTH/2, 450), CENTER_ALLIGN, LAYER_GUI); for(int i = 1; i < NUM_STATS; i++) { @@ -187,7 +184,7 @@ Statistics::draw_message_info(DrawingContext& context, std::string title) stats[TIME_NEEDED_STAT][STOTAL]); - context.draw_text(white_small_text, str, Vector(screen->w/2, 462 + i*18), CENTER_ALLIGN, LAYER_GUI); + context.draw_text(white_small_text, str, Vector(SCREEN_WIDTH/2, 462 + i*18), CENTER_ALLIGN, LAYER_GUI); } }