~ubuntu-branches/ubuntu/natty/plee-the-bear/natty

« back to all changes in this revision

Viewing changes to bear-engine/lib/src/generic_items/script/code/add_script_actor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge, Julien Jorge
  • Date: 2010-11-17 20:13:34 UTC
  • mfrom: (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101117201334-o4dp7uq437to7oxb
Tags: 0.5.1-1
[ Julien Jorge ]
* New upstream release (Closes: #565062, #546514).
* Add armhf architecture (Closes: #604689).
* Remove patches integrated upstream: rpath-editors.diff, rpath-game.diff,
  editors-menu-section.diff.
* Bump the Standard-Version, no changes.
* Update my email address.
* Set build dependency of libclaw to 1.6.0.
* Add the missing ${misc:Depends} in debian/control.
* List gettext translations in bear-factory.install and plee-the-bear.install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Bear Engine
 
3
 
 
4
  Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
 
5
 
 
6
  This program is free software; you can redistribute it and/or modify it
 
7
  under the terms of the GNU General Public License as published by the
 
8
  Free Software Foundation; either version 2 of the License, or (at your
 
9
  option) any later version.
 
10
 
 
11
  This program is distributed in the hope that it will be useful, but WITHOUT
 
12
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
13
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
14
  more details.
 
15
 
 
16
  You should have received a copy of the GNU General Public License along
 
17
  with this program; if not, write to the Free Software Foundation, Inc.,
 
18
  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
19
 
 
20
  contact: plee-the-bear@gamned.org
 
21
 
 
22
  Please add the tag [Bear] in the subject of your mails.
 
23
*/
 
24
/**
 
25
 * \file add_script_actor.cpp
 
26
 * \brief Implementation of the bear::add_script_actor class.
 
27
 * \author Sebastien Angibaud
 
28
 */
 
29
#include "generic_items/script/add_script_actor.hpp"
 
30
 
 
31
BASE_ITEM_EXPORT( add_script_actor, bear )
 
32
 
 
33
/*----------------------------------------------------------------------------*/
 
34
/**
 
35
 * \brief Constructor.
 
36
 */
 
37
bear::add_script_actor::add_script_actor()
 
38
  : m_actor(NULL)
 
39
{
 
40
  set_phantom(true);
 
41
  set_can_move_items(false);
 
42
  set_artificial(true);
 
43
} // add_script_actor::add_script_actor()
 
44
 
 
45
/*----------------------------------------------------------------------------*/
 
46
/**
 
47
 * \brief Give the actor at the script director.
 
48
 * \param director The script director.
 
49
 */
 
50
void bear::add_script_actor::set_actor(script_director& director)
 
51
{
 
52
  if ( m_actor != (base_item*)NULL )
 
53
    director.set_actor_item(m_actor_name, m_actor.get());
 
54
} // add_script_actor::set_actor()
 
55
 
 
56
/*----------------------------------------------------------------------------*/
 
57
/**
 
58
 * \brief Set a field of type \c base_item.
 
59
 * \param name The name of the field.
 
60
 * \param value The new value of the field.
 
61
 * \return false if the field "name" is unknow, true otherwise.
 
62
 */
 
63
bool bear::add_script_actor::set_item_field
 
64
( const std::string& name, base_item* value )
 
65
{
 
66
  bool ok = true;
 
67
 
 
68
  if (name == "add_script_actor.actor")
 
69
    m_actor = value;
 
70
  else
 
71
    ok = super::set_item_field(name,value);
 
72
 
 
73
  return ok;
 
74
} // add_script_actor::set_item_field()
 
75
/*----------------------------------------------------------------------------*/
 
76
/**
 
77
 * \brief Set a field of type \c <string>.
 
78
 * \param name The name of the field.
 
79
 * \param value The new value of the field.
 
80
 * \return false if the field "name" is unknow, true otherwise.
 
81
 */
 
82
bool bear::add_script_actor::set_string_field
 
83
( const std::string& name, const std::string& value )
 
84
{
 
85
  bool ok = true;
 
86
 
 
87
  if (name == "add_script_actor.actor_name")
 
88
    m_actor_name = value;
 
89
  else
 
90
    ok = super::set_string_field(name,value);
 
91
 
 
92
  return ok;
 
93
} // add_script_actor::set_string_field()
 
94
 
 
95
/*----------------------------------------------------------------------------*/
 
96
/**
 
97
 * \brief Tell if the item is correctly initialized.
 
98
 */
 
99
bool bear::add_script_actor::is_valid() const
 
100
{
 
101
  return ( m_actor != (base_item*)NULL ) &&
 
102
    ( !m_actor_name.empty() ) && super::is_valid();
 
103
} // add_script_actor::is_valid()