ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/backend/communicator/command_parser/item2.h
Revision: 1.2
Committed: Mon Oct 25 12:06:57 2010 UTC (15 years, 11 months ago) by sf-pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -0 lines
Log Message:
be more strict about the protocol

File Contents

# Content
1 #include "deliantra/data/item.h"
2
3 void
4 command_parser::on_item2 (std::istream &args)
5 {
6 u32 location = read_u32 (args);
7
8 std::vector<data::item> items;
9
10 while (args.peek () != EOF)
11 {
12 data::item item;
13 item.tag = read_u32 (args);
14 item.flags = read_u32 (args);
15 item.weight = read_u32 (args);
16 item.face = read_u32 (args);
17
18 std::string names = read_string08 (args);
19
20 item.anim = read_u16 (args);
21 item.animspeed = read_u08 (args);
22 item.nrof = read_u32 (args);
23 item.type = read_u16 (args);
24
25 auto pair = split2 (names, '\0');
26 item.singular = pair.first;
27 item.plural = pair.second;
28
29 items.push_back (item);
30 }
31 PARSE_END;
32
33 emit item2 (location, items);
34 }