- Removed some obsolete code from G_InitLevelLocals that was causing problems

with maps that have no name.
- Fixed: The inner loop in AWeaponSlot::PickWeapon could endlessly loop when
  the counter variable became negative.


SVN r1504 (trunk)
This commit is contained in:
Christoph Oelckers 2009-03-25 23:29:00 +00:00
parent f7bcd0b98e
commit 03e8f0e355
3 changed files with 25 additions and 38 deletions

View file

@ -1,4 +1,8 @@
March 25, 2009 (Changes by Graf Zahl) March 25, 2009 (Changes by Graf Zahl)
- Removed some obsolete code from G_InitLevelLocals that was causing problems
with maps that have no name.
- Fixed: The inner loop in AWeaponSlot::PickWeapon could endlessly loop when
the counter variable became negative.
- Fixed: Implicitly defined clusters were not initialized when being created. - Fixed: Implicitly defined clusters were not initialized when being created.
March 24, 2009 (Changes by Graf Zahl) March 24, 2009 (Changes by Graf Zahl)

View file

@ -1262,8 +1262,6 @@ void G_InitLevelLocals ()
G_AirControlChanged (); G_AirControlChanged ();
if (!info->LevelName.IsEmpty())
{
cluster_info_t *clus = FindClusterInfo (info->cluster); cluster_info_t *clus = FindClusterInfo (info->cluster);
level.partime = info->partime; level.partime = info->partime;
@ -1286,21 +1284,6 @@ void G_InitLevelLocals ()
if (!level.skypic2[0]) if (!level.skypic2[0])
strncpy (level.skypic2, level.skypic1, 8); strncpy (level.skypic2, level.skypic1, 8);
level.skypic2[8] = 0; level.skypic2[8] = 0;
}
else
{
level.partime = level.cluster = 0;
level.sucktime = 0;
level.LevelName = "Unnamed";
level.nextmap[0] =
level.secretmap[0] = 0;
level.Music = "";
strcpy (level.skypic1, "SKY1");
strcpy (level.skypic2, "SKY1");
level.flags = 0;
level.flags2 = 0;
level.levelnum = 1;
}
compatflags.Callback(); compatflags.Callback();

View file

@ -763,7 +763,7 @@ AWeapon *FWeaponSlot::PickWeapon(player_t *player)
{ {
for (j = (unsigned)(i - 1) % Weapons.Size(); for (j = (unsigned)(i - 1) % Weapons.Size();
j != i; j != i;
j = (unsigned)(j - 1) % Weapons.Size()) j = (unsigned)(j + Weapons.Size() - 1) % Weapons.Size()) // + Weapons.Size is to avoid underflows
{ {
AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory(Weapons[j].Type)); AWeapon *weap = static_cast<AWeapon *> (player->mo->FindInventory(Weapons[j].Type));