diff --git a/field.cpp b/field.cpp index 096456dfe270e0238f1a987db642632935c35f37..75c1aec7aa7bddcc00396c2bf27bee6bc2cbb55c 100644 --- a/field.cpp +++ b/field.cpp @@ -73,7 +73,7 @@ void Field::rajzol() const if (_helytelen) gout << color(255,0,0); - gout << font("LiberationSans-Regular.ttf",_szel/3); + gout << font("LiberationSans-Regular.ttf",(_mag/5)*3); if (_ertek) { gout << move_to(_x+ (_szel-gout.twidth(std::to_string(_ertek)))/2, @@ -101,12 +101,7 @@ void Field::set_ertek(int uj) _ertek=uj; } -void Field::set_aura_true() +void Field::set_aura(bool be) { - _aura=true; -} - -void Field::set_aura_false() -{ - _aura=false; + _aura=be; } diff --git a/field.hpp b/field.hpp index bff9f318a6b51b3cfcb1beaf3bb88a65715218a9..bcc9593d35179e78667636eff721a56bc61a32aa 100644 --- a/field.hpp +++ b/field.hpp @@ -14,8 +14,7 @@ class Field : public Widget virtual int get_ertek(); virtual void set_ertek(int); - virtual void set_aura_true(); - virtual void set_aura_false(); + virtual void set_aura(bool); protected: int _ertek; diff --git a/gamemaster.cpp b/gamemaster.cpp index f826558a1a176a5e3858a2ea7b1b78417590513b..574e5cd9751e33b94cbb9ce4ffa2ed5b281ce2e1 100644 --- a/gamemaster.cpp +++ b/gamemaster.cpp @@ -95,9 +95,17 @@ void GameMaster::save(int sorszam, int ertek) save_fajlba(); } -bool GameMaster::szabalyos_e(int jelenlegi_ertek, set<int> ertekek) +bool GameMaster::szabalyos_e(int jelenlegi_ertek, set<int> aura_ertekek) { - + bool igen=true; + for (int ertek : aura_ertekek) + { + if (ertek == jelenlegi_ertek) + { + igen=false;; + } + } + return igen; } std::vector<int> GameMaster::get_feladat() diff --git a/myapp.cpp b/myapp.cpp index 73f058743a50f5f9b36445097f31190f7d037906..06375e40a299e83027c42a0666cb59da5cfb9568 100644 --- a/myapp.cpp +++ b/myapp.cpp @@ -37,11 +37,11 @@ int MyApp::action(std::string id, genv::event ev, int focus) { if (aura_halmaz.find(i) != aura_halmaz.end()) { - palya[i]->set_aura_true(); + palya[i]->set_aura(true); } else { - palya[i]->set_aura_false(); + palya[i]->set_aura(false); } } } @@ -84,11 +84,11 @@ int MyApp::action(std::string id, genv::event ev, int focus) { if (aura_halmaz.find(i) != aura_halmaz.end()) { - palya[i]->set_aura_true(); + palya[i]->set_aura(true); } else { - palya[i]->set_aura_false(); + palya[i]->set_aura(false); } } } @@ -96,14 +96,14 @@ int MyApp::action(std::string id, genv::event ev, int focus) if (ev.keycode >= 49 && ev.keycode <= 57) { palya[focus]->set_ertek(ev.keycode-48); + _game->save(focus,palya[focus]->get_ertek()); } if (ev.keycode==key_delete || ev.keycode==key_backspace) { palya[focus]->set_ertek(0); + _game->save(focus,palya[focus]->get_ertek()); } - - _game->save(focus,palya[focus]->get_ertek()); } if (id=="mouse") @@ -126,11 +126,11 @@ int MyApp::action(std::string id, genv::event ev, int focus) { if (aura_halmaz.find(i) != aura_halmaz.end()) { - palya[i]->set_aura_true(); + palya[i]->set_aura(true); } else { - palya[i]->set_aura_false(); + palya[i]->set_aura(false); } } }