mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Change: replaced all <usPrisonRoomNumberXX>-tags with <usPrisonRoomNumber>, now 65535 prison rooms are supported
Requires GameDir >= r2234 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7826 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3465,8 +3465,6 @@ void CreateAssassin(UINT8 disguisetype)
|
||||
extern UINT16* gusWorldRoomInfo;
|
||||
extern SECTOR_EXT_DATA SectorExternalData[256][4];
|
||||
|
||||
static UINT8 roomcnt = 0;
|
||||
|
||||
// For now, this is only used for prison cells
|
||||
INT32 GetSittableGridNoInRoom(UINT16 usRoom, BOOLEAN fEnoughSpace)
|
||||
{
|
||||
@@ -3502,6 +3500,8 @@ INT32 GetSittableGridNoInRoom(UINT16 usRoom, BOOLEAN fEnoughSpace)
|
||||
return NOWHERE;
|
||||
}
|
||||
|
||||
static UINT16 roomcnt = 0;
|
||||
|
||||
void CreatePrisonerOfWar()
|
||||
{
|
||||
INT32 insertiongridno = NOWHERE;
|
||||
@@ -3510,25 +3510,16 @@ void CreatePrisonerOfWar()
|
||||
UINT8 ubSectorId = SECTOR(gWorldSectorX, gWorldSectorY);
|
||||
if ( ubSectorId >= 0 && ubSectorId < 256 )
|
||||
{
|
||||
// We need to 'condense' the room numbers, as some might be empty in the xml
|
||||
UINT16 realrooms[MAX_PRISON_ROOMS];
|
||||
|
||||
UINT8 numrooms = 0;
|
||||
for(UINT8 i = 0; i < MAX_PRISON_ROOMS; ++i)
|
||||
{
|
||||
if ( SectorExternalData[ubSectorId][0].usPrisonRoomNumber[i] > 0)
|
||||
{
|
||||
realrooms[numrooms++] = SectorExternalData[ubSectorId][0].usPrisonRoomNumber[i];
|
||||
}
|
||||
}
|
||||
if ( SectorExternalData[ubSectorId][0].prisonroomvector.empty( ) )
|
||||
return;
|
||||
|
||||
++roomcnt;
|
||||
if ( roomcnt >= numrooms )
|
||||
if ( roomcnt >= SectorExternalData[ubSectorId][0].prisonroomvector.size() )
|
||||
roomcnt = 0;
|
||||
|
||||
UINT16 room = realrooms[roomcnt];
|
||||
|
||||
insertiongridno = GetSittableGridNoInRoom(room, TRUE);
|
||||
UINT16 room = SectorExternalData[ubSectorId][0].prisonroomvector[roomcnt];
|
||||
|
||||
insertiongridno = GetSittableGridNoInRoom( room, TRUE );
|
||||
|
||||
// invalid gridno? Get out of here
|
||||
if ( TileIsOutOfBounds(insertiongridno) )
|
||||
|
||||
Reference in New Issue
Block a user