From 252c7398925b5267963c1a48251cd7ba2d4ec381 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 25 Jan 2018 15:20:54 +0000 Subject: Refactor game_state & cache to remove static hack --- src/main/game/game_state.cpp | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'src/main/game/game_state.cpp') diff --git a/src/main/game/game_state.cpp b/src/main/game/game_state.cpp index 8075f50..8f45a38 100644 --- a/src/main/game/game_state.cpp +++ b/src/main/game/game_state.cpp @@ -28,10 +28,7 @@ typedef sol_rules::stock_deal_type sdt; // A private constructor used by both of the public ones. Initializes all of the // piles and pile refs specified by the rules -game_state::game_state(const sol_rules& s_rules) { - game_state::static_reset(); - game_state::rules = s_rules; - +game_state::game_state(const sol_rules& s_rules) : rules(s_rules) { // If there is a hole, creates pile if (rules.hole) { piles.emplace_back(); @@ -203,31 +200,6 @@ game_state::move::move(pile_ref f, pile_ref t, pile::size_type i) } -//////////////////////////// -// SETUP STATIC VARIABLES // -//////////////////////////// - -sol_rules game_state::rules; -std::vector game_state::tableau_piles; -std::vector game_state::cells; -game_state::pile_ref game_state::stock; -game_state::pile_ref game_state::waste; -std::vector game_state::reserve; -std::vector game_state::foundations; -game_state::pile_ref game_state::hole; - - -void game_state::static_reset() { - tableau_piles.clear(); - cells.clear(); - stock = 0; - waste = 0; - reserve.clear(); - foundations.clear(); - hole = 0; -} - - ///////////////////////// // MODIFYING FUNCTIONS // ///////////////////////// -- cgit v1.2.1