mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-25 12:25:52 -04:00
fdf31508b8
git-svn-id: svn://localhost@708 8062f311-0dae-4547-b526-b8ab9ac864a5
72 lines
1.5 KiB
C++
72 lines
1.5 KiB
C++
/** \file
|
|
* Game Develop
|
|
* 2008-2012 Florian Rival (Florian.Rival@gmail.com)
|
|
*/
|
|
#include "GDCore/Events/Instruction.h"
|
|
#include "GDCore/Events/Expression.h"
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include <assert.h>
|
|
|
|
using namespace std;
|
|
|
|
namespace gd
|
|
{
|
|
|
|
gd::Expression Instruction::badExpression("");
|
|
|
|
Instruction::Instruction(string type_) :
|
|
renderedHeightNeedUpdate(true),
|
|
renderedHeight(0),
|
|
selected(false),
|
|
type(type_),
|
|
inverted(false)
|
|
{
|
|
//ctor
|
|
parameters.reserve(8);
|
|
}
|
|
|
|
Instruction::Instruction(string type_, const vector <gd::Expression> & parameters_, bool inverted_) :
|
|
renderedHeightNeedUpdate(true),
|
|
renderedHeight(0),
|
|
selected(false),
|
|
type(type_),
|
|
inverted(inverted_),
|
|
parameters(parameters_)
|
|
{
|
|
parameters.reserve(8);
|
|
}
|
|
|
|
const gd::Expression & Instruction::GetParameter(unsigned int index) const
|
|
{
|
|
if ( index >= parameters.size() ) return badExpression;
|
|
|
|
return parameters[index];
|
|
}
|
|
|
|
gd::Expression & Instruction::GetParameter(unsigned int index)
|
|
{
|
|
if ( index >= parameters.size() ) return badExpression;
|
|
|
|
return parameters[index];
|
|
}
|
|
|
|
Instruction::~Instruction()
|
|
{
|
|
//dtor
|
|
}
|
|
|
|
void Instruction::SetParameter(unsigned int nb, const gd::Expression & val)
|
|
{
|
|
if ( nb >= parameters.size() )
|
|
{
|
|
cout << "Tentative d'écriture dans un paramètre invalide.\n\nCeci est peut être dû à un bug de Game Develop.\nReportez vous à l'aide pour savoir comment nous rapport une erreur.";
|
|
return;
|
|
}
|
|
parameters[nb] = val;
|
|
}
|
|
|
|
|
|
}
|