Page 1 of 1

Cheating will give abstract classes

Posted: Mon Mar 14, 2022 6:32 pm
by SanyaWaffles
So if you have a weapon or key that is abstract for whatever reason defined, give all will spit out an error message.

it seems, at least for weapons, the fix is simple - add a isAbstract() check like so:

Code: Select all

		if (giveall || name ~== "weapons")
		{
			let savedpending = player.PendingWeapon;
			for (i = 0; i < AllActorClasses.Size(); ++i)
			{
				let type = (class<Weapon>)(AllActorClasses[i]);
				if (type != null && type != "Weapon" && !type.isAbstract())
				{
					// Don't give replaced weapons unless the replacement was done by Dehacked.
					let rep = GetReplacement(type);
					if (rep == type || rep is "DehackedPickup")
					{
						// Give the weapon only if it is set in a weapon slot.
						if (player.weapons.LocateWeapon(type))
						{
							readonly<Weapon> def = GetDefaultByType (type);
							if (giveall == ALL_YESYES || !def.bCheatNotWeapon)
							{
								GiveInventory(type, 1, true);
							}
						}
					}
				}
			}
			player.PendingWeapon = savedpending;

			if (!giveall)
				return;
		}

Re: Cheating will give abstract classes

Posted: Mon Mar 14, 2022 7:14 pm
by phantombeta
Essentially a duplicate of this bug report, as far as I know.

Re: Cheating will give abstract classes

Posted: Mon Mar 14, 2022 7:19 pm
by SanyaWaffles
oh, didn't know it was reported all ready. My mistake.