source: trunk/src/entity.cpp @ 1502

Last change on this file since 1502 was 1502, checked in by sam, 7 years ago

core: fix a few build warnings and remove useless operators from the
"half" class. The build is now 3% faster.

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2012 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 <cstdlib>
16
17#include "core.h"
18
19namespace lol
20{
21
22/*
23 * Public Entity class
24 */
25
26Entity::Entity() :
27    m_gamenext(0),
28    m_drawnext(0),
29    m_ref(0),
30    m_destroy(0)
31{
32#if !LOL_RELEASE
33    m_tickstate = STATE_IDLE;
34#endif
35    m_gamegroup = GAMEGROUP_DEFAULT;
36    m_drawgroup = DRAWGROUP_DEFAULT;
37    Ticker::Register(this);
38}
39
40Entity::~Entity()
41{
42#if !LOL_RELEASE
43    if (!m_destroy)
44        Log::Error("entity destructor called directly\n");
45#endif
46}
47
48char const *Entity::GetName()
49{
50    return "<entity>";
51}
52
53void Entity::TickGame(float seconds)
54{
55    (void)seconds;
56#if !LOL_RELEASE
57    if (m_tickstate != STATE_PRETICK_GAME)
58        Log::Error("invalid entity game tick\n");
59    m_tickstate = STATE_POSTTICK_GAME;
60#endif
61}
62
63void Entity::TickDraw(float seconds)
64{
65    (void)seconds;
66#if !LOL_RELEASE
67    if (m_tickstate != STATE_PRETICK_DRAW)
68        Log::Error("invalid entity draw tick\n");
69    m_tickstate = STATE_POSTTICK_DRAW;
70#endif
71}
72
73void Entity::SetState(uint32_t state)
74{
75    Ticker::SetState(this, state);
76}
77
78void Entity::SetStateWhenMatch(uint32_t state,
79                               Entity *other_entity, uint32_t other_state)
80{
81    Ticker::SetStateWhenMatch(this, state, other_entity, other_state);
82}
83
84} /* namespace lol */
85
Note: See TracBrowser for help on using the repository browser.