Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old July 31, 2019, 14:36   #301
tangar
Knight
 
tangar's Avatar
 
Join Date: Mar 2015
Location: Moscow, Russia
Posts: 531
tangar is on a distinguished road
Quote:
Originally Posted by Nick View Post
[*]Shockbolt tiles for the new foods (if someone wants to do something about the other tilesets, great)
I wonder is there a post about new food, like a list what's were added? I'm greatly interested in *band gastronomy
__________________
http://tangaria.com - persistent online multiplayer roguelike game
tangar.info - my website ⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽ My chars @ angband.oook.cz
youtube.com/GlazGame — streams in English ⍽ youtube.com/StreamGuild — streams in Russian
tangar is offline   Reply With Quote
Old July 31, 2019, 14:41   #302
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,322
Donated: $40
Pete Mack is on a distinguished road
Here ya go
Code:
# define loc_iterate(p0, p1, p) \
      for(p = p0; p.x < p1.x; p.x++) \
             for(p.y = p0.y; p.y < p1.y; p.y++)


.....
       point p0 ,p1, p;
       loc_iterate(p0, p1, p)
           foo(p);
Edit: fixed for correctness, thanks Diego

Last edited by Pete Mack; July 31, 2019 at 21:52.
Pete Mack is online now   Reply With Quote
Old July 31, 2019, 15:43   #303
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,019
wobbly is on a distinguished road
Quote:
Originally Posted by tangar View Post
I wonder is there a post about new food, like a list what's were added? I'm greatly interested in *band gastronomy
They'll be in object.txt

Just taking a quick peek, there's: kobold entrails, jackal "steak", blue worm broth, fried grey rat on a stick ….
wobbly is offline   Reply With Quote
Old July 31, 2019, 15:50   #304
tangar
Knight
 
tangar's Avatar
 
Join Date: Mar 2015
Location: Moscow, Russia
Posts: 531
tangar is on a distinguished road
Quote:
Originally Posted by wobbly View Post
They'll be in object.txt

Just taking a quick peek, there's: kobold entrails, jackal "steak", blue worm broth, fried grey rat on a stick ….
Thanks This sounds delicious
__________________
http://tangaria.com - persistent online multiplayer roguelike game
tangar.info - my website ⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽⍽ My chars @ angband.oook.cz
youtube.com/GlazGame — streams in English ⍽ youtube.com/StreamGuild — streams in Russian
tangar is offline   Reply With Quote
Old July 31, 2019, 15:54   #305
Diego Gonzalez
Apprentice
 
Join Date: May 2007
Posts: 50
Diego Gonzalez is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
Here ya go
Code:
# define loc_iterate(p0, p1, p) \
      for(p = p0; p.x < p1.x; p.x++) \
             for(; p.y < p1.y; p.y++)


.....
       point p0 ,p1, p;
       loc_iterate(p0, p1, p)
           foo(p);
You must reset the y coordinate in the inner loop. I like your solution. Very C-ish
Diego Gonzalez is offline   Reply With Quote
Old July 31, 2019, 15:58   #306
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,322
Donated: $40
Pete Mack is on a distinguished road
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.
Pete Mack is online now   Reply With Quote
Old July 31, 2019, 20:16   #307
Kusunose
Rookie
 
Join Date: Jan 2019
Posts: 6
Kusunose is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
Here ya go
Code:
# define loc_iterate(p0, p1, p) \
      for(p = p0; p.x < p1.x; p.x++) \
             for(p.y = 0; p.y < p1.y; p.y++)


.....
       point p0 ,p1, p;
       loc_iterate(p0, p1, p)
           foo(p);
Edit: fixed for correctness, thanks Diego
It's nice and short.

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)	\
	for (struct loc_iterator iter = loc_iterator(begin, end); \
		 loc_iterator_test(&iter); loc_iterator_next(&iter))
...
	struct loc p1, p2;
	loc_iterate(p1, p2, iter) {
		foo(iter.cur);
	}
or
	loc_iterate(loc(x1, y1), loc(x2, y2), iter) {
		foo(iter.cur);
	}
An advantage of my version is that "begin" and "end" are
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) {
		foo(iter.cur);
	}
Kusunose is offline   Reply With Quote
Old July 31, 2019, 20:46   #308
Diego Gonzalez
Apprentice
 
Join Date: May 2007
Posts: 50
Diego Gonzalez is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
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.
p.y = p0.y

Diego Gonzalez is offline   Reply With Quote
Old July 31, 2019, 22:05   #309
Gwarl
Knight
 
Join Date: Jan 2017
Posts: 712
Gwarl is on a distinguished road
For my part the nested for loops are intuitive and I know what they do but the custom iterators look unreadable
Gwarl is offline   Reply With Quote
Old July 31, 2019, 22:31   #310
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,322
Donated: $40
Pete Mack is on a distinguished road
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.
Pete Mack is online now   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
First release Quirk Sil 18 November 14, 2017 22:45
3.4.0 Release Candidate is available fizzix Vanilla 111 July 5, 2012 12:39
3.2 release candidate is upon us! d_m Vanilla 147 January 19, 2011 10:10
Release HellBand 0.8.7 konijn_ Variants 4 December 27, 2009 04:14
reactions to changes in new V release will_asher Vanilla 50 April 9, 2008 18:47


All times are GMT +1. The time now is 01:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.