mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 03:09:18 +02:00
maintenance: minor code touch ups
This commit is contained in:
@@ -125,7 +125,7 @@ class TAnimModel : public editor::basic_node {
|
||||
|
||||
public:
|
||||
// constructors
|
||||
TAnimModel( scene::node_data const &Nodedata );
|
||||
explicit TAnimModel( scene::node_data const &Nodedata );
|
||||
// destructor
|
||||
~TAnimModel();
|
||||
// methods
|
||||
|
||||
1
Button.h
1
Button.h
@@ -32,6 +32,7 @@ class TButton
|
||||
void
|
||||
play();
|
||||
// plays specified sound
|
||||
static
|
||||
void
|
||||
play( PSound Sound );
|
||||
|
||||
|
||||
@@ -134,8 +134,8 @@ bool TEventLauncher::check_conditions()
|
||||
// key and modifier
|
||||
auto const modifier = ( iKey & 0xff00 ) >> 8;
|
||||
bCond = ( Console::Pressed( iKey & 0xff ) )
|
||||
&& ( modifier & 1 ? Global::shiftState : true )
|
||||
&& ( modifier & 2 ? Global::ctrlState : true );
|
||||
&& ( ( modifier & 1 ) ? Global::shiftState : true )
|
||||
&& ( ( modifier & 2 ) ? Global::ctrlState : true );
|
||||
}
|
||||
else {
|
||||
// just key
|
||||
|
||||
@@ -18,7 +18,7 @@ class TEventLauncher : public editor::basic_node {
|
||||
|
||||
public:
|
||||
// constructor
|
||||
TEventLauncher( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||
explicit TEventLauncher( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||
// legacy constructor
|
||||
TEventLauncher() = default;
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ FileExists( std::string const &Filename ) {
|
||||
}
|
||||
|
||||
// returns time of last modification for specified file
|
||||
__time64_t
|
||||
std::time_t
|
||||
last_modified( std::string const &Filename ) {
|
||||
|
||||
struct stat filestat;
|
||||
|
||||
@@ -160,4 +160,4 @@ extract_value( bool &Variable, std::string const &Key, std::string const &Input,
|
||||
bool FileExists( std::string const &Filename );
|
||||
|
||||
// returns time of last modification for specified file
|
||||
__time64_t last_modified( std::string const &Filename );
|
||||
std::time_t last_modified( std::string const &Filename );
|
||||
@@ -139,7 +139,7 @@ bool TMemCell::Compare( std::string const &szTestText, double const fTestValue1,
|
||||
&& ( !TestFlag( CheckMask, conditional_memval2 ) || ( fValue2 == fTestValue2 ) ) );
|
||||
};
|
||||
|
||||
bool TMemCell::IsVelocity()
|
||||
bool TMemCell::IsVelocity() const
|
||||
{ // sprawdzenie, czy event odczytu tej komórki ma być do skanowania, czy do kolejkowania
|
||||
if (eCommand == cm_SetVelocity)
|
||||
return true;
|
||||
|
||||
@@ -19,7 +19,7 @@ class TMemCell : public editor::basic_node {
|
||||
public:
|
||||
std::string asTrackName; // McZapkie-100302 - zeby nazwe toru na ktory jest Putcommand wysylane pamietac
|
||||
|
||||
TMemCell( scene::node_data const &Nodedata );
|
||||
explicit TMemCell( scene::node_data const &Nodedata );
|
||||
|
||||
void
|
||||
UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
return bCommand; };
|
||||
void StopCommandSent();
|
||||
TCommandType CommandCheck();
|
||||
bool IsVelocity();
|
||||
bool IsVelocity() const;
|
||||
void AssignEvents(TEvent *e);
|
||||
|
||||
private:
|
||||
|
||||
@@ -1752,7 +1752,7 @@ void TModel3d::Init()
|
||||
// 2012-02 funkcje do tworzenia terenu z E3D
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int TModel3d::TerrainCount()
|
||||
int TModel3d::TerrainCount() const
|
||||
{ // zliczanie kwadratów kilometrowych (główna
|
||||
// linia po Next) do tworznia tablicy
|
||||
int i = 0;
|
||||
|
||||
14
Model3d.h
14
Model3d.h
@@ -183,15 +183,13 @@ public:
|
||||
};
|
||||
void InitialRotate(bool doit);
|
||||
void BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t, std::vector<std::string> *n, bool dynamic);
|
||||
void ReplacableSet(material_handle const *r, int a)
|
||||
{
|
||||
static void ReplacableSet(material_handle const *r, int a) {
|
||||
ReplacableSkinId = r;
|
||||
iAlpha = a;
|
||||
};
|
||||
iAlpha = a; };
|
||||
void Name_Material( std::string const &Name );
|
||||
void Name( std::string const &Name );
|
||||
// Ra: funkcje do budowania terenu z E3D
|
||||
int Flags() { return iFlags; };
|
||||
int Flags() const { return iFlags; };
|
||||
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
||||
void ColorsSet( glm::vec3 const &Ambient, glm::vec3 const &Diffuse, glm::vec3 const &Specular );
|
||||
// sets light level (alpha component of illumination color) to specified value
|
||||
@@ -200,7 +198,7 @@ public:
|
||||
return fMatrix ? *(fMatrix->TranslationGet()) + v_TransVector : v_TransVector; }
|
||||
inline float3 Translation2Get() {
|
||||
return *(fMatrix->TranslationGet()) + Child->Translation1Get(); }
|
||||
material_handle GetMaterial() {
|
||||
material_handle GetMaterial() const {
|
||||
return m_material; }
|
||||
void ParentMatrix(float4x4 *m);
|
||||
float MaxY( float4x4 const &m );
|
||||
@@ -249,8 +247,8 @@ public:
|
||||
void SaveToBinFile(std::string const &FileName);
|
||||
int Flags() const { return iFlags; };
|
||||
void Init();
|
||||
std::string NameGet() { return m_filename; };
|
||||
int TerrainCount();
|
||||
std::string NameGet() const { return m_filename; };
|
||||
int TerrainCount() const;
|
||||
TSubModel * TerrainSquare(int n);
|
||||
void deserialize(std::istream &s, size_t size, bool dynamic);
|
||||
};
|
||||
|
||||
@@ -61,11 +61,11 @@ class garbage_collector {
|
||||
|
||||
public:
|
||||
// constructor:
|
||||
garbage_collector( Container_ &Container, int const Secondstolive, int const Sweepsize, std::string const Resourcename = "resource" ) :
|
||||
m_container( Container ),
|
||||
m_unusedresourcetimetolive { std::chrono::seconds( Secondstolive ) },
|
||||
m_unusedresourcesweepsize( Sweepsize ),
|
||||
m_resourcename( Resourcename )
|
||||
garbage_collector( Container_ &Container, unsigned int const Secondstolive, std::size_t const Sweepsize, std::string const Resourcename = "resource" ) :
|
||||
m_unusedresourcetimetolive{ std::chrono::seconds{ Secondstolive } },
|
||||
m_unusedresourcesweepsize{ Sweepsize },
|
||||
m_resourcename{ Resourcename },
|
||||
m_container{ Container }
|
||||
{}
|
||||
|
||||
// methods:
|
||||
|
||||
@@ -625,7 +625,7 @@ opengl_texture::release( bool const Backup ) {
|
||||
}
|
||||
|
||||
void
|
||||
opengl_texture::set_filtering() {
|
||||
opengl_texture::set_filtering() const {
|
||||
|
||||
// default texture mode
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
void load_DDS();
|
||||
void load_TEX();
|
||||
void load_TGA();
|
||||
void set_filtering();
|
||||
void set_filtering() const;
|
||||
void downsize( GLuint const Format );
|
||||
|
||||
// members
|
||||
|
||||
23
Track.h
23
Track.h
@@ -96,16 +96,11 @@ class TSwitchExtension
|
||||
|
||||
class TIsolated
|
||||
{ // obiekt zbierający zajętości z kilku odcinków
|
||||
int iAxles = 0; // ilość osi na odcinkach obsługiwanych przez obiekt
|
||||
TIsolated *pNext = nullptr; // odcinki izolowane są trzymane w postaci listy jednikierunkowej
|
||||
static TIsolated *pRoot; // początek listy
|
||||
public:
|
||||
std::string asName; // nazwa obiektu, baza do nazw eventów
|
||||
TEvent *evBusy = nullptr; // zdarzenie wyzwalane po zajęciu grupy
|
||||
TEvent *evFree = nullptr; // zdarzenie wyzwalane po całkowitym zwolnieniu zajętości grupy
|
||||
TMemCell *pMemCell = nullptr; // automatyczna komórka pamięci, która współpracuje z odcinkiem izolowanym
|
||||
public:
|
||||
// constructors
|
||||
TIsolated();
|
||||
TIsolated(const std::string &n, TIsolated *i);
|
||||
// methods
|
||||
static void DeleteAll();
|
||||
static TIsolated * Find(const std::string &n); // znalezienie obiektu albo utworzenie nowego
|
||||
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
||||
@@ -115,6 +110,16 @@ class TIsolated
|
||||
return (pRoot); };
|
||||
TIsolated * Next() {
|
||||
return (pNext); };
|
||||
// members
|
||||
std::string asName; // nazwa obiektu, baza do nazw eventów
|
||||
TEvent *evBusy { nullptr }; // zdarzenie wyzwalane po zajęciu grupy
|
||||
TEvent *evFree { nullptr }; // zdarzenie wyzwalane po całkowitym zwolnieniu zajętości grupy
|
||||
TMemCell *pMemCell { nullptr }; // automatyczna komórka pamięci, która współpracuje z odcinkiem izolowanym
|
||||
private:
|
||||
// members
|
||||
int iAxles { 0 }; // ilość osi na odcinkach obsługiwanych przez obiekt
|
||||
TIsolated *pNext { nullptr }; // odcinki izolowane są trzymane w postaci listy jednikierunkowej
|
||||
static TIsolated *pRoot; // początek listy
|
||||
};
|
||||
|
||||
// trajektoria ruchu - opakowanie
|
||||
@@ -184,7 +189,7 @@ public:
|
||||
bool ScannedFlag = false; // McZapkie: do zaznaczania kolorem torów skanowanych przez AI
|
||||
TGroundNode *nFouling[ 2 ] = { nullptr, nullptr }; // współrzędne ukresu albo oporu kozła
|
||||
|
||||
TTrack( scene::node_data const &Nodedata );
|
||||
explicit TTrack( scene::node_data const &Nodedata );
|
||||
virtual ~TTrack();
|
||||
|
||||
void Init();
|
||||
|
||||
@@ -52,7 +52,7 @@ class TTraction : public editor::basic_node {
|
||||
glm::dvec3 m_origin;
|
||||
geometry_handle m_geometry;
|
||||
|
||||
TTraction( scene::node_data const &Nodedata );
|
||||
explicit TTraction( scene::node_data const &Nodedata );
|
||||
|
||||
void Load( cParser *parser, glm::dvec3 const &pOrigin );
|
||||
// set origin point
|
||||
|
||||
@@ -199,8 +199,10 @@ private:
|
||||
bind_buffer();
|
||||
void
|
||||
delete_buffer();
|
||||
static
|
||||
void
|
||||
bind_streams( stream_units const &Units, unsigned int const Streams );
|
||||
static
|
||||
void
|
||||
release_streams();
|
||||
|
||||
@@ -310,7 +312,7 @@ private:
|
||||
// methods
|
||||
inline
|
||||
bool
|
||||
valid( geometry_handle const &Geometry ) {
|
||||
valid( geometry_handle const &Geometry ) const {
|
||||
return ( ( Geometry.bank != 0 )
|
||||
&& ( Geometry.bank <= m_geometrybanks.size() ) ); }
|
||||
inline
|
||||
|
||||
@@ -394,7 +394,7 @@ basic_cell::register_end( TTraction *Traction ) {
|
||||
|
||||
// find a vehicle located nearest to specified point, within specified radius, optionally ignoring vehicles without drivers. reurns: located vehicle and distance
|
||||
std::tuple<TDynamicObject *, float>
|
||||
basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) {
|
||||
basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) const {
|
||||
|
||||
TDynamicObject *vehiclenearest { nullptr };
|
||||
float leastdistance { std::numeric_limits<float>::max() };
|
||||
@@ -429,7 +429,7 @@ basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlyco
|
||||
|
||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||
std::tuple<TTrack *, int>
|
||||
basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) {
|
||||
basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) const {
|
||||
|
||||
Math3D::vector3 point { Point.x, Point.y, Point.z }; // sad workaround until math classes unification
|
||||
int endpointid;
|
||||
@@ -449,7 +449,7 @@ basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) {
|
||||
|
||||
// finds a traction piece with one of its ends located in specified point. returns: located traction piece and id of the matching endpoint
|
||||
std::tuple<TTraction *, int>
|
||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) {
|
||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) const {
|
||||
|
||||
int endpointid;
|
||||
|
||||
@@ -468,7 +468,7 @@ basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) {
|
||||
|
||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||
std::tuple<TTraction *, int, float>
|
||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) {
|
||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) const {
|
||||
|
||||
TTraction
|
||||
*tractionnearest { nullptr };
|
||||
|
||||
9
scene.h
9
scene.h
@@ -116,16 +116,16 @@ public:
|
||||
register_end( TTraction *Traction );
|
||||
// find a vehicle located nearest to specified point, within specified radius. reurns: located vehicle and distance
|
||||
std::tuple<TDynamicObject *, float>
|
||||
find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler );
|
||||
find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) const;
|
||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||
std::tuple<TTrack *, int>
|
||||
find( glm::dvec3 const &Point, TTrack const *Exclude );
|
||||
find( glm::dvec3 const &Point, TTrack const *Exclude ) const;
|
||||
// finds a traction piece with one of its ends located in specified point. returns: located traction piece and id of the matching endpoint
|
||||
std::tuple<TTraction *, int>
|
||||
find( glm::dvec3 const &Point, TTraction const *Exclude );
|
||||
find( glm::dvec3 const &Point, TTraction const *Exclude ) const;
|
||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||
std::tuple<TTraction *, int, float>
|
||||
find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection );
|
||||
find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) const;
|
||||
// sets center point of the cell
|
||||
void
|
||||
center( glm::dvec3 Center );
|
||||
@@ -351,6 +351,7 @@ private:
|
||||
bool
|
||||
point_inside( glm::dvec3 const &Location );
|
||||
// legacy method, trims provided shape to fit into a section. adds trimmed part at the end of provided list, returns true if changes were made
|
||||
static
|
||||
bool
|
||||
RaTriangleDivider( shape_node &Shape, std::deque<shape_node> &Shapes );
|
||||
// provides access to section enclosing specified point
|
||||
|
||||
@@ -307,7 +307,7 @@ struct basic_node {
|
||||
|
||||
public:
|
||||
// constructor
|
||||
basic_node( scene::node_data const &Nodedata );
|
||||
explicit basic_node( scene::node_data const &Nodedata );
|
||||
// destructor
|
||||
virtual ~basic_node() = default;
|
||||
// methods
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
// methods
|
||||
// legacy method, calculates changes in simulation state over specified time
|
||||
void
|
||||
update( double dt, int iter );
|
||||
update( double Deltatime, int Iterationcount );
|
||||
bool
|
||||
deserialize( std::string const &Scenariofile );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user