summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/control/Script.cpp2
-rw-r--r--src/peds/Ped.cpp18
-rw-r--r--src/peds/Population.cpp22
3 files changed, 23 insertions, 19 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 7c563492..4aeacf3f 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -499,7 +499,7 @@ void CRunningScript::Init()
#ifdef USE_DEBUG_SCRIPT_LOADER
int open_script()
{
- static int scriptToLoad = 1;
+ static int scriptToLoad = 0;
if (GetAsyncKeyState('G') & 0x8000)
scriptToLoad = 0;
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 7fc83be3..db6b7ee2 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -2213,15 +2213,18 @@ CPed::BuildPedLists(void)
}
} else {
CVector centre = CEntity::GetBoundCentre();
- CRect rect(
- CWorld::GetSectorX(centre.x - 20.0f),
- CWorld::GetSectorY(centre.y - 20.0f),
- CWorld::GetSectorX(centre.x + 20.0f),
- CWorld::GetSectorY(centre.y + 20.0f));
+ CRect rect(centre.x - 20.0f,
+ centre.y - 20.0f,
+ centre.x + 20.0f,
+ centre.y + 20.0f);
+ int xstart = CWorld::GetSectorIndexX(rect.left);
+ int ystart = CWorld::GetSectorIndexY(rect.top);
+ int xend = CWorld::GetSectorIndexX(rect.right);
+ int yend = CWorld::GetSectorIndexY(rect.bottom);
gnNumTempPedList = 0;
- for(int y = rect.top; y <= rect.bottom; y++) {
- for(int x = rect.left; x <= rect.right; x++) {
+ for(int y = ystart; y <= yend; y++) {
+ for(int x = xstart; x <= xend; x++) {
for (CPtrNode *pedPtrNode = CWorld::GetSector(x,y)->m_lists[ENTITYLIST_PEDS].first; pedPtrNode; pedPtrNode = pedPtrNode->next) {
CPed *ped = (CPed*)pedPtrNode->item;
if (ped != this && !ped->bInVehicle) {
@@ -2229,6 +2232,7 @@ CPed::BuildPedLists(void)
if (nThreatReactionRangeMultiplier * 30.0f > dist) {
gapTempPedList[gnNumTempPedList] = ped;
gnNumTempPedList++;
+ assert(gnNumTempPedList < ARRAYSIZE(gapTempPedList));
}
}
}
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 9876f946..d87764ff 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -575,7 +575,7 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
}
}
// Yeah, float
- float maxPossiblePedsForArea = 10.0f * (zoneInfo.pedDensity + zoneInfo.carDensity) * playerInfo->m_fRoadDensity * PedDensityMultiplier * CIniFile::PedNumberMultiplier;
+ float maxPossiblePedsForArea = (zoneInfo.pedDensity + zoneInfo.carDensity) * playerInfo->m_fRoadDensity * PedDensityMultiplier * CIniFile::PedNumberMultiplier;
// maxPossiblePedsForArea = min(maxPossiblePedsForArea, MaxNumberOfPedsInUse);
if (ms_nTotalPeds < maxPossiblePedsForArea || addCop) {
@@ -637,19 +637,19 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
if (pedTypeToAdd == PEDTYPE_COP) {
// Unused code, ChoosePolicePedOccupation returns COP_STREET. Spawning FBI/SWAT/Army done in somewhere else.
- if (modelToAdd != COP_STREET) {
- if (modelToAdd == COP_FBI) {
- if (!CModelInfo::GetModelInfo(MI_FBI)->GetRwObject())
- return;
+ if (modelToAdd == COP_STREET) {
+ if (!CModelInfo::GetModelInfo(MI_COP)->GetRwObject())
+ return;
- } else if (modelToAdd == COP_SWAT) {
- if (!CModelInfo::GetModelInfo(MI_SWAT)->GetRwObject())
- return;
+ } else if (modelToAdd == COP_FBI) {
+ if (!CModelInfo::GetModelInfo(MI_FBI)->GetRwObject())
+ return;
- } else if (modelToAdd == COP_ARMY && !CModelInfo::GetModelInfo(MI_ARMY)->GetRwObject()) {
+ } else if (modelToAdd == COP_SWAT) {
+ if (!CModelInfo::GetModelInfo(MI_SWAT)->GetRwObject())
return;
- }
- } else if (!CModelInfo::GetModelInfo(MI_COP)->GetRwObject()) {
+
+ } else if (modelToAdd == COP_ARMY && !CModelInfo::GetModelInfo(MI_ARMY)->GetRwObject()) {
return;
}
} else if (!CModelInfo::GetModelInfo(modelToAdd)->GetRwObject()) {