From 828f8c5c88c07af22e5a04821c51c77dc2802b50 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Sun, 29 Oct 2017 12:47:18 -0700 Subject: [PATCH 1/3] Minor improvements to Makefile.mac. --- Makefile.mac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.mac b/Makefile.mac index 502e79c5..46847ecf 100644 --- a/Makefile.mac +++ b/Makefile.mac @@ -6,7 +6,8 @@ # Run "brew install sdl_ttf". # Run "make -f Makefile.mac" to build HyperRogue as ./hyper. -CXXFLAGS += -std=c++11 -DMAC +CXXFLAGS += -std=c++11 -march=native -DMAC +# CXXFLAGS += -DCAP_ROGUEVIZ CXXFLAGS += -W -Wall -Wextra -pedantic CXXFLAGS += -Wno-format-pedantic -Wno-unused-parameter -Wno-char-subscripts -Wno-missing-field-initializers -Wno-vla-extension CXXFLAGS += ${EXTRA_CXXFLAGS} @@ -19,7 +20,7 @@ hyper: hyper.o hyper.o: *.cpp language-data.cpp $(CXX) $(CXXFLAGS) -O2 -c hyper.cpp -langen: langen.cpp +langen: langen.cpp language-??.cpp language-ptbr.cpp $(CXX) $(CXXFLAGS) -O0 -Wno-embedded-directive langen.cpp -o langen # Generation of language-data.cpp From f111c8b209d560899f4be994e49478eb659809eb Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Mon, 30 Oct 2017 17:14:32 -0700 Subject: [PATCH 2/3] Fix two non-C++11isms when compiling with CAP_ROGUEVIZ. Generic lambdas are C++14, and since we only have one in the whole codebase, let's just not do that. (Alternatively, I could replace -std=c++11 in the makefile with -std=c++14. I'd be okay with that personally.) "%Ld" is a typo for "%lld". --- kohonen.cpp | 5 +++-- rogueviz.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/kohonen.cpp b/kohonen.cpp index 2a4e9d81..342d3067 100644 --- a/kohonen.cpp +++ b/kohonen.cpp @@ -607,10 +607,11 @@ void describe(cell *c) { help += "parameters:"; for(int k=0; knet[k]); help += ", u-matrix = " + fts(n->udist); help += "\n"; - vector> v; + using Pair = pair; + vector v; for(int s=0; snet, data[s].val), s); random_shuffle(v.begin(), v.end()); - sort(v.begin(), v.end(), [] (auto a, auto b) { return a.first < b.first; }); + sort(v.begin(), v.end(), [] (const Pair& a, const Pair& b) { return a.first < b.first; }); for(int i=0; i seq; while(reached>1) { seq.push_back(llts(reached)); From eb270595f8e29d217af7fe9419c9e045a90ebb5f Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Wed, 20 Dec 2017 15:34:49 -0800 Subject: [PATCH 3/3] Fix the return type of monstersnear. No intended functional change. --- game.cpp | 24 +++++++++++------------- orbs.cpp | 8 ++++---- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/game.cpp b/game.cpp index 7ca4136a..44fa21c4 100644 --- a/game.cpp +++ b/game.cpp @@ -1038,8 +1038,6 @@ bool outlawNearby(cell *c, int dist) { return false; } -// int monstersnear(cell *c, cell *nocount = NULL, eMonster who = moPlayer, cell *pushto = NULL) { - namespace stalemate { bool anyKilled() { for(int i=0; iitem == itOrbAether && c->wall == waBoat); } -int monstersnear(stalemate1& sm) { +bool monstersnear(stalemate1& sm) { cell *c = sm.moveto; bool eaten = false; - if(hardcore && sm.who == moPlayer) return 0; + if(hardcore && sm.who == moPlayer) return false; int res = 0; bool fast = false; @@ -1156,12 +1154,12 @@ int monstersnear(stalemate1& sm) { if(sm.who == moPlayer && res && markOrb2(itOrbDomination) && c->monst) res = 0; - return res; + return !!res; } namespace multi { bool aftermove; } -int monstersnear2(); +bool monstersnear2(); int lastkills; @@ -1194,9 +1192,9 @@ bool swordConflict(const stalemate1& sm1, const stalemate1& sm2) { return false; } -int monstersnear2() { +bool monstersnear2() { multi::cpid++; - int b = 0; + bool b = false; bool recorduse[ittypes]; for(int i=0; i 8) - { b = 1; which = moAirball; } + { b = true; which = moAirball; } } for(int i=0; !b && i x7(stalemate::who, who); - int b; + bool b; if(who == moPlayer && c->wall == waBigStatue) { eWall w = comefrom->wall; c->wall = waNone; diff --git a/orbs.cpp b/orbs.cpp index e8dcb27e..8681181b 100644 --- a/orbs.cpp +++ b/orbs.cpp @@ -882,12 +882,12 @@ void useOrbOfDragon(cell *c) { checkmoveO(); } -int monstersnearO(orbAction a, cell *c, cell *nocount, eMonster who, cell *pushto, cell *comefrom) { +bool monstersnearO(orbAction a, cell *c, cell *nocount, eMonster who, cell *pushto, cell *comefrom) { // printf("[a = %d] ", a); - if(shmup::on) return 0; + if(shmup::on) return false; if(a == roCheck && multi::players > 1) - return 1; - else if(a == roMultiCheck) return 0; + return true; + else if(a == roMultiCheck) return false; else return monstersnear(c, nocount, who, pushto, comefrom); }