Example #1
0
		void FromPB(const PB_AIAtt *pb_) {
			status_ = (Status)pb_->status();
			birthCoord_.FromPB(&pb_->birthCoord());
			moveRadius_ = pb_->moveRadius();
			moveType_ = (MoveType)pb_->moveType();
			followRadius_ = pb_->followRadius();
			searchRadius_ = pb_->searchRadius();
			searchType_ = (SearchType)pb_->searchType();
			fleeType_ = (FleeType)pb_->fleeType();
			fleeHP_ = pb_->fleeHP();
			callPercent_ = pb_->callPercent();
			followDelta_ = pb_->followDelta();
			canAttackBack_ = pb_->canAttackBack();
			moveInterval_ = pb_->moveInterval();
			searchInterval_ = pb_->searchInterval();
			aiType_ = (AIType)pb_->aiType();
			if (arg_size() <= pb_->arg_size()) {
				for (int i = 0; i < arg_size(); i++)
					arg_[i] = pb_->arg(i);
			} else {
				for (int i = 0; i < pb_->arg_size(); i++)
					arg_[i] = pb_->arg(i);
				for (int i = pb_->arg_size(); i < arg_size(); i++)
					arg_[i] = 0;
			}
		}
Example #2
0
unsigned int bitpat_get(unsigned int source, int begin, int len)
{
    unsigned int result = 0;
    for (int i = 0; i < len; i++){
        result <<= 1;
        result += bit_test(source, int_size () - arg_size (source) + begin + i);
    }
    return result;
    
}
Example #3
0
void FunctionState::addByValArea(unsigned ArgumentNumber,
                                 stateptr_ty Address,
                                 std::size_t Size)
{
  auto const Fn = getFunction();
  assert(ArgumentNumber < Fn->arg_size());
  
  auto ArgIt = Fn->arg_begin();
  std::advance(ArgIt, ArgumentNumber);
  
  ParamByVals.emplace_back(&*ArgIt, MemoryArea(Address, Size));
}
 // Report the number of elements on stack when invoking this method.
 // This is different than the regular arg_size because invokedynamic
 // has an implicit receiver.
 int invoke_arg_size(Bytecodes::Code code) const {
   if (is_loaded()) {
     return arg_size();
   } else {
     int arg_size = _signature->size();
     // Add a receiver argument, maybe:
     if (code != Bytecodes::_invokestatic &&
         code != Bytecodes::_invokedynamic) {
       arg_size++;
     }
     return arg_size;
   }
 }
Example #5
0
		AIAtt() {
			status_ = (Status)0;
			moveRadius_ = 0;
			moveType_ = (MoveType)0;
			followRadius_ = 0;
			searchRadius_ = 0;
			searchType_ = (SearchType)0;
			fleeType_ = (FleeType)0;
			fleeHP_ = 0.0f;
			callPercent_ = 0.0f;
			followDelta_ = 0;
			canAttackBack_ = false;
			moveInterval_ = 0;
			searchInterval_ = 0;
			aiType_ = (AIType)0;
			for (int i = 0; i < arg_size(); i++)
				arg_[i] = 0;
		}
Example #6
0
		void ToPB(PB_AIAtt *pb_) const {
			pb_->Clear();
			pb_->set_status((PB_AIAtt::Status)status_);
			birthCoord_.ToPB(pb_->mutable_birthCoord());
			pb_->set_moveRadius(moveRadius_);
			pb_->set_moveType((PB_AIAtt::MoveType)moveType_);
			pb_->set_followRadius(followRadius_);
			pb_->set_searchRadius(searchRadius_);
			pb_->set_searchType((PB_AIAtt::SearchType)searchType_);
			pb_->set_fleeType((PB_AIAtt::FleeType)fleeType_);
			pb_->set_fleeHP(fleeHP_);
			pb_->set_callPercent(callPercent_);
			pb_->set_followDelta(followDelta_);
			pb_->set_canAttackBack(canAttackBack_);
			pb_->set_moveInterval(moveInterval_);
			pb_->set_searchInterval(searchInterval_);
			pb_->set_aiType((PB_AIAtt::AIType)aiType_);
			for (int i = 0; i < arg_size(); i++)
				pb_->add_arg(arg_[i]);
		}
Example #7
0
		inline void set_arg(int index, int32_t value) {
			if (index < 0 || index >= arg_size()) {
				assert(0);
			}
			arg_[index] = value;
		}
Example #8
0
		inline int32_t arg(int index) const {
			if (index < 0 || index >= arg_size()) {
				assert(0);
			}
			return arg_[index];
		}