NL3D::CZoneLoadingTask Class Reference

#include <zone_manager.h>

Inheritance diagram for NL3D::CZoneLoadingTask:

NLMISC::IRunnablePos NLMISC::IRunnable

Detailed Description

CZoneLoadingTask implement run methode for loading a zone for TaskManager
Author:
Alain Saffray

Nevrax France

Date:
2000 sa See Also, CZoneManager, CTaskManager

Definition at line 161 of file zone_manager.h.

Public Member Functions

 CZoneLoadingTask (const std::string &sZoneName, TVolatileZonePtr *ppZone, CVector &pos, bool monochrome, float factor)
 Constructor.

void getName (std::string &result) const
void run (void)
 Runnable Task.


Data Fields

NLMISC::CVector Position

Private Attributes

bool _Monochrome
float _TileColorFactor
TVolatileZonePtr_Zone
std::string _ZoneName


Constructor & Destructor Documentation

NL3D::CZoneLoadingTask::CZoneLoadingTask const std::string &  sZoneName,
TVolatileZonePtr ppZone,
CVector pos,
bool  monochrome,
float  factor
 

Constructor.

Definition at line 233 of file zone_manager.cpp.

References _Monochrome, _TileColorFactor, _Zone, _ZoneName, and NL3D::TVolatileZonePtr.

00234 {
00235         *ppZone = NULL;
00236         _Zone = ppZone;
00237         _ZoneName = sZoneName;
00238         Position = pos;
00239         _Monochrome = monochrome;
00240         _TileColorFactor = max(0.0f, factor);
00241 }


Member Function Documentation

void NL3D::CZoneLoadingTask::getName std::string &  result  )  const [virtual]
 

Reimplemented from NLMISC::IRunnable.

Definition at line 271 of file zone_manager.cpp.

References _ZoneName.

00272 {
00273         result = "LoadZone(" + _ZoneName + ")";
00274 }

void NL3D::CZoneLoadingTask::run void   )  [virtual]
 

Runnable Task.

Implements NLMISC::IRunnable.

Definition at line 244 of file zone_manager.cpp.

References _Monochrome, _TileColorFactor, _Zone, _ZoneName, file, nldebug, NL3D::CZone::serial(), and NL3D::CZone::setTileColor().

00245 {
00246         // Lookup the zone
00247         string zonePathLookup = CPath::lookup (_ZoneName, false, false, true);
00248         if (zonePathLookup == "")
00249                 zonePathLookup = _ZoneName;
00250 
00251         CZone *ZoneTmp = new CZone;
00252         CIFile file;
00253         if(file.open(zonePathLookup))
00254         {
00255                 ZoneTmp->serial(file);
00256                 file.close();
00257                 ZoneTmp->setTileColor(_Monochrome, _TileColorFactor);
00258                 *_Zone = ZoneTmp;
00259         }
00260         else
00261         {
00262                 nldebug("CZoneLoadingTask::run(): File not found: %s", zonePathLookup.c_str ());
00263                 delete ZoneTmp;
00264                 *_Zone = (CZone*)-1; // Return error
00265         }
00266         delete this;
00267 }


Field Documentation

bool NL3D::CZoneLoadingTask::_Monochrome [private]
 

Definition at line 175 of file zone_manager.h.

Referenced by CZoneLoadingTask(), and run().

float NL3D::CZoneLoadingTask::_TileColorFactor [private]
 

Definition at line 176 of file zone_manager.h.

Referenced by CZoneLoadingTask(), and run().

TVolatileZonePtr* NL3D::CZoneLoadingTask::_Zone [private]
 

Definition at line 173 of file zone_manager.h.

Referenced by CZoneLoadingTask(), and run().

std::string NL3D::CZoneLoadingTask::_ZoneName [private]
 

Definition at line 174 of file zone_manager.h.

Referenced by CZoneLoadingTask(), getName(), and run().

NLMISC::CVector NLMISC::IRunnablePos::Position [inherited]
 

Definition at line 46 of file task_manager.h.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 08:35:59 2004 for NeL by doxygen 1.3.6