4
Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
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.
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
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
20
contact: plee-the-bear@gamned.org
22
Please add the tag [Bear] in the subject of your mails.
25
* \file add_script_actor.cpp
26
* \brief Implementation of the bear::add_script_actor class.
27
* \author Sebastien Angibaud
29
#include "generic_items/script/add_script_actor.hpp"
31
BASE_ITEM_EXPORT( add_script_actor, bear )
33
/*----------------------------------------------------------------------------*/
37
bear::add_script_actor::add_script_actor()
41
set_can_move_items(false);
43
} // add_script_actor::add_script_actor()
45
/*----------------------------------------------------------------------------*/
47
* \brief Give the actor at the script director.
48
* \param director The script director.
50
void bear::add_script_actor::set_actor(script_director& director)
52
if ( m_actor != (base_item*)NULL )
53
director.set_actor_item(m_actor_name, m_actor.get());
54
} // add_script_actor::set_actor()
56
/*----------------------------------------------------------------------------*/
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.
63
bool bear::add_script_actor::set_item_field
64
( const std::string& name, base_item* value )
68
if (name == "add_script_actor.actor")
71
ok = super::set_item_field(name,value);
74
} // add_script_actor::set_item_field()
75
/*----------------------------------------------------------------------------*/
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.
82
bool bear::add_script_actor::set_string_field
83
( const std::string& name, const std::string& value )
87
if (name == "add_script_actor.actor_name")
90
ok = super::set_string_field(name,value);
93
} // add_script_actor::set_string_field()
95
/*----------------------------------------------------------------------------*/
97
* \brief Tell if the item is correctly initialized.
99
bool bear::add_script_actor::is_valid() const
101
return ( m_actor != (base_item*)NULL ) &&
102
( !m_actor_name.empty() ) && super::is_valid();
103
} // add_script_actor::is_valid()