source: trunk/src/entity.cpp @ 154

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

Refactor stuff.

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1//
2// Deus Hax (working title)
3// Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
4//
5
6#if defined HAVE_CONFIG_H
7#   include "config.h"
8#endif
9
10#include <cstdlib>
11#include <cstdio>
12
13#include "core.h"
14
15/*
16 * Public Entity class
17 */
18
19Entity::Entity() :
20    next(0),
21    ref(0),
22    destroy(0)
23{
24#if !FINAL_RELEASE
25    state = STATE_IDLE;
26#endif
27    Ticker::Register(this);
28}
29
30Entity::~Entity()
31{
32#if !FINAL_RELEASE
33    if (!destroy)
34        fprintf(stderr, "ERROR: entity destructor called directly\n");
35#endif
36}
37
38char const *Entity::GetName()
39{
40    return "<entity>";
41}
42
43Entity::Group Entity::GetGroup()
44{
45    return GROUP_DEFAULT;
46}
47
48void Entity::TickGame(float deltams)
49{
50#if !FINAL_RELEASE
51    if (state != STATE_PRETICK_GAME)
52        fprintf(stderr, "ERROR: invalid entity game tick\n");
53    state = STATE_POSTTICK_GAME;
54#endif
55}
56
57void Entity::TickDraw(float deltams)
58{
59#if !FINAL_RELEASE
60    if (state != STATE_PRETICK_DRAW)
61        fprintf(stderr, "ERROR: invalid entity draw tick\n");
62    state = STATE_POSTTICK_DRAW;
63#endif
64}
65
66void Entity::Ref()
67{
68    ref++;
69}
70
71int Entity::Unref()
72{
73    return --ref;
74}
75
Note: See TracBrowser for help on using the repository browser.