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 u_int_level_variable_getter_creator.cpp
26
* \brief Implementation of the bear::u_int_level_variable_getter_creator class.
27
* \author Julien Jorge
29
#include "generic_items/level_variable/u_int_level_variable_getter_creator.hpp"
31
BASE_ITEM_EXPORT( u_int_level_variable_getter_creator, bear )
33
/*----------------------------------------------------------------------------*/
37
bear::u_int_level_variable_getter_creator::u_int_level_variable_getter_creator()
39
m_expr.set_default_value(0);
40
} // u_int_level_variable_getter_creator::u_int_level_variable_getter_creator()
42
/*----------------------------------------------------------------------------*/
44
* \brief Initialize the item.
46
void bear::u_int_level_variable_getter_creator::build()
48
m_expr.set_level( &engine::level_object::get_level() );
51
} // u_int_level_variable_getter_creator::build()
53
/*----------------------------------------------------------------------------*/
55
* \brief Tell if the item is correctly initialized.
57
bool bear::u_int_level_variable_getter_creator::is_valid() const
59
return !m_expr.get_name().empty() && super::is_valid();
60
} // u_int_level_variable_getter_creator::is_valid()
62
/*----------------------------------------------------------------------------*/
64
* \brief Set a field of type \c string.
65
* \param name The name of the field.
66
* \param value The new value of the field.
67
* \return false if the field "name" is unknow, true otherwise.
69
bool bear::u_int_level_variable_getter_creator::set_string_field
70
( const std::string& name, const std::string& value )
74
if ( name == "u_int_level_variable_getter_creator.name" )
75
m_expr.set_name(value);
77
result = super::set_string_field(name,value);
80
} // u_int_level_variable_getter_creator::set_string_field()
82
/*----------------------------------------------------------------------------*/
84
* \brief Set a field of type \c unsigned integer.
85
* \param name The name of the field.
86
* \param value The new value of the field.
87
* \return false if the field "name" is unknow, true otherwise.
89
bool bear::u_int_level_variable_getter_creator::set_u_integer_field
90
( const std::string& name, unsigned int value )
94
if ( name == "u_int_level_variable_getter_creator.default_value" )
95
m_expr.set_default_value(value);
97
result = super::set_u_integer_field(name,value);
100
} // u_int_level_variable_getter_creator::set_u_int_field()
102
/*----------------------------------------------------------------------------*/
104
* \brief Get the expression created by this item.
106
bear::expr::linear_expression
107
bear::u_int_level_variable_getter_creator::do_get_expression() const
110
} // u_level_game_variable_getter_creator::do_get_expression()