bool CMoveChecker::checkMove(TDataSetRow entityIndex, sint32& x, sint32& y, uint32 tick) { // setup a refference to the entity's position record, and bomb if it can't be found TPositions::iterator positionIt= _Positions.find(entityIndex); BOMB_IF(positionIt==_Positions.end(),"Ignoring call to 'checkMove' for an entity who doesn't exist in the move checker",return false); SPosition& thePosition= positionIt->second; // if the character hasn't moved then just return if ( (x==thePosition.X) && (y==thePosition.Y) ) { return true; } // nlinfo("Checking player move: %s from (%d,%d) @tick: %d to (%d,%d) @tick: %d", // entityIndex.toString().c_str(),thePosition.X,thePosition.Y,thePosition.Tick,x,y,tick); // if the tick value is out of order (for instance, after an advanced tp request) then ignore the move DROP_IF(sint32(tick-thePosition.Tick)<0,"Ignoring out of order move for character "+entityIndex.toString(),return false); // *** todo: perform a speed test here // *** todo: perform collision test here // *** NOTE: If move not legal then we need to change values of x and y and return false // record the new position thePosition.X= x; thePosition.Y= y; thePosition.Tick= tick; // generate a few stats addStats(entityIndex,x,y,tick); return true; }
struct blatStats *sumStatsList(struct blatStats *list) /* Return sum of all stats. */ { struct blatStats *el, *stats; AllocVar(stats); for (el = list; el != NULL; el = el->next) addStats(el, stats); return stats; }
void tr_sessionGetCumulativeStats(tr_session const* session, tr_session_stats* setme) { struct tr_stats_handle const* stats = getStats(session); tr_session_stats current = TR_SESSION_STATS_INIT; if (stats != NULL) { tr_sessionGetStats(session, ¤t); addStats(setme, &stats->old, ¤t); } }
int Memory::addStats(int line) { // GNASH_REPORT_FUNCTION; if (_info) { struct small_mallinfo *ptr = _info + _index; addStats(ptr, line); } return _index; }
void Memory::startStats() { // GNASH_REPORT_FUNCTION; _collecting = true; if (_info == 0) { log_debug("Allocating buffer for %d data samples", _size); _info = new struct small_mallinfo[_size]; reset(); addStats(); } }
void tr_sessionGetCumulativeStats (const tr_session * session, tr_session_stats * setme) { const struct tr_stats_handle * stats = getStats (session); tr_session_stats current = STATS_INIT; if (stats) { tr_sessionGetStats (session, ¤t); addStats (setme, &stats->old, ¤t); } }
int Memory::addStats(struct small_mallinfo *ptr) { // GNASH_REPORT_FUNCTION; return addStats(ptr, 0); }
void FoodStats::addStats(ItemFood* itemFood, ItemStack* stack) { addStats(itemFood->getHealAmount(), itemFood->getSaturationModifier()); }