[Added] GetTerrainDef() for Sectors

Moderator: GZDoom Developers

GetTerrainDef() for Sectors

Postby Major Cooke » Thu Feb 17, 2022 4:06 pm

I think it's safe to say, this code:
Code: Select allExpand view
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 allExpand view
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
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: GetTerrainDef() for Sectors

Postby Marisa the Magician » Sat Feb 19, 2022 4:00 am

Glad someone else needs this. Alternatively I was just thinking of having a function to "get terraindef by number".
User avatar
Marisa the Magician
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa the Magician#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: GetTerrainDef() for Sectors

Postby Major Cooke » Mon Feb 21, 2022 6:33 pm

User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests