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

« back to all changes in this revision

Viewing changes to bear-engine/lib/src/generic_items/game_variable/code/int_game_variable_setter.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
1
/*
2
2
  Bear Engine
3
3
 
4
 
  Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
 
4
  Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
5
5
 
6
6
  This program is free software; you can redistribute it and/or modify it
7
7
  under the terms of the GNU General Public License as published by the
29
29
#include "generic_items/game_variable/int_game_variable_setter.hpp"
30
30
 
31
31
#include "engine/game.hpp"
 
32
#include "engine/variable/variable.hpp"
32
33
 
33
34
BASE_ITEM_EXPORT( int_game_variable_setter, bear )
 
35
BASE_ITEM_EXPORT( int_game_variable_setter_suicide, bear )
 
36
BASE_ITEM_EXPORT( int_game_variable_setter_toggle, bear )
34
37
 
35
38
/*----------------------------------------------------------------------------*/
36
39
/**
37
40
 * \brief Contructor.
38
41
 */
39
42
bear::int_game_variable_setter::int_game_variable_setter()
40
 
  : m_name(""), m_value(0)
 
43
  : m_value(0)
41
44
{
 
45
 
42
46
} // int_game_variable_setter::int_game_variable_setter()
43
47
 
44
48
/*----------------------------------------------------------------------------*/
45
49
/**
46
 
 * \brief Initialize the item.
47
 
 */
48
 
void bear::int_game_variable_setter::build()
49
 
{
50
 
  engine::game::get_instance().get_game_variables().set<int>
51
 
    ( m_name, m_value );
52
 
  kill();
53
 
} // int_game_variable_setter::build()
54
 
 
55
 
/*----------------------------------------------------------------------------*/
56
 
/**
57
50
 * \brief Tell if the item is correctly initialized.
58
51
 */
59
52
bool bear::int_game_variable_setter::is_valid() const
60
53
{
61
 
  return (! m_name.empty()) && super::is_valid();
 
54
  return (!m_name.empty()) && super::is_valid();
62
55
} // int_game_variable_setter::is_valid()
63
56
 
64
57
/*----------------------------------------------------------------------------*/
97
90
    m_name = value;
98
91
  else
99
92
    result = super::set_string_field(name,value);
100
 
  
 
93
 
101
94
  return result;
102
95
} // int_game_variable_setter::set_string_field()
 
96
 
 
97
/*----------------------------------------------------------------------------*/
 
98
/**
 
99
 * \brief Assign the value to the game variable.
 
100
 */
 
101
void bear::int_game_variable_setter::assign_game_variable_value() const
 
102
{
 
103
  engine::game::get_instance().set_game_variable
 
104
    ( engine::variable<int>( m_name, m_value ) );
 
105
} // int_game_variable_setter::assign_game_variable_value()