DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ RegisterParticle() [2/2]

static int ParticleList::RegisterParticle ( string root_path,
string file_name )
inlinestaticprivate

Registers a particle and returns its ID.

См. определение в файле ParticleList.c строка 418

419 {
420 if (!m_ParticlePaths)
421 m_ParticlePaths = new map<int, string>;
422
423 if (!m_ParticleNames)
424 m_ParticleNames = new map<string, int>;
425
426 string path = string.Format("%1%2", root_path, file_name);
427 string fullPath = string.Format("%1.ptc", path);
428
429 if ( !FileExist(fullPath) )
430 {
431 string devMsgSuffix;
432 #ifdef DEVELOPER
433 devMsgSuffix = " Then rebuild 'scripts' and 'graphics' PBOs.";
434 #endif
435 ErrorEx(string.Format("Particle file not found! <%1> Correct path to this particle in script file ParticleList.c!%2",
436 fullPath, devMsgSuffix), ErrorExSeverity.WARNING);
437 //return ParticleList.INVALID;
438 }
439
440 int existingNameId;
441 if (m_ParticleNames.Find(file_name, existingNameId))
442 {
443 int existingPathId;
444 if (m_ParticlePaths.GetKeyByValueChecked(path, existingPathId))
445 {
446 if (existingNameId == existingPathId)
447 {
448 return existingNameId; // We have already registered this exact file
449 }
450 else
451 {
452 ErrorEx(string.Format("ParticleNames and ParticlePaths array are containing conflicting data. ID %1 vs ID %2", existingNameId, existingPathId));
453 }
454 }
455 else
456 {
457 ErrorEx(string.Format("Duplicate particle filename: %1; GetParticleIDByName will only work with the first path if there are two different paths.", file_name), ErrorExSeverity.WARNING);
458 }
459 }
460 else
461 {
462 m_ParticleNames.Insert(file_name, m_lastID + 1);
463 }
464
465 ++m_lastID;
467 return m_lastID;
468 }
string path
Определения OptionSelectorMultistate.c:142
static int m_lastID
Определения ParticleList.c:16
static ref map< int, string > m_ParticlePaths
Определения ParticleList.c:13
static ref map< string, int > m_ParticleNames
Определения ParticleList.c:14
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
proto bool FileExist(string name)
Check existence of file.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.

Перекрестные ссылки ErrorEx, FileExist(), m_lastID, m_ParticleNames, m_ParticlePaths и path.