Page 1 of 1

continue enums in subclasses

Posted: Wed Nov 15, 2023 8:52 am
by Sir Robin
this is a pretty minor thing and easy to work around, but it would be nice if enums continued in subclasses

Code: Select all

class test : inventory
{
	enum MyEnum
	{
		MY_First,
		MY_Second
	}
	
	default {+inventory.invbar;inventory.icon "UNKNA0";}
	states {spawn:UNKN A -1;stop;}

	override bool use(bool pickup)
	{
		console.printf("first:  "..MY_First);
		console.printf("second: "..MY_Second);
		return false;
	}
}

class test1 : test
{
	enum MyEnum
	{
		MY_Third,
		MY_Fourth
	}
	override bool use(bool pickup)
	{
		super.use(pickup);
		console.printf("third:  "..MY_Third);
		console.printf("fourth: "..MY_Fourth);
		return false;
	}
}
it would be nice if test1.MY_Third==2 but it restarts at 0