2014-10-14 13:11:37 +00:00
|
|
|
|
/*
|
|
|
|
|
* This file is part of the Colobot: Gold Edition source code
|
|
|
|
|
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
|
|
|
|
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see http://gnu.org/licenses
|
|
|
|
|
*/
|
2013-03-31 08:21:22 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2013-05-02 08:44:07 +00:00
|
|
|
|
* \file object/objman.h
|
2013-03-31 08:21:22 +00:00
|
|
|
|
* \brief Instance manager for objects
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "object/object.h"
|
|
|
|
|
|
|
|
|
|
#include "common/singleton.h"
|
|
|
|
|
|
|
|
|
|
const int MAX_OBJECTS = 500;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \class ObjectManager
|
|
|
|
|
* \brief Manager for objects
|
|
|
|
|
*/
|
|
|
|
|
class CObjectManager : public CSingleton<CObjectManager>
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CObjectManager();
|
|
|
|
|
virtual ~CObjectManager();
|
|
|
|
|
|
|
|
|
|
//! Registers new object
|
|
|
|
|
bool AddInstance(CObject* instance);
|
|
|
|
|
//! Deletes the registered object
|
|
|
|
|
bool DeleteInstance(CObject* instance);
|
|
|
|
|
//! Seeks for an object
|
|
|
|
|
CObject* SearchInstance(int id);
|
|
|
|
|
//! Creates an object
|
2013-12-29 11:08:59 +00:00
|
|
|
|
CObject* CreateObject(Math::Vector pos, float angle, ObjectType type, float power = -1.f, float zoom = 1.f, float height = 0.f, bool trainer = false, bool toy = false, int option = 0);
|
2013-12-30 09:51:29 +00:00
|
|
|
|
//! Removes all objects
|
|
|
|
|
void Flush();
|
2013-03-31 08:21:22 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
CObject* m_table[MAX_OBJECTS];
|
2013-12-30 09:51:29 +00:00
|
|
|
|
int m_usedCount;
|
2013-03-31 08:21:22 +00:00
|
|
|
|
};
|
|
|
|
|
|