Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad_cast exception when use caterpillars #54

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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