TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ LoadFileFormatHeader()

static bool Terraria.IO.WorldFile.LoadFileFormatHeader ( BinaryReader reader,
out bool[] importance,
out int[] positions )
inlinestatic

Definition at line 1856 of file WorldFile.cs.

1857 {
1858 importance = null;
1859 positions = null;
1860 if ((_versionNumber = reader.ReadInt32()) >= 135)
1861 {
1862 try
1863 {
1864 Main.WorldFileMetadata = FileMetadata.Read(reader, FileType.World);
1865 }
1866 catch (FormatException value)
1867 {
1868 Console.WriteLine(Language.GetTextValue("Error.UnableToLoadWorld"));
1869 Console.WriteLine(value);
1870 return false;
1871 }
1872 }
1873 else
1874 {
1875 Main.WorldFileMetadata = FileMetadata.FromCurrentSettings(FileType.World);
1876 }
1877 short num = reader.ReadInt16();
1878 positions = new int[num];
1879 for (int j = 0; j < num; j++)
1880 {
1881 positions[j] = reader.ReadInt32();
1882 }
1883 ushort num2 = reader.ReadUInt16();
1884 importance = new bool[num2];
1885 byte b = 0;
1886 byte b2 = 128;
1887 for (int i = 0; i < num2; i++)
1888 {
1889 if (b2 == 128)
1890 {
1891 b = reader.ReadByte();
1892 b2 = 1;
1893 }
1894 else
1895 {
1896 b2 <<= 1;
1897 }
1898 if ((b & b2) == b2)
1899 {
1900 importance[i] = true;
1901 }
1902 }
1903 return true;
1904 }
static int _versionNumber
Definition WorldFile.cs:120
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12
@ Console
Command can be used in server console during MP.

References Terraria.IO.WorldFile._versionNumber, Terraria.ModLoader.Console, Terraria.IO.FileMetadata.FromCurrentSettings(), Terraria.Localization.Language.GetTextValue(), and Terraria.IO.FileMetadata.Read().

Referenced by Terraria.IO.WorldFile.LoadWorld_Version2(), and Terraria.IO.WorldFile.ValidateWorld().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: