## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iPcZoneManager Struct Reference

This is the zone manager. More...

`#include <propclass/zone.h>`

List of all members.

## Public Member Functions

virtual bool | ActivateRegion (iCelRegion *region, bool allow_entity_addon=true)=0
| Activate some region.
virtual iCelRegion * | CreateRegion (const char *name)=0
| Create a region.
virtual iCelZone * | CreateZone (const char *name)=0
| Create a zone.
virtual void | EnableColliderWrappers (bool en)=0
| By default the zone manager will create collider wrappers (csColliderWrapper) for all objects that are loaded.
virtual iCelRegion * | FindRegion (const char *name) const =0
| Get the specified region.
virtual void | FindStartLocations (iStringArray *regionnames, iStringArray *startnames)=0
| Find all valid starting locations in all current loaded regions.
virtual iCelZone * | FindZone (const char *name) const =0
| Get the specified zone.
virtual void | GetLastStartLocation (iString *regionname, iString *startname)=0
| Return the last used region and startname for PointCamera() or PointMesh().
virtual const char * | GetLastStartName ()=0
| Return the last used startname name for PointCamera() or PointMesh().
virtual const char * | GetLastStartRegionName ()=0
| Return the last used region name for PointCamera() or PointMesh().
virtual int | GetLoadingMode () const =0
| Get the current loading mode.
virtual iCelRegion * | GetRegion (int idx) const =0
| Get the specified region.
virtual size_t | GetRegionCount () const =0
| Get the count of regions.
virtual iCelZone * | GetZone (int idx) const =0
| Get the specified zone.
virtual size_t | GetZoneCount () const =0
| Get the count of zones.
virtual bool | IsColliderWrappers () const =0
| Is collider wrapper creation enabled?
virtual bool | Load (const char *path, const char *file)=0
| Load a zone definition from an XML file.
virtual bool | Load (iDocumentNode *node)=0
| Load a zone definition from an XML node.
virtual int | PointCamera (const char *entity, const char *regionname, const char *startname=0)=0
| Take the specified region (by name), load all zones associated with that region and then setup the given pccamera so that it points to the specified starting posision in this region.
virtual int | PointMesh (const char *entity, const char *regionname, const char *startname=0)=0
| Take the specified region (by name), load all zones associated with that region and then place the given pcmesh so that it is positioned at the specified starting posision in this region.
virtual void | RemoveAllRegions ()=0
| Remove all regions from this zone.
virtual void | RemoveAllZones ()=0
| Remove all zones.
virtual bool | RemoveRegion (iCelRegion *region)=0
| Delete the given region.
virtual bool | RemoveZone (iCelZone *zone)=0
| Delete the given zone.
virtual void | SetLoadingMode (int mode)=0

Set different loading mode:

- CEL_ZONE_NORMAL: load/unload regions as needed (default).

## Detailed Description

This is the zone manager.

In this property class you can define zones. A zone is a collection of regions that are either all together in memory or not at all. A region is made from a set of maps and represents the actual geometry that is in memory. A region is loaded or unloaded as one unit. A region can be in multiple zones. In that case if you are in some region then all zones that contain that region will be in memory, The representation of a region.

This property class supports the following actions (add prefix 'cel.action.' to get the ID of the action and add prefix 'cel.parameter.' to get the ID of the parameter):

- DisableCD: no parameters. Don't create collider wrappers.
- EnableCD: no parameters. Create collider wrappers (default).
- Load: parameters 'path' (string), and 'file' (string).
- PointMesh: parameters 'entity' (string), 'region' (string), and 'start' (string).
- PointCamera: parameters 'entity' (string), 'region' (string), and 'start' (string).

This property class can send out the following messages to the behaviour (add prefix 'cel.parameter.' to get the ID for parameters):

- pczonemanager_addregion: new region has been added (region)
- pczonemanager_remregion: region will be removed (region)
- pczonemanager_startloading: loading of regions starts
- pczonemanager_stoploading: loading of regions stops
- pczonemanager_errorloading: loading of regions stops with error (region)

Definition at line 255 of file zone.h.

## Member Function Documentation

virtual bool iPcZoneManager::ActivateRegion | ( | iCelRegion * | region,
|  | bool | allow_entity_addon = `true`
| ) | `[pure virtual]`

| Activate some region. This will load all zones that contain the given region and unload all other zones. It is safe to call this too many times as it will check if a region or zone is already loaded or not and avoid doing unneeded work.

virtual iCelRegion* iPcZoneManager::CreateRegion | ( | const char * | name | ) | `[pure virtual]`

| Create a region.

virtual iCelZone* iPcZoneManager::CreateZone | ( | const char * | name | ) | `[pure virtual]`

| Create a zone.

virtual void iPcZoneManager::EnableColliderWrappers | ( | bool | en | ) | `[pure virtual]`

| By default the zone manager will create collider wrappers (csColliderWrapper) for all objects that are loaded. If you don't want that behaviour you can disable it here.

virtual iCelRegion* iPcZoneManager::FindRegion | ( | const char * | name | ) | const`[pure virtual]`

| Get the specified region.

