Worms -- OOP Redo
2016-01
Worms-Redo Project as a learning vehicle.
|
#include <worm.hpp>
Classes | |
struct | SEGMENT |
Public Types | |
enum | WormKind { VEGETARIAN, CANNIBAL, SCISSORHEAD } |
Public Member Functions | |
void | createWorm (WormKind type, const char *sy) |
Private Types | |
enum | LIFE { EATEN, DEAD, ALIVE } |
Private Member Functions | |
void | checkStomach () |
void | eat () |
void | eatACarrot () |
void | gotEaten () |
int | isAt (int row, int col) |
int | isHungry () |
void | live () |
void | setVictimWorm () |
void | shiftBodyDown (Worm *vp, int vsn) |
void | showOneWorm () |
Worm * | sliceTheVictim (Worm *vp, int vsn) |
Private Attributes | |
SEGMENT | body [MAXsegs] |
int | direction |
int | nsegs |
LIFE | status |
int | stomach |
WormKind | type |
|
private |
Enumerator | |
---|---|
EATEN | |
DEAD | |
ALIVE |
enum Worm::WormKind |
Enumerator | |
---|---|
VEGETARIAN | |
CANNIBAL | |
SCISSORHEAD |
|
private |
Definition at line 51 of file worm.cpp.
References DEAD, showOneWorm(), status, stomach, type, and xworms.
Referenced by live(), shiftBodyDown(), and sliceTheVictim().
void Worm::createWorm | ( | WormKind | type, |
const char * | sy | ||
) |
Definition at line 208 of file worm.cpp.
References ALIVE, asogCols, asogRows, body, Worm::SEGMENT::c, WormInfo::capacity, direction, findSlot(), headSeg, MAXsegs, min, NORTH, nsegs, random, status, stomach, type, worm_info, Worm::SEGMENT::x, xworms, and Worm::SEGMENT::y.
|
private |
Definition at line 155 of file worm.cpp.
References ALIVE, CANNIBAL, eatACarrot(), WormInfo::foodValue, gotEaten(), nsegs, setVictimWorm(), sliceTheVictim(), status, stomach, type, VEGETARIAN, victimSegNum, and worm_info.
Referenced by live().
|
private |
|
private |
Definition at line 40 of file worm.cpp.
References ALIVE, EATEN, status, type, and xworms.
Referenced by eat().
|
private |
Definition at line 76 of file worm.cpp.
References headSeg, nsegs, Worm::SEGMENT::x, and Worm::SEGMENT::y.
|
private |
|
private |
|
private |
Definition at line 94 of file worm.cpp.
References ALIVE, hxWorms, status, victimSegNum, wormArray, xOf, and yOf.
Referenced by eat().
|
private |
Definition at line 114 of file worm.cpp.
References body, checkStomach(), headSeg, nsegs, and stomach.
Referenced by sliceTheVictim().
|
private |
Definition at line 15 of file worm.cpp.
References ALIVE, asog, ASOG::attr, body, Worm::SEGMENT::c, WormInfo::color, EATEN, headSeg, ASOG::onec, passive, screen, status, type, worm_info, Worm::SEGMENT::x, and Worm::SEGMENT::y.
Referenced by checkStomach().
Definition at line 131 of file worm.cpp.
References checkStomach(), findSlot(), nsegs, shiftBodyDown(), stomach, type, and xworms.
Referenced by eat().
Definition at line 46 of file worm.hpp.
Referenced by createWorm(), live(), shiftBodyDown(), and showOneWorm().
|
private |
Definition at line 42 of file worm.hpp.
Referenced by createWorm(), and live().
|
private |
Definition at line 45 of file worm.hpp.
Referenced by createWorm(), eat(), isAt(), isHungry(), shiftBodyDown(), and sliceTheVictim().
|
private |
Definition at line 44 of file worm.hpp.
Referenced by checkStomach(), createWorm(), eat(), gotEaten(), isHungry(), setVictimWorm(), and showOneWorm().
|
private |
Definition at line 43 of file worm.hpp.
Referenced by checkStomach(), createWorm(), eat(), eatACarrot(), isHungry(), live(), shiftBodyDown(), and sliceTheVictim().
|
private |
Definition at line 41 of file worm.hpp.
Referenced by checkStomach(), createWorm(), eat(), gotEaten(), isHungry(), showOneWorm(), and sliceTheVictim().