From 82e51328e0cc1e1e17565420fecb05df68827f07 Mon Sep 17 00:00:00 2001
From: Dan Goodliffe <dan@randomdan.homeip.net>
Date: Tue, 9 Mar 2021 01:21:04 +0000
Subject: Split ActivityOf<> into its own file

---
 game/activities/go.h   |  2 +-
 game/activities/idle.h |  2 +-
 game/activity.h        | 10 ----------
 game/activityOf.h      | 17 +++++++++++++++++
 4 files changed, 19 insertions(+), 12 deletions(-)
 create mode 100644 game/activityOf.h

(limited to 'game')

diff --git a/game/activities/go.h b/game/activities/go.h
index 8727539..858b804 100644
--- a/game/activities/go.h
+++ b/game/activities/go.h
@@ -1,7 +1,7 @@
 #ifndef GO_H
 #define GO_H
 
-#include "../activity.h"
+#include "../activityOf.h"
 
 class Go : public Activity::Of<Go> {
 public:
diff --git a/game/activities/idle.h b/game/activities/idle.h
index 04bc6e5..902d014 100644
--- a/game/activities/idle.h
+++ b/game/activities/idle.h
@@ -1,7 +1,7 @@
 #ifndef IDLE_H
 #define IDLE_H
 
-#include "../activity.h"
+#include "../activityOf.h"
 
 class Idle : public Activity::Of<Idle> {
 public:
diff --git a/game/activity.h b/game/activity.h
index 33c36fd..f7eda21 100644
--- a/game/activity.h
+++ b/game/activity.h
@@ -25,14 +25,4 @@ public:
 	virtual void doActivity(const AC *, TickDuration) = 0;
 };
 
-template<typename T> class Activity::Of : public Activity {
-	void
-	apply(Vehicle * v, TickDuration dur) const override
-	{
-		if (auto tv = dynamic_cast<Can<T> *>(v)) {
-			tv->doActivity(static_cast<const T *>(this), dur);
-		}
-	}
-};
-
 #endif
diff --git a/game/activityOf.h b/game/activityOf.h
new file mode 100644
index 0000000..a26efd1
--- /dev/null
+++ b/game/activityOf.h
@@ -0,0 +1,17 @@
+#ifndef ACTIVITYOF_H
+#define ACTIVITYOF_H
+
+#include "activity.h"
+#include "vehicles/vehicle.h"
+
+template<typename T> class Activity::Of : public Activity {
+	void
+	apply(Vehicle * v, TickDuration dur) const override
+	{
+		if (auto tv = dynamic_cast<Can<T> *>(v)) {
+			tv->doActivity(static_cast<const T *>(this), dur);
+		}
+	}
+};
+
+#endif
-- 
cgit v1.2.3