Fixes for datatype size on amd64.
[crack-attack.git] / src / ComboManager.cxx
blob69057f450b628cb212f53bc5dbdc7409fe1c733a
1 /*
2 * ComboManager.cxx
3 * Daniel Nelson - 8/24/0
5 * Copyright (C) 2000 Daniel Nelson
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * Daniel Nelson - aluminumangel.org
22 * 174 W. 18th Ave.
23 * Columbus, OH 43210
25 * Watches for finished combo tabulators and generates the appropriate garbage
26 * blocks. Handles the combo tabulator free store.
29 #include "ComboManager.h"
31 #include "Game.h"
32 #include "ComboTabulator.h"
33 #include "GarbageGenerator.h"
34 #include "Score.h"
37 ComboTabulator ComboManager::tabulatorStore[GC_COMBO_TABULATOR_STORE_SIZE];
38 bool ComboManager::storeMap[GC_COMBO_TABULATOR_STORE_SIZE];
39 int ComboManager::combo_count;
41 void ComboManager::gameStart ( )
43 for (int n = GC_COMBO_TABULATOR_STORE_SIZE; n--; ) {
44 storeMap[n] = false;
45 tabulatorStore[n].id = n;
48 combo_count = 0;
51 void ComboManager::timeStep ( )
53 // loop through the active combos
54 int c = combo_count;
55 for (int n = 0; c; n++) {
56 if (!storeMap[n]) continue;
57 ComboTabulator &combo = tabulatorStore[n];
58 c--;
60 // if this combo is complete
61 if (combo.involvement_count == 0) {
63 // the garbage generator
64 GarbageGenerator::comboComplete(combo);
66 // delete the combo; circumvent deleteComboTabulator()
67 freeId(n);
69 // if an elimination in this combo just occured
70 } else if (combo.time_stamp == Game::time_step) {
72 // notify the score
73 int score = Score::reportElimination(combo);
74 combo.base_accumulated_score += score;
75 combo.base_score_this_step += score;
77 if (combo.n_multipliers_this_step != 0)
78 Score::reportMultiplier(combo);
79 combo.base_score_this_step = 0;
81 // notify the garbage generator; removes the elimination magnitude
82 GarbageGenerator::comboElimination(combo);