diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2017-12-17 00:20:07 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2017-12-17 00:20:07 +0300 |
commit | 16ca196b5adc4afae48b82abbf9161ca92df4873 (patch) | |
tree | e21a2ecbf1afed836da7d1065ae73b6ba5735f69 /utils/adlmidi-2 | |
parent | 71600cfd7b252d8e39f2020f7ca0ffe2671e7fc8 (diff) | |
download | libADLMIDI-16ca196b5adc4afae48b82abbf9161ca92df4873.tar.gz libADLMIDI-16ca196b5adc4afae48b82abbf9161ca92df4873.tar.bz2 libADLMIDI-16ca196b5adc4afae48b82abbf9161ca92df4873.zip |
Fixed build on CLang 3.8.0 on Linux
Diffstat (limited to 'utils/adlmidi-2')
-rw-r--r-- | utils/adlmidi-2/9x15.hpp | 10 | ||||
-rw-r--r-- | utils/adlmidi-2/midiplay.cc | 18 | ||||
-rw-r--r-- | utils/adlmidi-2/puzzlegame.cc | 30 | ||||
-rwxr-xr-x | utils/adlmidi-2/puzzlegame.hpp | 2 |
4 files changed, 44 insertions, 16 deletions
diff --git a/utils/adlmidi-2/9x15.hpp b/utils/adlmidi-2/9x15.hpp index 9812951..e535d49 100644 --- a/utils/adlmidi-2/9x15.hpp +++ b/utils/adlmidi-2/9x15.hpp @@ -1,3 +1,7 @@ +#include <stdint.h> +static unsigned UnicodeToASCIIapproximation(unsigned n); +class UIfontBase; + namespace ns_font9x15 { static const unsigned char bitmap[3840] = { 0x00,0xDB,0xDB,0x00,0xC3,0xC3,0x00,0xC3,0xC3,0x00,0xDB,0xDB,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x1C,0x3E,0x7F,0xFF,0x7F,0x3E,0x1C,0x08,0x00,0x00,0x00, /* 00 (U+0000) */ @@ -131,6 +135,7 @@ static const unsigned char bitmap[3840] = { }; static const struct unicode_to_bitmap_index_generator { + explicit unicode_to_bitmap_index_generator() {} static uint_least8_t Help(uint8_t index, bool InRecursion) { return InRecursion ? (index & 0xFF) : Find(UnicodeToASCIIapproximation(index)&0xFF, @@ -146,12 +151,15 @@ true); } uint_least8_t operator[] (uint_least8_t index) const { return Find(index, false); } } unicode_to_bitmap_index; -} +}//ns_font9x15 struct font9x15: public UIfontBase { + font9x15() : UIfontBase() + {} virtual const unsigned char* GetBitmap() const { return ns_font9x15::bitmap; } virtual unsigned GetIndex(char32_t c) const { return ns_font9x15::unicode_to_bitmap_index[c]; } }; + static UIfontBase* Getfont9x15() { static font9x15 f; diff --git a/utils/adlmidi-2/midiplay.cc b/utils/adlmidi-2/midiplay.cc index 1d5e249..c0f0f2e 100644 --- a/utils/adlmidi-2/midiplay.cc +++ b/utils/adlmidi-2/midiplay.cc @@ -147,7 +147,12 @@ xInput Input; #endif #ifdef SUPPORT_VIDEO_OUTPUT -class UIfontBase {}; +class UIfontBase +{ +public: + explicit UIfontBase() {} + virtual ~UIfontBase() {} +}; static unsigned UnicodeToASCIIapproximation(unsigned n) { return n; @@ -1411,11 +1416,12 @@ static void SendStereoAudio(unsigned long count, short *samples) static void TidyupAndExit(int sig) { - if((sig == SIGINT) - #ifdef __DJGPP__ - || (sig == SIGQUIT) - #endif - ) + bool hookSignal = false; + hookSignal |= (sig == SIGINT); + #ifdef __DJGPP__ + hookSignal |= (sig == SIGQUIT) + #endif + if(hookSignal) { UI.ShowCursor(); UI.Color(7); diff --git a/utils/adlmidi-2/puzzlegame.cc b/utils/adlmidi-2/puzzlegame.cc index 07ceb94..e9d2b9b 100644 --- a/utils/adlmidi-2/puzzlegame.cc +++ b/utils/adlmidi-2/puzzlegame.cc @@ -52,7 +52,7 @@ void ADLMIDI_PuzzleGame::TetrisArea::DrawBlock(unsigned x, unsigned y, int color void ADLMIDI_PuzzleGame::TetrisArea::DrawPiece(const ADLMIDI_PuzzleGame::Piece &piece, int color) { - piece > [&](int x, int y)->bool { this->DrawBlock(x, y, color); return false; }; + (void)(piece > [&](int x, int y)->bool { this->DrawBlock(x, y, color); return false; }); } bool ADLMIDI_PuzzleGame::TetrisArea::CollidePiece(const ADLMIDI_PuzzleGame::Piece &piece) const @@ -82,7 +82,12 @@ bool ADLMIDI_PuzzleGame::TetrisArea::CascadeEmpty(int FirstY) // Clear all full lines in Tengen Tetris style. for(animx = 1; animx < Width - 1; ++animx) { - for(timer = Timer; Timer < timer + 6;) ccrReturn(true); + for(timer = Timer; Timer < timer + 6;) + ccrReturn(true); + /* + * FIXME: Improve weird code fragment disliked by CLang + * /////////BEGIN//////////// + */ auto label = " SINGLE " " DOUBLE " @@ -92,10 +97,17 @@ bool ADLMIDI_PuzzleGame::TetrisArea::CascadeEmpty(int FirstY) "QUINTUPLE " " SEXTUPLE " " SEPTUPLE " - " OCTUPLE " + ((n_full - 1) * 10); + " OCTUPLE " + + ((n_full - 1) * 10); for(int y = FirstY; y < Height - 1; ++y) + { if(list_full & (1u << y)) DrawBlock(animx, y, label[(animx % 10)] + 0x100); + } + /* + * /////////END//////////// + */ + if(DoDraw) Sound(10 + animx * n_full * 40, 2); } if(DoDraw) Sound(50, 15); @@ -298,7 +310,7 @@ Recursion: // cells of the piece contribute into full (completed) rows. char full[4] = { -1, -1, -1, -1}; int miny = n.y + 9, maxy = n.y - 9, minx = n.x + 9, maxx = n.x - 9, num_eroded = 0; - n > [&](int x, int y) -> bool + (void)(n > [&](int x, int y) -> bool { if(x < minx) minx = x; @@ -311,7 +323,7 @@ Recursion: if(full[y - n.y] < 0) full[y - n.y] = this->TestFully(y, true); num_eroded += full[y - n.y]; return false; - }; + }); CascadeEmpty(n.y); @@ -645,9 +657,9 @@ void ADLMIDI_PuzzleGame::Tetris::MakeNext() return false; }; fx(); - seq[1] > db; + (void)(seq[1] > db); seq[0] = seq[1]; - seq[2] > db; + (void)(seq[2] > db); seq[1] = seq[2]; /*seq[3]>db; seq[2] = seq[3]; seq[4]>db; seq[3] = seq[4]; @@ -702,9 +714,9 @@ void ADLMIDI_PuzzleGame::Tetris::MakeNext() seq[which].r = rnd % 4; fx(); c = seq[1].color; - seq[1] > db; + (void)(seq[1] > db); c = (seq[2].color & 0xF00) + 176; - seq[2] > db; + (void)(seq[2] > db); /*c=(seq[3].color&0xF00) + 176; seq[3]>db; c=(seq[4].color&0xF00) + 176; seq[4]>db; c=(seq[5].color&0xF00) + 176; seq[5]>db; diff --git a/utils/adlmidi-2/puzzlegame.hpp b/utils/adlmidi-2/puzzlegame.hpp index ece8d16..03ad921 100755 --- a/utils/adlmidi-2/puzzlegame.hpp +++ b/utils/adlmidi-2/puzzlegame.hpp @@ -53,12 +53,14 @@ namespace ADLMIDI_PuzzleGame { uint64_t p = 1ull, q = shape.s[r]; for(int by=0; by<8; ++by) + { for(int bx=0; bx<8; ++bx) { if((q & p) && it(x+bx, y+by)) return true; //p >>= 1ull; p <<= 1ull; } + } return false; } template<typename T> // transmogrify operator |