continue enums in subclasses

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: continue enums in subclasses

continue enums in subclasses

by Sir Robin » Wed Nov 15, 2023 8:52 am

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

Top