source: trunk/src/entity.cpp @ 153

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

Factor Forge and Tiler using the new Dict class.

  • 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 "Generic 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::TickRender(float deltams)
58{
59#if !FINAL_RELEASE
60    if (state != STATE_PRETICK_RENDER)
61        fprintf(stderr, "ERROR: invalid entity render tick\n");
62    state = STATE_POSTTICK_RENDER;
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.