Files
maszyna/MemCell.h
2018-06-15 18:58:03 +02:00

86 lines
2.5 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "Classes.h"
#include "scenenode.h"
#include "Names.h"
class TMemCell : public scene::basic_node {
public:
std::string asTrackName; // McZapkie-100302 - zeby nazwe toru na ktory jest Putcommand wysylane pamietac
bool is_exportable { true }; // export helper; autogenerated cells don't need to be exported
explicit TMemCell( scene::node_data const &Nodedata );
void
UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
bool
Load(cParser *parser);
void
PutCommand( TController *Mech, glm::dvec3 const *Loc );
bool
Compare( std::string const &szTestText, double const fTestValue1, double const fTestValue2, int const CheckMask );
std::string const &
Text() const {
return szText; }
double
Value1() const {
return fValue1; };
double
Value2() const {
return fValue2; };
TCommandType
Command() const {
return eCommand; };
bool
StopCommand() const {
return bCommand; };
void StopCommandSent();
TCommandType CommandCheck();
bool IsVelocity() const;
void AssignEvents(TEvent *e);
private:
// methods
// serialize() subclass details, sends content of the subclass to provided stream
void serialize_( std::ostream &Output ) const;
// deserialize() subclass details, restores content of the subclass from provided stream
void deserialize_( std::istream &Input );
// export() subclass details, sends basic content of the class in legacy (text) format to provided stream
void export_as_text_( std::ostream &Output ) const;
// members
// content
std::string szText;
double fValue1 { 0.0 };
double fValue2 { 0.0 };
// other
TCommandType eCommand { cm_Unknown };
bool bCommand { false }; // czy zawiera komendę dla zatrzymanego AI
TEvent *OnSent { nullptr }; // event dodawany do kolejki po wysłaniu komendy zatrzymującej skład
};
class memory_table : public basic_table<TMemCell> {
public:
// legacy method, initializes traction after deserialization from scenario file
void
InitCells();
// legacy method, sends content of all cells to the log
void
log_all();
};
//---------------------------------------------------------------------------