src/misc/countedobj.cpp
author terom@frrb.lan
Fri, 19 Dec 2008 01:38:09 +0200
changeset 10439 50f056aa3024
parent 9111 48ce04029fe4
permissions -rw-r--r--
industries, unmoveables... everything but the landscape
/* $Id$ */

/** @file countedobj.cpp Support for reference counted objects. */

#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;
}