src/misc/countedobj.cpp
author rubidium
Fri, 05 Dec 2008 22:46:39 +0000
changeset 10407 419a41009c38
parent 9111 48ce04029fe4
permissions -rw-r--r--
(svn r14658) -Change: allow changing town names when there are no towns in the scenario yet.
/* $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;
}