void LoadPTData(int loadTeam)
{
INIClass *PTini = Get_INI("./PT_Data.ini");
const int team = PTTEAM(loadTeam);
char section[16];
char presetIDEntry[16];
unsigned int type = CHARACTERS;
unsigned int cost = 0;
unsigned int presetID = 0;
unsigned int stringID = 0;
char texture[32];
if(!PTini)
{
Console_Output("PT data file could not be found. PT's unchanged!\n");
return;
}
Console_Output("Team: %d\nPTTeam: %d\nType: %d\n", loadTeam, team, type);
sprintf(presetIDEntry, "Team%d_PresetID", loadTeam);
for(int i = 0; i < 10; i++)
{
sprintf(section, "Char%d", i);
cost = PTini->Get_Int(section, "Cost", 0);
presetID = PTini->Get_Int(section, presetIDEntry, 0);
stringID = PTini->Get_Int(section, "StringID", 0);
PTini->Get_String(section, "Texture", "", texture, 32);
Console_Output("Section: %s\nCost: %d\nPresetID: %d\nStringID: %d\nTexture: %s\n", section, cost, presetID, stringID, texture);
Set_Preset(team, type, i, cost, presetID, stringID, texture);
for(int j = 0; j < 3; j++)
{
sprintf(section, "CharAlt%d%d", i, j);
presetID = PTini->Get_Int(section, presetIDEntry, 0);
PTini->Get_String(section, "Texture", "", texture, 32);
Console_Output("AltSection: %s\nAltPresetID: %d\nAltTexture: %s\n", section, presetID, texture);
Set_Alternate(team, type, i, j, presetID, texture);
}
}
type = VEHICLES;
for(int i = 0; i < 10; i++)
{
sprintf(section, "Veh%d", i);
cost = PTini->Get_Int(section, "Cost", 0);
presetID = PTini->Get_Int(section, presetIDEntry, 0);
stringID = PTini->Get_Int(section, "StringID", 0);
PTini->Get_String(section, "Texture", "", texture, 32);
Console_Output("Section: %s\nCost: %d\nPresetID: %d\nStringID: %d\nTexture: %s\n", section, cost, presetID, stringID, texture);
Set_Preset(team, type, i, cost, presetID, stringID, texture);
for(int j = 0; j < 3; j++)
{
sprintf(section, "VehAlt%d%d", i, j);
presetID = PTini->Get_Int(section, presetIDEntry, 0);
PTini->Get_String(section, "Texture", "", texture, 32);
Console_Output("AltSection: %s\nAltPresetID: %d\nAltTexture: %s\n", section, presetID, texture);
Set_Alternate(team, type, i, j, presetID, texture);
}
}
Update_PT_Data(); //Client crashes here
}