diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-15 19:47:51 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-03-15 19:47:51 -0400 |
commit | eb61ec5578bf45d454d9d0c9fba523b7803a5ed9 (patch) | |
tree | 1e775a62313618a7dc8f1dfc6b1687e579ab3b13 /src/components | |
parent | dca2aea57957c6af1af535f23ae392e7517ebd51 (diff) | |
download | therapy-eb61ec5578bf45d454d9d0c9fba523b7803a5ed9.tar.gz therapy-eb61ec5578bf45d454d9d0c9fba523b7803a5ed9.tar.bz2 therapy-eb61ec5578bf45d454d9d0c9fba523b7803a5ed9.zip |
Fixed error with empty left and right maps
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/map_render.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/components/map_render.cpp b/src/components/map_render.cpp index 6fdfcc3..3b6b9c4 100644 --- a/src/components/map_render.cpp +++ b/src/components/map_render.cpp | |||
@@ -23,9 +23,9 @@ MapRenderComponent::MapRenderComponent(const Map& map) : screen(GAME_WIDTH, GAME | |||
23 | } | 23 | } |
24 | 24 | ||
25 | Texture font("../res/font.bmp"); | 25 | Texture font("../res/font.bmp"); |
26 | const char* map_name = map.getTitle(); | 26 | std::string map_name = map.getTitle(); |
27 | int start_x = (40/2) - (strlen(map_name)/2); | 27 | int start_x = (40/2) - (map_name.length()/2); |
28 | for (size_t i=0; i<strlen(map_name); i++) | 28 | for (size_t i=0; i<map_name.length(); i++) |
29 | { | 29 | { |
30 | Rectangle srcRect {map_name[i] % 16 * 8, map_name[i] / 16 * 8, 8, 8}; | 30 | Rectangle srcRect {map_name[i] % 16 * 8, map_name[i] / 16 * 8, 8, 8}; |
31 | Rectangle dstRect {(start_x + (int)i)*8, 24*8, 8, 8}; | 31 | Rectangle dstRect {(start_x + (int)i)*8, 24*8, 8, 8}; |