File: GarbageGenerator.h

package info (click to toggle)
crack-attack 1.1.12-r1-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,132 kB
  • ctags: 1,834
  • sloc: cpp: 14,188; sh: 3,298; xml: 93; makefile: 54
file content (72 lines) | stat: -rw-r--r-- 2,241 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * GarbageGenerator.h
 * Daniel Nelson - 8/24/0
 *
 * Copyright (C) 2000  Daniel Nelson
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Daniel Nelson - aluminumangel.org
 * 174 W. 18th Ave.
 * Columbus, OH  43210
 */

#ifndef GARBAGEGENERATOR_H
#define GARBAGEGENERATOR_H

using namespace std;

#include "Game.h"
#include "MetaState.h"
#include "Communicator.h"
#include "Random.h"
#include "GarbageQueueElement.h"

class ComboTabulator;
class CommunicationBuffer;

/* static */ class GarbageGenerator {
public:
  static void gameStart (   );

  static void comboElimination ( ComboTabulator &combo );
  static void comboComplete ( ComboTabulator &combo );
  static void timeStep (   );
  static void addToQueue ( GarbageQueueElement &e );
  static void addToQueue ( CommunicationBuffer &buffer );
  static void addToQueue ( BufferElement garbage[], size_t size );
  static void addToQueue ( uint32 height, uint32 width, uint32 flavor, uint32 stamp );


private:
  static void sendGarbage ( int height, int width, int flavor );
  static void sendSpecialGarbage ( int flavor );

  static inline int determineDropTime ( int time_stamp )
  {
    return time_stamp
     + (GC_AVERAGE_GARBAGE_DROP_DELAY - GC_SPREAD_GARBAGE_DROP_DELAY / 2)
     + Random::number(GC_SPREAD_GARBAGE_DROP_DELAY);
  }

  static void dealLocalGarbage ( int height, int width, int flavor,
   int time_stamp );
  static void dealSpecialLocalGarbage ( int flavor, int time_stamp );

  static GarbageQueueElement garbage_queue[GC_GARBAGE_QUEUE_SIZE];
  static int waiting_count;
};

#endif