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

◆ GetModelName()

string CGame::GetModelName ( string class_name)
inlineprivate

Get name of the p3d file of the given class name.

Аргументы
classname of the desired object
Возвращает
Name of the object's p3d file (without the '.p3d' suffix)

См. определение в файле Global/game.c строка 489

490 {
491 if ( class_name != "" )
492 {
493 string cfg = "CfgVehicles " + class_name + " model";
494 string model_path;
495 if ( g_Game.ConfigGetText(cfg, model_path) )
496 {
497 int to_substring_end = model_path.Length() - 4; // -4 to leave out the '.p3d' suffix
498 int to_substring_start = 0;
499
500 // Currently we have model path. To get the name out of it we need to parse this string from the end and stop at the first found '\' sign
501 for (int i = to_substring_end; i > 0; i--)
502 {
503 string sign = model_path.Get(i);
504 if ( sign == "\\" )
505 {
506 to_substring_start = i + 1;
507 break
508 }
509 }
510
511 string model_name = model_path.Substring(to_substring_start, to_substring_end - to_substring_start);
512 return model_name;
513 }
514 }
515
516 return "UNKNOWN_P3D_FILE";
517 }
DayZGame g_Game
Определения DayZGame.c:4074
class OptionSelectorMultistate extends OptionSelector class_name
proto native int Length()
Returns length of string.
proto string Get(int index)
Gets n-th character from string.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.

Перекрестные ссылки class_name, g_Game, string::Get(), string::Length() и string::Substring().