Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Update_PT_Data
Update_PT_Data [message #434635] Thu, 12 August 2010 03:45 Go to next message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma: 0
General (1 Star)
I'm using the following function to set the data for the PT's

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
}

The server/FDS doesnt crash but the client does. Joining after the PT's have changed makes the client crash aswell.
I hope someone knows the problem and it's solution???


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[Updated on: Thu, 12 August 2010 03:53]

Report message to a moderator

Re: Update_PT_Data [message #434671 is a reply to message #434635] Thu, 12 August 2010 16:16 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
I would suggest adding a delay before the call to Update_PT_Data using either a delayed custom or a timer to give the engine a chance to sort out changes internally caused by the rest of the code on the next engine tick. Don't know if it will help, but with the W3D engine it's always a good starting point for working out why something isn't working properly Razz

http://steamsignature.com/card/1/76561197975867233.png
Re: Update_PT_Data [message #434689 is a reply to message #434635] Fri, 13 August 2010 03:27 Go to previous messageGo to next message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma: 0
General (1 Star)
It still crashes, only now after a delay Razz

I used VC to debug on the client and when it crashes i get the following message
Game.exe has triggered a breakpoint

Then when I click break and view assembly it shows an arrow at this line
7599194B  int         3  


Callstack
->	KernelBase.dll!7599194b() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]	
 	bhs.dll!4502b327() 	
 	bhs.dll!4500a0bb() 	
 	Game.exe!0046e874() 	
 	Game.exe!0061a555() 	
 	Game.exe!00457df3() 	
 	Game.exe!00403615() 	
 	Game.exe!00437091() 	
 	Game.exe!0043b932() 	
 	Game.exe!0043ba4b() 	
 	Game.exe!0043d539() 	
 	setupapi.dll!7720f85d() 	
 	setupapi.dll!7720f89d() 	



Autos
EDI	00000000	


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[Updated on: Fri, 13 August 2010 03:32]

Report message to a moderator

Re: Update_PT_Data [message #434722 is a reply to message #434635] Fri, 13 August 2010 09:26 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

Update_PT_Data was always flaky and crap (4.0 does things differently and Update_PT_Data is gone now)


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: Update_PT_Data [message #434727 is a reply to message #434722] Fri, 13 August 2010 10:26 Go to previous messageGo to next message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma: 0
General (1 Star)
jonwil wrote on Fri, 13 August 2010 18:26

Update_PT_Data was always flaky and crap (4.0 does things differently and Update_PT_Data is gone now)


OK good but that doesn't really help me in my situation right now Razz
Unless 4.0 is released in a minute ^^ (or unless you mean it just crashes because it's flaky and crap and not my fault Rocked Over )


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[Updated on: Fri, 13 August 2010 10:28]

Report message to a moderator

Re: Update_PT_Data [message #434837 is a reply to message #434635] Mon, 16 August 2010 00:06 Go to previous message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

It crashes because its flaky and crap and never worked right.
Nothing to do with you.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Previous Topic: START_TIMER Parameters
Next Topic: Ice textures in C&C Glacier
Goto Forum:
  


Current Time: Wed Dec 18 16:02:41 MST 2024

Total time taken to generate the page: 0.00855 seconds