src/misc/countedobj.cpp
branchNewGRF_ports
changeset 6732 ca1b466db422
child 10724 68a692eacf22
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/misc/countedobj.cpp	Sun Jul 22 21:24:42 2007 +0000
@@ -0,0 +1,21 @@
+/* $Id$ */
+
+#include "../stdafx.h"
+
+#include "countedptr.hpp"
+
+int32 SimpleCountedObject::AddRef()
+{
+	return ++m_ref_cnt;
+}
+
+int32 SimpleCountedObject::Release()
+{
+	int32 res = --m_ref_cnt;
+	assert(res >= 0);
+	if (res == 0) {
+		FinalRelease();
+		delete this;
+	}
+	return res;
+}