source: trunk/monsterz/mash.cpp @ 262

Last change on this file since 262 was 262, checked in by sam, 10 years ago

Mashes can now keep track of Pieces. Unused yet.

File size: 1.2 KB
Line 
1//
2// Monsterz
3//
4// Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <cstdio>
16#include <cmath>
17
18#include "core.h"
19#include "mash.h"
20#include "monsterz.h"
21
22/*
23 * Mash implementation class
24 */
25
26class MashData
27{
28    friend class Mash;
29
30private:
31    Game *game;
32    Piece *pieces[8 * 8];
33    Int2 cells[8 * 8];
34    int npieces;
35};
36
37/*
38 * Public Mash class
39 */
40
41Mash::Mash(Game *game)
42  : data(new MashData()),
43    nextmash(NULL)
44{
45    data->game = game;
46    Ticker::Ref(game);
47    data->npieces = 0;
48}
49
50void Mash::AddPiece(Piece *piece)
51{
52    data->pieces[data->npieces] = piece;
53    data->cells[data->npieces] = piece->GetCell();
54    data->npieces++;
55}
56
57void Mash::TickGame(float deltams)
58{
59    Entity::TickGame(deltams);
60}
61
62void Mash::TickDraw(float deltams)
63{
64    Entity::TickDraw(deltams);
65}
66
67Mash::~Mash()
68{
69    Ticker::Unref(data->game);
70    delete data;
71}
72
Note: See TracBrowser for help on using the repository browser.