ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/backend/communicator/command_parser/upditem.h
Revision: 1.1
Committed: Sun Oct 17 08:15:05 2010 UTC (16 years ago) by sf-pippijn
Content type: text/plain
Branch: MAIN
Log Message:
initial import

File Contents

# User Rev Content
1 sf-pippijn 1.1 void
2     command_parser::on_upditem (std::istream &args)
3     {
4     u08 const flags = read_u08 (args);
5     u32 location = 0;
6    
7     data::item item { };
8    
9     item.tag = read_u32 (args);
10    
11     if (flags & UPD_LOCATION) location = read_u32 (args);
12    
13     if (flags & UPD_FLAGS) item.flags = read_u32 (args);
14     if (flags & UPD_WEIGHT) item.weight = read_u32 (args);
15     if (flags & UPD_FACE) item.face = read_u32 (args);
16    
17     if (flags & UPD_NAME)
18     {
19     std::string names = read_string08 (args);
20    
21     auto pair = split2 (names, '\0');
22     item.singular = pair.first;
23     item.plural = pair.second;
24     }
25    
26     if (flags & UPD_ANIM) item.anim = read_u16 (args);
27     if (flags & UPD_ANIMSPEED) item.animspeed = read_u08 (args);
28     if (flags & UPD_NROF) item.nrof = read_u32 (args);
29    
30     emit upditem (flags, location, item);
31     }