Thanks for all the input.  I'm muddling through the perl script.

I'm also looking forward into what information I need to send to the
client so I can render the correct tile.  I'd rather not send the tile
information directly since the raw info could be useful for bots.
Anyway, I came across something in tilepick.cc that I didn't quite
understand and was hoping to get some help with:

    case OBJ_POTIONS:
        if (id[ IDTYPE_POTIONS ][type] == ID_KNOWN_TYPE ||
(item.flags &ISFLAG_KNOW_TYPE))

Is there really a case where the items.flag is not valid and we need
to check the known types?  I'd rather not send over all of the known
types of items to the client if I can avoid it.  A similar check is
present for each type of object (Books, Rings, etc).

--Jeff

On Thu, May 5, 2011 at 5:05 AM,
<crawl-ref-discuss-requ...@lists.sourceforge.net> wrote:
> Send Crawl-ref-discuss mailing list submissions to
>        crawl-ref-discuss@lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        https://lists.sourceforge.net/lists/listinfo/crawl-ref-discuss
> or, via email, send a message with subject or body 'help' to
>        crawl-ref-discuss-requ...@lists.sourceforge.net
>
> You can reach the person managing the list at
>        crawl-ref-discuss-ow...@lists.sourceforge.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Crawl-ref-discuss digest..."
>
> Today's Topics:
>
>   1. Re: Online Tiles - Data Format (Adam Borowski)
>   2. Re: Online Tiles - Data Format (Jesse Luehrs)
>   3. Re: Online Tiles - Data Format (Adam Borowski)
>   4. Re: Online Tiles - Data Format (Paul Du Bois)
>
>
> ---------- Forwarded message ----------
> From: Adam Borowski <kilob...@angband.pl>
> To: crawl-ref-discuss@lists.sourceforge.net
> Date: Thu, 5 May 2011 02:08:35 +0200
> Subject: Re: [Crawl-ref-discuss] Online Tiles - Data Format
> On Wed, May 04, 2011 at 10:40:22AM -0700, Jeff Johnson wrote:
>> It sounds o.k. to me, but my perl knowledge is not that great.  Is
>> there a volunteer to start the perl script?  If someone can read the
>> enum.h file into data structures, I can output the correct stuff.
>> If not, I can muddle through it. :)
>
> Is this good enough?
>
> =====================================================================
> #!/usr/bin/perl -w
> use Cwd;
>
> my $src = Cwd::realpath(__FILE__ . "/../../enum.h");
> -r $src or die "Can't find enum.h\n";
> open IN, "cpp \"$src\"|" or die "Can't run cpp\n";
> { undef local $/; $_ = <IN>; }
> /enum monster_type\s*{\s*((?:\w+\s*(?:\s*=\s*\w+)?,\s*)+)}/
>  or die "Can't find enum monster_type in enum.h\n";
> print "$_ => \"\L$_\"\n" for ($1 =~ /(\w+)\s*(?:\s*=\s*\w+)?,/g)
> =====================================================================
>
>
> --
> 1KB             // Microsoft corollary to Hanlon's razor:
>                //      Never attribute to stupidity what can be
>                //      adequately explained by malice.
>
>
>
>
> ---------- Forwarded message ----------
> From: Jesse Luehrs <d...@tozt.net>
> To: crawl-ref-discuss@lists.sourceforge.net
> Date: Wed, 4 May 2011 19:57:12 -0500
> Subject: Re: [Crawl-ref-discuss] Online Tiles - Data Format
> On Thu, May 05, 2011 at 02:08:35AM +0200, Adam Borowski wrote:
>> On Wed, May 04, 2011 at 10:40:22AM -0700, Jeff Johnson wrote:
>> > It sounds o.k. to me, but my perl knowledge is not that great.  Is
>> > there a volunteer to start the perl script?  If someone can read the
>> > enum.h file into data structures, I can output the correct stuff.
>> > If not, I can muddle through it. :)
>>
>> Is this good enough?
>>
>> =====================================================================
>> #!/usr/bin/perl -w
>> use Cwd;
>>
>> my $src = Cwd::realpath(__FILE__ . "/../../enum.h");
>> -r $src or die "Can't find enum.h\n";
>> open IN, "cpp \"$src\"|" or die "Can't run cpp\n";
>> { undef local $/; $_ = <IN>; }
>> /enum monster_type\s*{\s*((?:\w+\s*(?:\s*=\s*\w+)?,\s*)+)}/
>>   or die "Can't find enum monster_type in enum.h\n";
>> print "$_ => \"\L$_\"\n" for ($1 =~ /(\w+)\s*(?:\s*=\s*\w+)?,/g)
>> =====================================================================
>
> Sigh. How about we write perl as though it was written sometime in the
> past decade?
>
> =====================================================================
> #!/usr/bin/env perl
> use strict;
> use warnings;
>
> use Cwd;
> use File::Spec;
>
> my $filename = File::Spec->catfile(__FILE__, '..', '..', 'enum.h');
> $filename = Cwd::realpath($filename);
> die "Can't find enum.h"
>    unless -r $filename;
>
> my $source = do {
>    open STDIN, '<', $filename
>        or die "Can't reopen stdin: $!";
>    open my $fh, '-|', 'cpp'
>        or die "Can't run cpp: $!";
>    local $/;
>    <$fh>
> };
>
> die "Can't find enum monster_type in enum.h"
>    unless $source =~ /enum monster_type/;
>
> $source =~ s/.*enum monster_type.*?\n//s;
>
> for my $line (split /\n/, $source) {
>    last if $line =~ /}/;
>
>    my ($enum) = $line =~ /(\w+).*?,/;
>    next unless $enum;
>    my $lc_enum = lc($enum);
>    print qq{$enum => "$lc_enum"\n};
> }
> =====================================================================
>
> Perl doesn't have to be unreadable, you know d:
>
> -doy
>
>
>
>
> ---------- Forwarded message ----------
> From: Adam Borowski <kilob...@angband.pl>
> To: crawl-ref-discuss@lists.sourceforge.net
> Date: Thu, 5 May 2011 09:58:35 +0200
> Subject: Re: [Crawl-ref-discuss] Online Tiles - Data Format
> On Wed, May 04, 2011 at 07:57:12PM -0500, Jesse Luehrs wrote:
>> On Thu, May 05, 2011 at 02:08:35AM +0200, Adam Borowski wrote:
>
>> > /enum monster_type\s*{\s*((?:\w+\s*(?:\s*=\s*\w+)?,\s*)+)}/
>
>> for my $line (split /\n/, $source) {
>>     last if $line =~ /}/;
>>
>>     my ($enum) = $line =~ /(\w+).*?,/;
>>     next unless $enum;
>>     my $lc_enum = lc($enum);
>>     print qq{$enum => "$lc_enum"\n};
>> }
>
> This assumes there can be ever only one enum per line.  C++, unlike Python,
> doesn't suffer from Fortranitis and lets you format the source any way you
> want.
>
>> Perl doesn't have to be unreadable, you know d:
>
> Well, I admit my version was perhaps too terse, but I'd still call yours
> _less_ readable.  Comments and /x are better than merely doing the same
> thing a roundabout way.
>
> --
> 1KB             // Microsoft corollary to Hanlon's razor:
>                //      Never attribute to stupidity what can be
>                //      adequately explained by malice.
>
>
>
>
> ---------- Forwarded message ----------
> From: Paul Du Bois <paul.dub...@gmail.com>
> To: crawl-ref-discuss@lists.sourceforge.net
> Date: Thu, 5 May 2011 04:12:57 -0700
> Subject: Re: [Crawl-ref-discuss] Online Tiles - Data Format
> On Thu, May 5, 2011 at 12:58 AM, Adam Borowski <kilob...@angband.pl> wrote:
>>> > /enum monster_type\s*{\s*((?:\w+\s*(?:\s*=\s*\w+)?,\s*)+)}/
>
> This assumes there can be ever only zero spaces before the comma. Also
> the ?: are noise that /x and comments won't fix.
>
> Not that it matters. I only reply because of your comment about
> FORTRAN and Python; you seem to be a fine young hacker and I think
> this article by a fine old hacker is worth your time:
> http://www.linuxjournal.com/article/3882
>
> p
>
>
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today.  Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Crawl-ref-discuss mailing list
> Crawl-ref-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/crawl-ref-discuss
>
>

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Crawl-ref-discuss mailing list
Crawl-ref-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/crawl-ref-discuss

Reply via email to