
/*
 * Copyright 2011-2022 Cuberite Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

// fwd:
class cBroadcastInterface;
class cChunkInterface;
class cForEachChunkProvider;
class cWorld;
class cWorldInterface;

/** Utilities to allow casting a cWorld to one of its interfaces without including World.h. */
namespace World
{
	// Defined in World.cpp
	cBroadcastInterface *   GetBroadcastInterface(cWorld * a_World);
	cForEachChunkProvider * GetFECProvider       (cWorld * a_World);
	cWorldInterface *       GetWorldInterface    (cWorld * a_World);

	inline cBroadcastInterface &   GetBroadcastInterface(cWorld & a_World) { return *GetBroadcastInterface(&a_World); }
	inline cForEachChunkProvider & GetFECProvider       (cWorld & a_World) { return *GetFECProvider(&a_World); }
	inline cWorldInterface &       GetWorldInterface    (cWorld & a_World) { return *GetWorldInterface(&a_World); }

	// cChunkInterface is more like a pimpl for cChunkMap than an interface so it needs to be returned by value
	cChunkInterface GetChunkInterface(cWorld & a_World);
}
