wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src display.cpp preferences.cpp prefere...


From: John McNabb
Subject: [Wesnoth-cvs-commits] wesnoth/src display.cpp preferences.cpp prefere...
Date: Sat, 14 May 2005 16:56:21 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     John McNabb <address@hidden>    05/05/14 20:56:21

Modified files:
        src            : display.cpp preferences.cpp preferences.hpp 
                         reports.cpp reports.hpp 

Log message:
        added clock report

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.319&tr2=1.320&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.154&tr2=1.155&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.hpp.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/reports.cpp.diff?tr1=1.65&tr2=1.66&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/reports.hpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text

Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.319 wesnoth/src/display.cpp:1.320
--- wesnoth/src/display.cpp:1.319       Fri May  6 01:07:59 2005
+++ wesnoth/src/display.cpp     Sat May 14 20:56:21 2005
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.319 2005/05/06 01:07:59 Sirp Exp $ */
+/* $Id: display.cpp,v 1.320 2005/05/14 20:56:21 darthfool Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -682,7 +682,6 @@
 void display::draw(bool update,bool force)
 {      
        bool changed = false;
-
        //log_scope("Drawing");
        invalidate_animations();
 
@@ -802,6 +801,8 @@
 
 void display::draw_sidebar()
 {
+        draw_report(reports::REPORT_CLOCK);
+
        if(teams_.empty())
                return;
 
Index: wesnoth/src/preferences.cpp
diff -u wesnoth/src/preferences.cpp:1.154 wesnoth/src/preferences.cpp:1.155
--- wesnoth/src/preferences.cpp:1.154   Tue May 10 22:15:57 2005
+++ wesnoth/src/preferences.cpp Sat May 14 20:56:21 2005
@@ -1,4 +1,4 @@
-/* $Id: preferences.cpp,v 1.154 2005/05/10 22:15:57 Sirp Exp $ */
+/* $Id: preferences.cpp,v 1.155 2005/05/14 20:56:21 darthfool Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -651,6 +651,15 @@
                return "human";
 }
 
+std::string clock_format()
+{
+       if(prefs["clock_format"].size())
+               return prefs["clock_format"];
+       else
+         prefs["clock_format"]="%H:%M:%S";
+               return "%H:%M:%S";
+}
+
 const std::string& theme()
 {
        if(non_interactive()) {
Index: wesnoth/src/preferences.hpp
diff -u wesnoth/src/preferences.hpp:1.54 wesnoth/src/preferences.hpp:1.55
--- wesnoth/src/preferences.hpp:1.54    Wed May  4 03:16:39 2005
+++ wesnoth/src/preferences.hpp Sat May 14 20:56:21 2005
@@ -1,4 +1,4 @@
-/* $Id: preferences.hpp,v 1.54 2005/05/04 03:16:39 Sirp Exp $ */
+/* $Id: preferences.hpp,v 1.55 2005/05/14 20:56:21 darthfool Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -166,6 +166,8 @@
 
        std::string client_type();
 
+        std::string clock_format();
+  
        void set_theme(const std::string& theme);
        const std::string& theme();
 
Index: wesnoth/src/reports.cpp
diff -u wesnoth/src/reports.cpp:1.65 wesnoth/src/reports.cpp:1.66
--- wesnoth/src/reports.cpp:1.65        Mon May  2 19:42:04 2005
+++ wesnoth/src/reports.cpp     Sat May 14 20:56:21 2005
@@ -8,7 +8,9 @@
 #include "language.hpp"
 #include "reports.hpp"
 #include "wassert.hpp"
+#include "preferences.hpp"
 
+#include <ctime>
 #include <map>
 #include <set>
 #include <sstream>
@@ -18,8 +20,9 @@
                
"unit_traits","unit_status","unit_alignment","unit_abilities","unit_hp","unit_xp",
                
"unit_moves","unit_weapons","unit_image","unit_profile","time_of_day",
                "turn","gold","villages","num_units","upkeep", "expenses",
-                "income", "terrain", "position", "side_playing", "observers", 
"selected_terrain",
-                "edit_left_button_function"};
+                "income", "terrain", "position", "side_playing", "observers",
+                "report_clock",
+                "selected_terrain","edit_left_button_function"};
        std::map<reports::TYPE, std::string> report_contents;
 }
 
@@ -399,6 +402,18 @@
                        return report();
                }
        }
+       case REPORT_CLOCK: {
+         time_t t=time(NULL);
+         struct tm *lt=localtime(&t);
+         char temp[10];
+         size_t s=strftime(temp,10,preferences::clock_format().c_str(),lt);
+         if(s>0){
+           return report(temp);
+         }else{
+           return report();
+         }
+       }
+
        default:
                wassert(false);
                break;
Index: wesnoth/src/reports.hpp
diff -u wesnoth/src/reports.hpp:1.12 wesnoth/src/reports.hpp:1.13
--- wesnoth/src/reports.hpp:1.12        Tue Mar 22 23:42:37 2005
+++ wesnoth/src/reports.hpp     Sat May 14 20:56:21 2005
@@ -19,7 +19,8 @@
                    UNIT_ALIGNMENT, UNIT_ABILITIES, UNIT_HP, UNIT_XP, 
UNIT_MOVES, UNIT_WEAPONS,
                                UNIT_IMAGE, UNIT_PROFILE, TIME_OF_DAY,
                                TURN, GOLD, VILLAGES, NUM_UNITS, UPKEEP, 
EXPENSES, INCOME, TERRAIN, POSITION,
-                               SIDE_PLAYING, OBSERVERS, SELECTED_TERRAIN, 
EDIT_LEFT_BUTTON_FUNCTION, 
+                   SIDE_PLAYING, OBSERVERS, REPORT_CLOCK,
+                   SELECTED_TERRAIN, EDIT_LEFT_BUTTON_FUNCTION, 
                                NUM_REPORTS};
 
        enum { UNIT_REPORTS_BEGIN=UNIT_DESCRIPTION, 
UNIT_REPORTS_END=UNIT_PROFILE+1 };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]