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:
Flugente
2015-04-21 20:34:06 +00:00
parent cc7d52c901
commit b8d8e9b4a8
3 changed files with 34 additions and 121 deletions
+8 -17
View File
@@ -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) )