GetTerrainDef() for Sectors

Moderator: GZDoom Developers

User avatar
Major Cooke
Posts: 8197
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

GetTerrainDef() for Sectors

Post by Major Cooke »

I think it's safe to say, this code:

Code: Select all

Actor MoCue = target;
Sector s = MoCue.CurSector;
int tnum = s.GetTerrain(Sector.floor);
int temp = MoCue.floorterrain;
MoCue.floorterrain = tnum;
TerrainDef ter = MoCue.GetFloorTerrain();
MoCue.floorterrain = temp;
could easily be compressed down to something like:

Code: Select all

TerrainDef ter = s.GetTerrainDef(Sector.floor);
But figured I'd get some thoughts about it first, just in case if there's something that's being relied on any complex mechanism. If there's not, though, I could make a PR out of it relatively quickly.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia

Re: GetTerrainDef() for Sectors

Post by Marisa the Magician »

Glad someone else needs this. Alternatively I was just thinking of having a function to "get terraindef by number".
User avatar
Major Cooke
Posts: 8197
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: GetTerrainDef() for Sectors

Post by Major Cooke »

Return to “Closed Feature Suggestions [GZDoom]”