bastet/bastet-tr1.patch
2017-02-22 08:26:31 -06:00

106 lines
4.0 KiB
Diff

diff -U3 -r bastet-0.43.1/BastetBlockChooser.cpp /home/limb/fedora/bastet/BastetBlockChooser.cpp
--- bastet-0.43.1/BastetBlockChooser.cpp 2014-05-29 13:47:50.000000000 -0500
+++ bastet/BastetBlockChooser.cpp 2017-02-22 08:16:54.551988209 -0600
@@ -19,7 +19,9 @@
#include "BastetBlockChooser.hpp"
#include "Block.hpp"
+#include <boost/functional/hash.hpp>
#include <boost/foreach.hpp>
+#include <unordered_set>
#include <cstdlib>
#include <algorithm>
diff -U3 -r bastet-0.43.1/BastetBlockChooser.hpp /home/limb/fedora/bastet/BastetBlockChooser.hpp
--- bastet-0.43.1/BastetBlockChooser.hpp 2014-05-29 13:47:50.000000000 -0500
+++ bastet/BastetBlockChooser.hpp 2017-02-22 08:16:54.549988291 -0600
@@ -23,16 +23,26 @@
#include "Well.hpp"
-#include <boost/tr1/tr1/unordered_set>
+#include <unordered_set>
#include <set>
#include <boost/functional/hash.hpp>
+//boilerplate to use boost::hash as std::hash
+namespace std{
+ template<> struct hash<Bastet::BlockPosition>{
+ size_t operator()(const Bastet::BlockPosition &fb) const{
+ static boost::hash<Bastet::BlockPosition> h;
+ return h(fb);
+ }
+ };
+ }
+
namespace Bastet{
static const long GameOverScore=-1000; //bogus score assigned to combinations which cause game over
// declared in Well.hpp
-// long Evaluate(const Well *w, int extralines); //assigns a score to a position w + a number of extra lines deleted while getting there
+ long Evaluate(const Well *w, int extralines=0); //assigns a score to a position w + a number of extra lines deleted while getting there
typedef BlockPosition Vertex;
@@ -75,7 +85,7 @@
public:
Searcher(BlockType b, const Well *well, Vertex v, WellVisitor *visitor);
private:
- std::tr1::unordered_set<Vertex> _visited;
+ std::unordered_set<Vertex> _visited;
//std::set<Vertex> _visited; ^^ the above is more efficient, we need to do many inserts
BlockType _block;
const Well *_well;
Only in /home/limb/fedora/bastet/: bastet.png
Only in /home/limb/fedora/bastet/: bastet.svg
Only in /home/limb/fedora/bastet/: depend
Only in /home/limb/fedora/bastet/: .git
diff -U3 -r bastet-0.43.1/Makefile /home/limb/fedora/bastet/Makefile
--- bastet-0.43.1/Makefile 2014-05-29 13:47:50.000000000 -0500
+++ bastet/Makefile 2017-02-22 08:16:54.546988413 -0600
@@ -3,9 +3,9 @@
TESTS=Test.cpp
PROGNAME=bastet
BOOST_PO?=-lboost_program_options
-LDFLAGS+=-lncurses $(BOOST_PO)
+LDFLAGS+=-lncurses $(BOOST_PO) -std=c++11
#CXXFLAGS+=-ggdb -Wall
-CXXFLAGS+=-DNDEBUG -Wall
+CXXFLAGS+=-DNDEBUG -Wall -std=c++11
#CXXFLAGS+=-pg
#LDFLAGS+=-pg
diff -U3 -r bastet-0.43.1/Test.cpp /home/limb/fedora/bastet/Test.cpp
--- bastet-0.43.1/Test.cpp 2014-05-29 13:47:50.000000000 -0500
+++ bastet/Test.cpp 2017-02-22 08:11:53.145250162 -0600
@@ -1,4 +1,5 @@
#include "Well.hpp"
+#include "BastetBlockChooser.hpp"
#include <ios>
using namespace Bastet;
diff -U3 -r bastet-0.43.1/Ui.cpp /home/limb/fedora/bastet/Ui.cpp
--- bastet-0.43.1/Ui.cpp 2014-05-29 13:47:50.000000000 -0500
+++ bastet/Ui.cpp 2017-02-22 08:11:53.145250162 -0600
@@ -482,6 +482,7 @@
}
void Ui::Play(BlockChooser *bc){
+ _level=0;
_points=0;
_lines=0;
BOOST_FOREACH(ColorWellLine &a, _colors)
diff -U3 -r bastet-0.43.1/Well.hpp /home/limb/fedora/bastet/Well.hpp
--- bastet-0.43.1/Well.hpp 2014-05-29 13:47:50.000000000 -0500
+++ bastet/Well.hpp 2017-02-22 08:11:53.146250121 -0600
@@ -66,7 +66,7 @@
LinesCompleted Lock(BlockType t, const BlockPosition &p); //permanently adds a tetromino to the well; returns a bitset of 4 bits where return[i]==1 iff line (start of fb)+i is complete
void ClearLines(const LinesCompleted &lc); //removes the given lines from the well (whether they are completed or not)
int LockAndClearLines(BlockType t, const BlockPosition &p); //locks, clear lines, returns number of lines cleared
- friend long Evaluate(const Well *w, int extralines=0); //for BastetBlockChooser
+ friend long Evaluate(const Well *w, int extralines); //for BastetBlockChooser
std::string PrettyPrint() const;
};