Registers a particle and returns its ID.
453 {
454
457
458
459 string justName = file_name;
461 if (lastIndex >= 0)
462 justName = justName.
Substring(lastIndex + 1, justName.
Length() - (lastIndex + 1));
463
466
469
470 string path =
string.
Format(
"%1%2", root_path, file_name);
471 string fullPath =
string.
Format(
"%1.ptc",
path);
472
474 {
475 string devMsgSuffix;
476 #ifdef DEVELOPER
477 devMsgSuffix = " Then rebuild 'scripts' and 'graphics' PBOs.";
478 #endif
479 ErrorEx(
string.Format(
"Particle file not found! <%1> Correct path to this particle in script file ParticleList.c!%2",
481
482 }
483
484 int existingNameId;
486 {
487 int existingPathId;
489 {
490 if (existingNameId == existingPathId)
491 {
492 return existingNameId;
493 }
494 else
495 {
496 ErrorEx(
string.Format(
"ParticleNames and ParticlePaths array are containing conflicting data. ID %1 vs ID %2", existingNameId, existingPathId));
497 }
498 }
499 else
500 {
501 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);
502 }
503 }
504 else
505 {
507 }
508
512 }
static ref map< int, string > m_ParticlePaths
static ref map< string, int > m_ParticleNames
proto bool FileExist(string name)
Check existence of file.
proto native int Length()
Returns length of string.
proto native int LastIndexOf(string sample)
Finds last 'sample' in 'str'. Returns -1 when not found.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
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.
proto int ToLower()
Changes string to lowercase. Returns length.