Pac-Man Evolution
Loading...
Searching...
No Matches
BrainsFactory.h
1/*----------------------------------------------------------------------
2Pac-Man Evolution - Roberto Prieto
3Copyright (C) 2018-2024 MegaStorm Systems
4contact@megastormsystems.com - http://www.megastormsystems.com
5
6This software is provided 'as-is', without any express or implied
7warranty. In no event will the authors be held liable for any damages
8arising from the use of this software.
9
10Permission is granted to anyone to use this software for any purpose,
11including commercial applications, and to alter it and redistribute it
12freely, subject to the following restrictions:
13
141. The origin of this software must not be misrepresented; you must not
15claim that you wrote the original software. If you use this software
16in a product, an acknowledgment in the product documentation would be
17appreciated but is not required.
182. Altered source versions must be plainly marked as such, and must not be
19misrepresented as being the original software.
203. This notice may not be removed or altered from any source distribution.
21
22------------------------------------------------------------------------
23
24Brains Factory class
25
26------------------------------------------------------------------------ */
27
28#ifndef OBJECTSBRAINSFACTORYPME_H
29#define OBJECTSBRAINSFACTORYPME_H
30
31#define PME_BRAIN_HIGHLEVEL_TARGET 1
32#define PME_BRAIN_IMMEDIATE_TARGET 2
33#define PME_BRAIN_TYPE_DISABLED
34#define PME_BRAIN_TYPE_RANDOM 512
35#define PME_BRAIN_TYPE_FIXED 1024
36#define PME_BRAIN_TYPE_EVOLVED 2048
37#define PME_BRAIN_TYPE_HUMAN 4096
38#define PME_BRAIN_TYPE_TRAINING0 0x2000 // Bit 14(8192) upwards set the training id
39#define PME_BRAIN_TYPE_TRAINING1 0x4000
40#define PME_BRAIN_TYPE_TRAINING2 0x8000
41#define PME_BRAIN_TYPE_TRAINING3 0x10000
42#define PME_BRAIN_TYPE_TRAINING4 0x20000
43#define PME_BRAIN_TYPE_TRAINING5 0x40000
44#define PME_BRAIN_TYPE_TRAINING6 0x80000
45#define PME_BRAIN_TYPE_TRAINING7 0x100000
46#define PME_BRAIN_TYPE_TRAINING8 0x200000
47#define PME_BRAIN_TYPE_TRAINING9 0x400000
48#define PME_BRAIN_TYPE_TRAINING10 0x800000
49#define PME_BRAIN_TYPE_TRAINING11 0x1000000
50#define PME_BRAIN_TYPE_TRAINING12 0x2000000
51#define PME_BRAIN_TYPE_TRAINING13 0x4000000
52#define PME_BRAIN_TYPE_TRAINING14 0x8000000
53
54// Includes and forward definitions
55#include "MemoryManager.h"
56class Actor;
57class Brain;
58class EVNTrainer;
59class GameField;
60
61// Brain Factory class implemented as a singleton
62class BrainsFactory : public CMemPME
63{
64public:
65 static BrainsFactory& Instance(); // Singleton accessor by object reference
66 static void Terminate(); // Explicit singleton destruction
67
68 Sint32 think(Actor*, Sint32, Sint32&, Sint32&, GameField*);
69 bool validate(Sint32);
70 Sint32 getName(Sint32, string&);
71 Sint32 getTargetType(Sint32);
72 Brain* getBrain(Sint32);
73
74private:
75 explicit BrainsFactory(); // Heap-based and stack-based creation are forbidden.
76 ~BrainsFactory(); // Inheritance is also forbidden.
77 static BrainsFactory* mInstance;
78
79 unordered_map<Sint32, Brain*> mapBrains;
80};
81#endif