![]() |
Quote:
|
Here ya go
Code:
# define loc_iterate(p0, p1, p) \ |
Quote:
Just taking a quick peek, there's: kobold entrails, jackal "steak", blue worm broth, fried grey rat on a stick …. |
Quote:
|
Quote:
|
Thanks Diego. Fixed the loop in original. And yeah, macros kind of suck as an alternate to more modern techniques. But in C, you get no choice.
|
Quote:
My version of loc_iterator can be also behind the same macro interface. Though you have to refer to the current loc as "iter.cur" rather than just "iter". Code:
#define loc_iterate(begin, end, iter) \ evaluated only once so using temporaries returned from loc() is not a performance hit. Though you can use verbose compound literals within parenthesis instead. Code:
loc_iterate(((struct loc) { x1, y1 }), ((struct loc) { x2, y2 }), iter) { |
Quote:
;) |
For my part the nested for loops are intuitive and I know what they do but the custom iterators look unreadable
|
Kusunose--
Notice that the macro definition requires no subroutine calls at all. It is just a transliteration of existing code idiom into a single location. So there should be no performance hit at all. In any case, there is only a single place in the code where performance matters: in determining visible monsters, walls, and objects. No other loop matters. Diego-- Sigh. Really fixed now. |
All times are GMT +1. The time now is 11:28. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.