virtual void iPcZoneManager::FindStartLocations | ( | iStringArray * | regionnames,
|  | iStringArray * | startnames
| ) | `[pure virtual]`

| Find all valid starting locations in all current loaded regions.

virtual iCelZone* iPcZoneManager::FindZone | ( | const char * | name | ) | const`[pure virtual]`

| Get the specified zone.

virtual void iPcZoneManager::GetLastStartLocation | ( | iString * | regionname,
|  | iString * | startname
| ) | `[pure virtual]`

| Return the last used region and startname for PointCamera() or PointMesh(). Returns an empty region name if those functions have not been called yet.

virtual const char* iPcZoneManager::GetLastStartName | ( |  | ) | `[pure virtual]`

| Return the last used startname name for PointCamera() or PointMesh().

virtual const char* iPcZoneManager::GetLastStartRegionName | ( |  | ) | `[pure virtual]`

| Return the last used region name for PointCamera() or PointMesh(). Returns an empty region name if those functions have not been called yet.

virtual int iPcZoneManager::GetLoadingMode | ( |  | ) | const`[pure virtual]`

| Get the current loading mode.

virtual iCelRegion* iPcZoneManager::GetRegion | ( | int | idx | ) | const`[pure virtual]`

| Get the specified region.

virtual size_t iPcZoneManager::GetRegionCount | ( |  | ) | const`[pure virtual]`

| Get the count of regions.

virtual iCelZone* iPcZoneManager::GetZone | ( | int | idx | ) | const`[pure virtual]`

| Get the specified zone.

virtual size_t iPcZoneManager::GetZoneCount | ( |  | ) | const`[pure virtual]`

| Get the count of zones.

virtual bool iPcZoneManager::IsColliderWrappers | ( |  | ) | const`[pure virtual]`

| Is collider wrapper creation enabled?

virtual bool iPcZoneManager::Load | ( | const char * | path,
|  | const char * | file
| ) | `[pure virtual]`

Load a zone definition from an XML file.

The XML file should contain a 'level' or 'world' node. In case it is a 'world' file then the zone manager will automatically create a region called 'main' and a zone called 'main' with a default start location. This is a convenience.

Parameters:

  | path | is a VFS path. Current VFS dir will be set to that path. Can be 0 if no path is desired.
  | file | is a VFS file.

Returns:
  true on success. On failure the error will be reported to the reporter and false will be returned.

virtual bool iPcZoneManager::Load | ( | iDocumentNode * | node | ) | `[pure virtual]`

Load a zone definition from an XML node.

Parameters:

  | node | is the node containing region and zone definitions.

Returns:
  true on success. On failure the error will be reported to the reporter and false will be returned.

virtual int iPcZoneManager::PointCamera | ( | const char * | entity,
|  | const char * | regionname,
|  | const char * | startname = `0`
| ) | `[pure virtual]`

Take the specified region (by name), load all zones associated with that region and then setup the given pccamera so that it points to the specified starting posision in this region.

If 0 is given then the default position will be used. Returns one of:

- CEL_ZONEERROR_OK: no error
- CEL_ZONEERROR_BADREGION: can't find region
- CEL_ZONEERROR_BADSTART: can't find start
- CEL_ZONEERROR_LOAD: error loading zone

Parameters:

  | entity | is the name of the entity that contains the pccamera property class.
  | regionname | the name of the region to load.
  | startname | the name of the starting position.

virtual int iPcZoneManager::PointMesh | ( | const char * | entity,
|  | const char * | regionname,
|  | const char * | startname = `0`
| ) | `[pure virtual]`

Take the specified region (by name), load all zones associated with that region and then place the given pcmesh so that it is positioned at the specified starting posision in this region.

If 0 is given then the default position will be used. Returns one of:

- CEL_ZONEERROR_OK: no error
- CEL_ZONEERROR_BADREGION: can't find region
- CEL_ZONEERROR_BADSTART: can't find start
- CEL_ZONEERROR_LOAD: error loading zone

Parameters:

  | entity | is the name of the entity that contains the pcmesh property class.
  | regionname | the name of the region to load.
  | startname | the name of the starting position.

virtual void iPcZoneManager::RemoveAllRegions | ( |  | ) | `[pure virtual]`

| Remove all regions from this zone.

virtual void iPcZoneManager::RemoveAllZones | ( |  | ) | `[pure virtual]`

| Remove all zones.

virtual bool iPcZoneManager::RemoveRegion | ( | iCelRegion * | region | ) | `[pure virtual]`

| Delete the given region. Returns false if the region could not be found in this zone.

virtual bool iPcZoneManager::RemoveZone | ( | iCelZone * | zone | ) | `[pure virtual]`

| Delete the given zone. Returns false if the zone could not be found.

virtual void iPcZoneManager::SetLoadingMode | ( | int | mode | ) | `[pure virtual]`

Set different loading mode:

- CEL_ZONE_NORMAL: load/unload regions as needed (default).

- CEL_ZONE_KEEP: load regions as needed but keep them in memory.
- CEL_ZONE_LOADALL: load all regions immediatelly. Setting CEL_ZONE_LOADALL will immediatelly cause all regions to be loaded.

The documentation for this struct was generated from the following file:

- propclass/zone.h