Home » PLAYER'S HQ 1.13 » JA2 Complete Mods & Sequels » Stracciatella Project (Platform Independent JA2) » Question about current svn version
Question about current svn version[message #227167] Tue, 14 July 2009 19:23 Go to next message
DeFransen is currently offline DeFransen

 
Messages:32
Registered:July 2009
Location: Here
Hi Tron,
I compiled the svn version yesterday via Code::Blocks which worked without a problem, but whenever the first shoot is fired the game crashed. I also compiled using your makefile with the same result. Here is the end of stderr of the debug version.
>>>> SND: PLAY channel 2 sample 21 file "SOUNDS/target cursor.WAV"
>>>> SND: DEAD channel 1 file "SOUNDS/target cursor.WAV" (refcount 2)
Event Pump: Begin Fire Weapon
!!!!!!! Starting attack, attack count now 1
!!!!!!! Starting attack, bullets left 1
Deduct Points (0 at 7750) 0 0
===> E:\Sources\Ja2\src\Structure.cc:792: DeleteStructureFromWorld() FIXME
>>>> SND: DEAD channel 2 file "SOUNDS/target cursor.WAV" (refcount 1)
===> E:\Sources\Ja2\src\Structure.cc:792: DeleteStructureFromWorld() FIXME
===> E:\Sources\Ja2\src\Structure.cc:792: DeleteStructureFromWorld() FIXME
!!!!! Incrementing attacker busy count..., CODE FROM ANIMATION SHOOT (R) STAND ( 13 ) : Count now 2
Event Pump: FireWeapon
Deduct Points (0 at 7750) 11 0
>>>> SND: LOAD file "SOUNDS/WEAPONS/9mm SINGLE SHOT.WAV" format 1 channels 1 rate 44100 bits 16 to slot 22
>>>> SND: SMPL "SOUNDS/WEAPONS/9mm SINGLE SHOT.WAV" from 44100Hz to 22050Hz
>>>> SND: PLAY channel 1 sample 22 file "SOUNDS/WEAPONS/9mm SINGLE SHOT.WAV"
===> E:\Sources\Ja2\src\Structure.cc:792: DeleteStructureFromWorld() FIXME
===> E:\Sources\Ja2\src\Structure.cc:792: DeleteStructureFromWorld() FIXME
  ...
===> E:\Sources\Ja2\src\Structure.cc:792: DeleteStructureFromWorld() FIXME
>>>> SND: LOAD file "SOUNDS/WOOD IMPACT 01A.WAV" format 1 channels 1 rate 22050 bits 8 to slot 23
>>>> SND: PLAY channel 2 sample 23 file "SOUNDS/WOOD IMPACT 01A.WAV"
>>>> SND: LOAD file "SOUNDS/RICOCHET 01.WAV" format 1 channels 1 rate 11025 bits 8 to slot 24
>>>> SND: PLAY channel 3 sample 24 file "SOUNDS/RICOCHET 01.WAV"
@@@@@@@ Reducing attacker busy count..., CODE FROM ANIMATION SHOOT (R) STAND ( 13 )
!!!!!!! Ending attack, attack count now 1
===> E:\Sources\Ja2\src\Structure.cc:792: DeleteStructureFromWorld() FIXME
>>>> SND: DEAD channel 2 file "SOUNDS/WOOD IMPACT 01A.WAV" (refcount 1)
>>>> SND: DEAD channel 3 file "SOUNDS/RICOCHET 01.WAV" (refcount 1)
===> E:\Sources\Ja2\src\Structure.cc:792: DeleteStructureFromWorld() FIXME
!!!!!!! Ending bullet, bullets left 0
@@@@@@@ Freeing up attacker - miss finished animation
!!!!!!! Ending attack, attack count now 0
Handling morale event 2 for SOLDAT at X=9, Y=1, Z=0

It looked different when the enemy fired first and mentioned something about a bullet hitting twice.
Is this a bug in the code?
If not which versions of SDL and MinGW do you use for compiling?

PS: great work so far

Edit: just checked out again, same result; rev 6307

[Updated on: Tue, 14 July 2009 19:48] by Moderator

Report message to a moderator

Private 1st Class
Re: Question about current svn version[message #227220] Wed, 15 July 2009 04:46 Go to previous messageGo to next message
InHuMan is currently offline InHuMan

 
Messages:44
Registered:November 2006
Location: Czech Republic
Tron: It's probably windows specific. I couldn't reproduce it on 64bit Linux.

Report message to a moderator

Corporal
Re: Question about current svn version[message #227283] Wed, 15 July 2009 18:04 Go to previous messageGo to next message
DeFransen is currently offline DeFransen

 
Messages:32
Registered:July 2009
Location: Here
I did some further investigations and found that the error is introduced with revision 6300 when the StatKind enum is defined.

After some debugging and trying I solved it :compsmash: :
in Campaign.h remove the template for the + operator
and change the ++ operator to
static inline StatKind operator ++(StatKind& s)
{
	return s = static_cast(s + 1);
}

's' gets automaticly casted to int within the brackets; the construct is possibly not overflow secure

I dont know why the template does not work; looks correct for me, but the debugger yields a segmentation fault.

[Updated on: Thu, 16 July 2009 03:39] by Moderator

Report message to a moderator

Private 1st Class
Another (win-specific?) bugfix[message #228035] Mon, 20 July 2009 09:54 Go to previous messageGo to next message
DeFransen is currently offline DeFransen

 
Messages:32
Registered:July 2009
Location: Here
in Tile_Cache.cc, function GetRootName:
ReplacePath(pDestStr, (size_t)-1, "", pSrcStr, "");

(size_t)-1 gets -1 (at least on my platform), this makes the tilecache inaccessable causing corpses not to show up in the game

changed to:
ReplacePath(pDestStr, MAX_PATH, "", pSrcStr, "");



I also removed the snprintf hack in SGPStrings for win platform, since its operational in current MinGW releases

[Updated on: Mon, 20 July 2009 09:58] by Moderator

Report message to a moderator

Private 1st Class
Re: Another (win-specific?) bugfix[message #228044] Mon, 20 July 2009 11:52 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
The former problem has already been solved in r6318.

DeFransen
(size_t)-1 gets -1 (at least on my platform)

size_t is an unsigned type. (ISO/IEC 9899:1999 (E) 7.17:2)

Quote:
I also removed the snprintf hack in SGPStrings for win platform, since its operational in current MinGW releases


from http://msdn.microsoft.com/en-us/library/2ts7cx93(VS.71).aspx:
Quote:
Security Note [...] This function does not guarantee NULL termination, so ensure it is followed by sz[ ARRAYSIZE(sz) - 1] = 0. [...]

I.e. snprintf() of Window's libc is not standard compliant.

Report message to a moderator

Sergeant 1st Class
Re: Another (win-specific?) bugfix[message #228049] Mon, 20 July 2009 12:08 Go to previous messageGo to next message
DeFransen is currently offline DeFransen

 
Messages:32
Registered:July 2009
Location: Here
Quote:
size_t is an unsigned type. (ISO/IEC 9899:1999 (E) 7.17:2)

I know that it should be, but it isn't on windows or is maybe casted to a signed type.
Quote:
from http://msdn.microsoft.com/en-us/library/2ts7cx93(VS.71).aspx:
Quote:
Security Note [...] This function does not guarantee NULL termination, so ensure it is followed by sz[ ARRAYSIZE(sz) - 1] = 0. [...]

I.e. snprintf() of Window's libc is not standard compliant.

MinGW doesn't directly map to windows libc for that function, its defined in MinGWs stdio.h and implemented in libmingwex

I just found another win issue: On windows folders doesnt get created automaticly when a new file is created with pathname prefix e.g. 'maps/jatileS34.dat', this is causing the editor to crash if the tileset is changed and the maps folder in local dir hasn't been created manually before. This is not realy a code bug, but easily fixed with a tweak in the FileOpen function.

[Updated on: Mon, 20 July 2009 12:11] by Moderator

Report message to a moderator

Private 1st Class
Re: Another (win-specific?) bugfix[message #228056] Mon, 20 July 2009 12:24 Go to previous messageGo to next message
Tron

 
Messages:225
Registered:August 2007
Location: Germany
DeFransen
Quote:
size_t is an unsigned type. (ISO/IEC 9899:1999 (E) 7.17:2)

I know that it should be, but it isn't on windows or is maybe casted to a signed type.

On Windows size_t is also an unsigned type. To solve this issue properly, I added a parameter for the size of the destination buffer to GetRootName() in r6373.

Quote:
Quote:
from http://msdn.microsoft.com/en-us/library/2ts7cx93(VS.71).aspx:
Quote:
Security Note [...] This function does not guarantee NULL termination, so ensure it is followed by sz[ ARRAYSIZE(sz) - 1] = 0. [...]

I.e. snprintf() of Window's libc is not standard compliant.

MinGW doesn't directly map to windows libc for that function, its defined in MinGWs stdio.h and implemented in libmingwex

AFAICT MinGW does not implement _snprintf().

Quote:
I just found another win issue: On windows folders doesnt get created automaticly when a new file is created with pathname prefix e.g. 'maps/jatileS34.dat', this is causing the editor to crash if the tileset is changed and the maps folder in local dir hasn't been created manually before. This is not realy a code bug, but easily fixed with a tweak in the FileOpen function.

No system, which I am aware of, automatically creates missing directories. This is no desired behaviour for FileOpen().

Report message to a moderator

Sergeant 1st Class
Re: Another (win-specific?) bugfix[message #228058] Mon, 20 July 2009 12:46 Go to previous message
DeFransen is currently offline DeFransen

 
Messages:32
Registered:July 2009
Location: Here
1. confirmed, works now

2. It does not implement _snprintf but snprintf
See: MinGW-runtime-3.15 changelog

3.Quote:
This is no desired behaviour for FileOpen()
Allright

offtopic: You play armagetron? .. and dare to challenge me? :redracer:

[Updated on: Mon, 20 July 2009 15:05] by Moderator

Report message to a moderator

Private 1st Class
Previous Topic: Stracciatella on a cell phone
Next Topic: Using Eclipse: Any advice?
Goto Forum:
  


Current Time: Sat Apr 20 01:38:09 GMT+3 2024

Total time taken to generate the page: 0.01092 seconds