|
From: Markus R. <god...@us...> - 2009-11-13 09:22:18
|
Module: performous
Branch: master
Commit: af9dc9799c9231f13c046e829b2e30995543a903
Author: Markus Raab <un...@ma...>
Date: Fri Nov 13 10:21:12 2009 +0100
path for pictures work again
like discussed pictures are placed below:
.local/share/games/performous/pictures
---
game/player.hh | 8 ++++----
game/players.cc | 7 ++++++-
game/screen_players.cc | 2 +-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/game/player.hh b/game/player.hh
index ae808ea..9751435 100644
--- a/game/player.hh
+++ b/game/player.hh
@@ -65,11 +65,11 @@ struct Player {
Used for Players Management.
*/
struct PlayerItem {
- int id; /// unique identifier for this PlayerItem, Link to hiscore
+ int id; ///< unique identifier for this PlayerItem, Link to hiscore
- std::string name; /// name displayed and used for searching the player
- std::string path; /// a path to a picture shown
- std::string picture; /// + the filename for it
+ std::string name; ///< name displayed and used for searching the player
+ std::string picture; ///< the filename which was passed from xml (and is written back)
+ std::string path; ///< a full path to a picture shown, generated from picture above
/* Future ideas
std::string displayedName; /// artist name, short name, nick (can be changed)
std::map<std::string, int> scores; /// map between a Song and the highest score the Player achieved
diff --git a/game/players.cc b/game/players.cc
index 1a581e9..47188c6 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -89,7 +89,12 @@ void Players::addPlayer (std::string const& name, std::string const& picture, in
if (pi.picture != "") // no picture, so don't search path
{
- // pi.picture = getXdgPath(fs::path("pictures") / pi.picture);
+ try {
+ pi.path = getPath(fs::path("pictures") / pi.picture);
+ } catch (std::runtime_error const& e)
+ {
+ std::cerr << e.what() << std::endl;
+ }
}
m_dirty = true;
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 03c352b..0bc80e1 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -129,7 +129,7 @@ void ScreenPlayers::draw() {
Surface* cover = 0;
if (player_display.path != "")
{
- try { cover = &m_covers[player_display.path + "/" + player_display.picture]; }
+ try { cover = &m_covers[player_display.path]; }
catch (std::exception const&) {}
}
Surface& s = (cover ? *cover : *m_emptyCover);
|