view src/misc/countedobj.cpp @ 10123:57aa34285d05 draft

(svn r14307) -Fix: when deleting a station, remove news items regarding it
author smatz <smatz@openttd.org>
date Sat, 13 Sep 2008 10:19:51 +0000 (2008-09-13)
parents d48433370037
children bc7926153e19
line wrap: on
line source
/* $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;
}