Files @ r9806:1fcdbff0d7b2
Branch filter:

Location: cpp/openttd-patchpack/source/src/misc/countedobj.cpp

rubidium
(svn r13948) -Add [YAPP]: Extend NPF with a function to find a safe tile and reserve a path. (michi_cc)
/* $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;
}