Mistake in cSpawnRegion.cpp

Want to discuss changes to the UOX3 source code? Got a code-snippet you'd like to post? Anything related to coding/programming goes here!
Post Reply
Grimson
Developer
Posts: 802
Joined: Sat Jun 04, 2005 1:52 am
Location: Germany
Has thanked: 0
Been thanked: 0

Mistake in cSpawnRegion.cpp

Post by Grimson »

I just looke through to cSpawnRegion.cpp to see why UOX tends to spawn one more item/npc than the maximum set in the spawns.dfn, and found the following at line 402ff:

Code: Select all

bool shouldSpawnChars = ( !sNpcs.empty() && maxcspawn >= spawnedChars.Num() );
bool shouldSpawnItems = ( !sItems.empty() && maxispawn >= spawnedItems.Num() );
This is wrong, because it will allow another spawn when the number of already spawned items/npcs is equal to the maximum setting. It should be:

Code: Select all

bool shouldSpawnChars = ( !sNpcs.empty() && maxcspawn > spawnedChars.Num() );
bool shouldSpawnItems = ( !sItems.empty() && maxispawn > spawnedItems.Num() );
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Bugfix tested and verified, so I'll upload it to the cvs. Nice work! =)
-= Ho Eyo He Hum =-
Post Reply