1 #include "reader/module.ih"
5 void Reader::readAlien(Alien
*alien
, std::streampos down
, std::streampos end
) {
6 std::streampos next
= down
!= 0 ? down
: end
;
7 while (d_rider
.tellg() < end
) {
8 if (d_rider
.tellg() < next
) { // for some reason, this means its a piece (unstructured)
9 size_t len
= next
- d_rider
.tellg();
10 char *buf
= new char[len
];
11 d_rider
.read(buf
, len
);
12 AlienComponent
*comp
= new AlienPiece(buf
, len
);
13 alien
->getComponents().push_back(comp
);
14 } else { // that means we've got a store
16 AlienComponent
*comp
= new AlienPart(readStore());
17 alien
->getComponents().push_back(comp
);
18 next
= d_state
->next
> 0 ? d_state
->next
: end
;