8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
13 #include "IPhysicsMovableItem.h"
14 #include "IPhysicsBody.h"
16 #include "MovableItem.h"
74 {
Std_TraceMsg(0,
"Caught Error in desctructor of Stomach\r\n",
"", -1,
false,
true);}
113 void Stomach::AddEnergy(
float fltVal)
165 Std_IsAboveMin((
float) 0, fltVal,
true,
"BaseConsumptionRate",
true);
248 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"Organism");
250 lpOrganism->
Kill(
true);
256 bool Stomach::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
260 if(RigidBody::SetData(strType, strValue,
false))
263 if(strType ==
"KILLORGANISM")
269 if(strType ==
"ENERGYLEVEL")
275 if(strType ==
"MAXENERGYLEVEL")
281 if(strType ==
"BASECONSUMPTIONRATE")
289 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
294 void Stomach::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
296 RigidBody::QueryProperties(aryProperties);
298 aryProperties.Add(
new TypeProperty(
"ConsumptionRate", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
299 aryProperties.Add(
new TypeProperty(
"ConsumptionForStep", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
300 aryProperties.Add(
new TypeProperty(
"AdapterConsumptionRate", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
301 aryProperties.Add(
new TypeProperty(
"Alive", AnimatPropertyType::Boolean, AnimatPropertyDirection::Get));
303 aryProperties.Add(
new TypeProperty(
"KillOrganism", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
304 aryProperties.Add(
new TypeProperty(
"EnergyLevel", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
305 aryProperties.Add(
new TypeProperty(
"MaxEnergyLevel", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
306 aryProperties.Add(
new TypeProperty(
"BaseConsumptionRate", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
309 float *Stomach::GetDataPointer(
const std::string &strDataType)
313 if(strType ==
"ENERGYLEVEL")
316 if(strType ==
"CONSUMPTIONRATE")
319 if(strType ==
"CONSUMPTIONFORSTEP")
322 if(strType ==
"ADAPTERCONSUMPTIONRATE")
325 if(strType ==
"ALIVE")
328 return RigidBody::GetDataPointer(strDataType);
338 void Stomach::Load(
CStdXml &oXml)
340 RigidBody::Load(oXml);
float m_fltMaxEnergyLevel
float m_fltEnergyLevel
The current energy level.
Base class file for all Animat simulation objects.
virtual void PhysicsTimeStep(float fltVal)
Sets the integration time step for the physics engine.
Declares the simulation recorder class.
float m_fltBaseConsumptionRate
The base consumption rate. This is the standard, constant rate of consumption.
Root namespace for the base simulation library for AnimatLab.
Stomach()
Default constructor.
float m_fltConsumptionForStep
The consumption for the current simulation step. This is the consumption rate times the time step siz...
Declares the body part class.
virtual float BaseConsumptionRate()
Gets the base consumption rate.
virtual bool KillOrganism()
Gets whether to kill the organism if energy level reaches zero.
bool m_bKillOrganism
If this is true then if the energy level reaches zero then the organism is killed.
float m_fltConsumptionRate
The current consumption rate. This is calculated by adding m_fltAdapterConsumptionRate and m_fltBaseC...
bool m_bKilled
Set to true if the organism is killed.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual ~Stomach()
Destructor.
Simulator * m_lpSim
The pointer to a Simulation.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
Class that stores information about types for QueryProperty information.
Declares the key frame class.
virtual void AddExternalNodeInput(int iTargetDataType, float fltInput)
Adds an external node input.
Declares the joint class.
Declares the organism class.
virtual bool SimRunning()
Gets whether the simulation is running.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
AnimatSim::Environment::Structure * m_lpStructure
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL...
Declares the activated item class.
Declares the stomach class.
float m_fltAdapterConsumptionRate
Declares a light manager object.
Declares the bounding box class.
virtual float ConsumptionRate()
Gets the current consumption rate.
A standard xml manipulation class.
virtual float EnergyLevel()
Gets the energy level.
virtual float MaxEnergyLevel()
Gets the maximum energy level.
float m_fltReportAlive
Used to report in GetDataPointer if the organism was killed.
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
bool Std_ToBool(int iVal)
Converts a value toa bool.
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
virtual bool GetChildBool(std::string strElementName)
Gets a bool value from the element with the specified name.
A dynamic organism that is controlled by a neural network.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Declares the data chart manager class.
Declares the rigid body class.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
Declares the structure class.
Declares the odor type class.
virtual void Kill(bool bState=true)
Kills.
Declares the simulator class.
Declares the activated item manager class.
float m_fltInitEnergyLevel
The starting energy level.
Declares the external stimuli manager class.
virtual void StepSimulation()
Step the simulation for this object.
Declares the receptive field class.
virtual float GetChildFloat(std::string strElementName)
Gets a float value from the element with the specified name.