Author Topic: Access violation drawtext  (Read 998 times)

0 Members and 1 Guest are viewing this topic.

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Access violation drawtext
« on: May 31, 2007, 07:55:43 am »
I'm having some serious problems with the drawtext and I have reasons to believe that there is a bug either in the server code or in soldat itself. I'm getting really bad access violations (different addresses) every now and then to the point where I can not even play certain modes on my own scripts anymore. I'm 100% sure there is no weird bug in my script displaying out of range characters or unallowed colors or shit like that and the bug stops when I disable all the calls to drawtext.

Initially I thought I might be borking some stack or something because I drawtext quite a lot, and I sometimes don't give them time to fade out but I've worked on it, and made sure each line fades out and it STILL happens. Worst part is that it's not really very consistent behaviour. I can't really make it go on demand, yet it happens quite often.

I have server version 2.6.0 and soldat version 1.4.0.
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline Clawbug

  • Veteran
  • *****
  • Posts: 1393
  • 1184!
Re: Access violation drawtext
« Reply #1 on: May 31, 2007, 07:59:19 am »
Can you show us a little bit of the scripts, especially stuff around the drawtext's?
Fight! Win! Prevail!

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Access violation drawtext
« Reply #2 on: May 31, 2007, 08:06:22 am »
ok

For instance this bit:
Code: [Select]
// Stroke of luck
if ( Ticks mod 9000 = 0 ) or ( manualstroke = 1 ) then
begin
manualstroke := 0;
lastval := 1000;
UpdateActivePlayerList( );
// get player with the lowest score
for a := 1 to numplayers do
begin
if ( GetPlayerStat( activeplayerlist[ a ], 'Kills' ) < lastval ) then
begin
lastID := activeplayerlist[ a ];
lastval := GetPlayerStat( lastID, 'Kills' );
end;
end;
// give a vest to the biggest loser!
WriteLn('Stroke of luck! Vest given to: '+IDToName( lastID ) );
WriteConsole(0, 'Stroke of luck for player ' + IDToName( lastID ), $FF1E90FF);
DrawText(lastID, 'Stroke of luck! Free bulletproof vest.',400, RGB(255,255,254), 0.9, 20, 370 );
SpawnObject(GetPlayerStat(lastID,'x'),GetPlayerStat(lastID,'y'),19);
end;

When I'm the one getting the vest there's a risk of getting an access violation. Getting rid of all the drawtexts just gets rid of the access violations instantly, so it must have something to do with that. Activeplayerlist[ a ] contains all the player ID's btw. The array has been declared statically, and I tried oversizing it to be on the safe side.

Also I'm not 100% sure about this, but the problem doesn't seem to occur when the text written is bright red (255,255,0).

The whole script is well over a thousand lines so I won't post that up :p

Oh also note, that it's not the server throwing the error actually. It's soldat.exe!
« Last Edit: May 31, 2007, 08:09:48 am by sai`ke »
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 703
Re: Access violation drawtext
« Reply #3 on: May 31, 2007, 01:01:22 pm »
Are you running soldat in 32bits or 16bits?
I really doubt this could cause the problem, but the color sent from the server is 32bits i think.
urraka

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Access violation drawtext
« Reply #4 on: May 31, 2007, 06:32:45 pm »
32, I think...

I reinstalled soldat. Then it said my directx wasn't new enough and there appeared to be one driver file that was outdated. After running an update, all the fonts had suddenly changed in soldat, so maybe this fixes the problem....

I will try tonight!

Date Posted: May 31, 2007, 03:30:36 PM
yes, it's fixed.

Thanks for the help though, I appreciate it.  :)
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com