Skip to content

Commit

Permalink
#3933: prevent inlined FS spawning
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.thedarkmod.com/svn/darkmod_src/trunk@6176 49c82d7f-2e2a-0410-a16f-ae8f201b507f
  • Loading branch information
stevel committed Nov 25, 2014
1 parent 3878057 commit 90c15a9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
9 changes: 0 additions & 9 deletions game/DifficultyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,6 @@ bool DifficultyManager::InhibitEntitySpawn(const idDict& target) {

DM_LOG(LC_DIFFICULTY, LT_INFO)LOGSTRING("Entity %s is allowed to spawn on difficulty %i: %s.\r", target.GetString("name"), _difficulty, isAllowed ? "YES" : "NO");

// Tels: #3223: See if this entity should spawn this time
float random_remove = target.GetFloat( "random_remove", "1.1");
float random_value = gameLocal.random.RandomFloat();
if (random_remove < random_value)
{
isAllowed = false;
DM_LOG(LC_ENTITY, LT_INFO)LOGSTRING("Removing entity %s due to random_remove %f < %f.\r", target.GetString("name"), random_remove, random_value);
}

// Return false if the entity is allowed to spawn
return !isAllowed;
}
Expand Down
24 changes: 22 additions & 2 deletions game/Game_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5377,9 +5377,29 @@ idGameLocal::InhibitEntitySpawn
================
*/
bool idGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) {
bool inhibit_spawn = false;

if ( spawnArgs.GetBool("inline") && idStr("func_static") == spawnArgs.GetString("classname") ) // #3933 prevent inlined FS from spawning
{
inhibit_spawn = true;
}

// Consult the difficulty manager, whether this entity should be prevented from being spawned.
return m_DifficultyManager.InhibitEntitySpawn(spawnArgs);
if ( m_DifficultyManager.InhibitEntitySpawn(spawnArgs) )
{
inhibit_spawn = true;
}

// Tels: #3223: See if this entity should spawn this time
// Moved from DifficultyManager.cpp in #3933
float random_remove = spawnArgs.GetFloat( "random_remove", "1.1" );
float random_value = gameLocal.random.RandomFloat();
if ( random_remove < random_value )
{
inhibit_spawn = true;
DM_LOG( LC_ENTITY, LT_INFO )LOGSTRING( "Removing entity %s due to random_remove %f < %f.\r", spawnArgs.GetString( "name" ), random_remove, random_value );
}

return inhibit_spawn;
}

/*
Expand Down

0 comments on commit 90c15a9

Please sign in to comment.