Skip to content

Commit

Permalink
Merge pull request #54 from ivan-ushakov/bad-cast-exception-with-cate…
Browse files Browse the repository at this point in the history
…rpillar

bad_cast exception when use caterpillars
  • Loading branch information
ivan-ushakov authored Sep 26, 2023
2 parents b509d93 + 43f479d commit 80069ec
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion MechoSoma/Xreal/Bubble.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma warning( disable : 4250 )

class Bubble : virtual public Body, public GrowingBody, public OwnerProtection, ArcaneStatisticsService
class Bubble : public GrowingBody, public OwnerProtection, ArcaneStatisticsService
{
ShareHandle<BubbleFieldSource> attractor;
Vect3f F_wind;
Expand Down
2 changes: 1 addition & 1 deletion MechoSoma/Xreal/LittleSpider.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "HydrophobicObject.h"
#pragma warning( disable : 4250 )

class LittleSpider : public CrawlingObject, public OwnerProtection, ArcaneStatisticsService, HydrophobicObject
class LittleSpider : public CrawlingObject, public OwnerProtection, ArcaneStatisticsService, public HydrophobicObject
{
DurationTimer target_timer;
DurationTimer time_to_live;
Expand Down
39 changes: 17 additions & 22 deletions MechoSoma/Xreal/OwnerProtection.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
// Author: @caiiiycuk
#ifndef OWNER_PROTECTION
#define OWNER_PROTECTION
//////////////////////////////////////////////////////////////////
// База для создания арканных объектов
// - защита хозяина
//////////////////////////////////////////////////////////////////
#ifndef __OwnerProtection_H__
#define __OwnerProtection_H__

class OwnerProtection {
class OwnerProtection
{
enum { default_duration = 2000 };
int owner_ID;
DurationTimer duration_;
public:
int ID;
int time;
OwnerProtection(int ID): ID(ID) {}
OwnerProtection(): ID(0) {}
int owner() const {
return ID;
}
void reset_owner() {
ID = 0;
}
void set_owner(int ID, int time) {
this->ID = ID;
this->time = time;
}
int duration() {
return time;
}
OwnerProtection(int ID = 0) { owner_ID = ID; duration_.start(default_duration); }
virtual void set_owner(int ID, int duration__ = default_duration) { owner_ID = ID; duration_.start(duration__); }
void reset_owner() { owner_ID = 0; }
int owner() const { return duration_() ? owner_ID : 0; }
time_type duration(){ return duration_(); };
};

#endif
#endif //__OwnerProtection_H__
2 changes: 1 addition & 1 deletion MechoSoma/Xreal/TitaniumBall.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#pragma warning( disable : 4250 )

class TitaniumBall : virtual public Body, GrowingBody, public OwnerProtection, ArcaneStatisticsService
class TitaniumBall : public GrowingBody, public OwnerProtection, ArcaneStatisticsService
{
public:
TitaniumBall(const Vect3f& R_, const Vect3f& V_, float damage__, int owner_ID);
Expand Down
2 changes: 1 addition & 1 deletion MechoSoma/Xreal/Tomato.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#pragma warning( disable : 4250 )

class Tomato : virtual public Body, GrowingBody, public OwnerProtection, ArcaneStatisticsService
class Tomato : public GrowingBody, public OwnerProtection, ArcaneStatisticsService
{
Vect3f R0;
public:
Expand Down
2 changes: 1 addition & 1 deletion MechoSoma/Xreal/Worm.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Worm : public CrawlingObject
void body_overlap_reaction(Body& body);
};

class Caterpillar : public CrawlingObject, public OwnerProtection, ArcaneStatisticsService, HydrophobicObject
class Caterpillar : public CrawlingObject, public OwnerProtection, ArcaneStatisticsService, public HydrophobicObject
{
DurationTimer rudder_latency;
DurationTimer time_to_live;
Expand Down

0 comments on commit 80069ec

Please sign in to comment.