Skip to content

Instantly share code, notes, and snippets.

@Fiona-J-W
Created January 23, 2016 20:54
Show Gist options
  • Save Fiona-J-W/f554613b0ec515c9969e to your computer and use it in GitHub Desktop.
Save Fiona-J-W/f554613b0ec515c9969e to your computer and use it in GitHub Desktop.
compilation fix for GCC
diff --git a/2D-cmd-dungeoncrawler/Dungeon.cpp b/2D-cmd-dungeoncrawler/Dungeon.cpp
index 21e476f..fa155d3 100644
--- a/2D-cmd-dungeoncrawler/Dungeon.cpp
+++ b/2D-cmd-dungeoncrawler/Dungeon.cpp
@@ -295,7 +295,7 @@ void Dungeon::HandleEvents( GameStatus& status )
}
void Dungeon::RemoveDeadCharacters( GameStatus& status, bool safe )
{
- auto& it = _monsters.begin( );
+ auto it = _monsters.begin( );
while( it != _monsters.end( ) )
{
@@ -856,4 +856,4 @@ void Dungeon::GenerateMonsters( bool generate, int amount )
// }
// }
// }
-//}
\ No newline at end of file
+//}
diff --git a/2D-cmd-dungeoncrawler/Functions.h b/2D-cmd-dungeoncrawler/Functions.h
index 6bb8395..7e813e2 100644
--- a/2D-cmd-dungeoncrawler/Functions.h
+++ b/2D-cmd-dungeoncrawler/Functions.h
@@ -2,6 +2,7 @@
#include "Vector2i.h"
#include "Enums.h"
+#include <algorithm>
#include <vector>
class Dungeon;
@@ -58,4 +59,4 @@ void OutputAsciiArtSwords( );
void InputEnter( );
char InputValidChar( const std::string& context, const std::vector<char>& validChoices );
-int InputPositiveInteger( const std::string& context );
\ No newline at end of file
+int InputPositiveInteger( const std::string& context );
diff --git a/2D-cmd-dungeoncrawler/Vector2i.cpp b/2D-cmd-dungeoncrawler/Vector2i.cpp
index 1d7dc57..89d82aa 100644
--- a/2D-cmd-dungeoncrawler/Vector2i.cpp
+++ b/2D-cmd-dungeoncrawler/Vector2i.cpp
@@ -108,7 +108,7 @@ void Vector2iHasher::HashCombine( std::size_t& seed, int value )
seed ^= hasher( value ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
}
-std::size_t Vector2iHasher::operator()( const Vector2i& key )
+std::size_t Vector2iHasher::operator()( const Vector2i& key ) const
{
size_t seed = 0;
@@ -116,4 +116,4 @@ std::size_t Vector2iHasher::operator()( const Vector2i& key )
HashCombine( seed, key.row );
return seed;
-}
\ No newline at end of file
+}
diff --git a/2D-cmd-dungeoncrawler/Vector2i.h b/2D-cmd-dungeoncrawler/Vector2i.h
index 874d6a2..35ee3bd 100644
--- a/2D-cmd-dungeoncrawler/Vector2i.h
+++ b/2D-cmd-dungeoncrawler/Vector2i.h
@@ -33,6 +33,6 @@ const Vector2i operator/( const Vector2i& lhs, int rhs );
struct Vector2iHasher
{
- void HashCombine( std::size_t& seed, int value );
- std::size_t operator( )( const Vector2i& key );
-};
\ No newline at end of file
+ static void HashCombine( std::size_t& seed, int value );
+ std::size_t operator( ) ( const Vector2i& key ) const ;
+};
diff --git a/2D-cmd-dungeoncrawler/main.cpp b/2D-cmd-dungeoncrawler/main.cpp
index 3688dc1..8edba56 100644
--- a/2D-cmd-dungeoncrawler/main.cpp
+++ b/2D-cmd-dungeoncrawler/main.cpp
@@ -1,5 +1,4 @@
#include "Game.h"
-#include <Windows.h>
#include <vector>
extern const Vector2i WINDOW_SIZE( 100, 50 );
@@ -86,4 +85,4 @@ int main( )
}
return 0;
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment