void TTableTrans::Reinitialise() { register Bitboard* entree; register int i; entree = m_pTableBlanc; for( i=0; i<m_iNbEntree; i++ ) { SetAge( (*entree) ); entree += 2; } entree = m_pTableNoir; for( i=0; i<m_iNbEntree; i++ ) { SetAge( (*entree) ); entree += 2; } }
MathStudent::MathStudent() { SetObjectCount(count); address = new char[5]; strcpy(address, "add"); city = new char[5]; strcpy(city, "cit"); state = new char[5]; strcpy(state, "sta"); zipCode = 0; SetName(" "); SetStanding(" "); SetNumber(" "); SetId(0); SetAge(0); SetGpa(0.0); SetGender('X'); SetAllDate(0,0,0); }
MathStudent::MathStudent(const MathStudent& otherStudent) { address = new char[strlen(otherStudent.GetAddress())+1]; strcpy(address, otherStudent.GetAddress()); city = new char[strlen(otherStudent.GetCity())+1]; strcpy(city, otherStudent.GetCity()); state = new char[strlen(otherStudent.GetState())+1]; strcpy(state, otherStudent.GetState()); zipCode = otherStudent.GetZipCode(); SetName(otherStudent.GetName()); SetStanding(otherStudent.GetStanding()); SetNumber(otherStudent.GetNumber()); SetId(otherStudent.GetId()); SetAge(otherStudent.GetAge()); SetGpa(otherStudent.GetGpa()); SetGender(otherStudent.GetGender()); SetAllDate(otherStudent.GetMonth(), otherStudent.GetDay(),otherStudent.GetYear()); SetObjectCount(otherStudent.GetObjectCount()); cout << "\nCopy constructor has been called."; }
void MathStudent::SetAllMath(string newName, string newStanding, string newNumber, long newId, unsigned short newAge, double newGpa, char newGender, int newMonth, int newDay, int newYear, char * newAddress, char * newCity, char * newState, long newZipCode) { SetName(newName); SetStanding(newStanding); SetNumber(newNumber); SetId(newId); SetAge(newAge); SetGpa(newGpa); SetGender(newGender); SetAllDate(newMonth, newDay, newYear); SetAddress(newAddress); SetCity(newCity); SetState(newState); SetZipCode(newZipCode); }
Student::Student(Student &student) { SetName(student.GetName()); SetSurname(student.GetSurname()); SetGroup(student.GetGroup()); SetAge(student.GetAge()); }
void MathStudent::CopyFrom(MathStudent otherStudent) { delete [] address; delete [] city; delete [] state; address = new char[strlen(otherStudent.GetAddress())+1]; strcpy(address, otherStudent.GetAddress()); city = new char[strlen(otherStudent.GetCity())+1]; strcpy(city, otherStudent.GetCity()); state = new char[strlen(otherStudent.GetState())+1]; strcpy(state, otherStudent.GetState()); zipCode = otherStudent.GetZipCode(); SetName(otherStudent.GetName()); SetStanding(otherStudent.GetStanding()); SetNumber(otherStudent.GetNumber()); SetId(otherStudent.GetId()); SetAge(otherStudent.GetAge()); SetGpa(otherStudent.GetGpa()); SetGender(otherStudent.GetGender()); SetAllDate(otherStudent.GetMonth(), otherStudent.GetDay(), otherStudent.GetYear()); }
Student::Student(const char* name, const char* surname, const char* group, int age) { SetName(name); SetSurname(surname); SetGroup(group); SetAge(age); }
/*************************************************************************** * PromptUserForInput * ------------------------------------------------------------------------- * This method will prompt the user for each input * * Returns: ***************************************************************************/ void Student::PropagateStudent() { const int WIDTH = 21; string newName; long newId; string newNumber; unsigned short newAge; char newGender; string newStanding; double newGpa; int month, day, year; cout << "\nEnter the proper information to continue.\n"; cout << setw(WIDTH) << "Enter Name: " ; getline(cin, newName); SetName(newName); cout << setw(WIDTH) << "Enter ID: "; cin >> newId; SetId(newId); cin.ignore(numeric_limits<streamsize>::max(), '\n'); cout << setw(WIDTH) << "Enter phone number: "; getline(cin, newNumber); SetNumber(newNumber); cout << setw(WIDTH) << "Enter age: "; cin >> newAge; cin.ignore(numeric_limits<streamsize>::max(), '\n'); SetAge(newAge); cout << setw(WIDTH) << "Enter Gender: "; cin.get(newGender); cin.ignore(numeric_limits<streamsize>::max(), '\n'); SetGender(newGender); cout << setw(WIDTH) << "Enter Class Standing: "; getline(cin, newStanding); SetStanding(newStanding); cout << setw(WIDTH) << "Enter GPA: "; cin >> newGpa; cin.ignore(numeric_limits<streamsize>::max(), '\n'); SetGpa(newGpa); cout << "Enter year of month, day, and year of graduation: "; cin >> month >> day >> year; SetAllDate(month, day, year); cin.ignore(numeric_limits<streamsize>::max(), '\n'); }
//assignment operator const ID& ID::operator=(const ID& rhs) { if(this != &rhs) //make sure its not the same thing! { SetName(rhs.GetName()); SetAge(rhs.GetAge()); } return *this; }
/** * brief Load the attributes for an Fish node. * * \param node The Xml node we are loading the item from */ void CFish::XmlLoad(const std::shared_ptr<xmlnode::CXmlNode> &node) { SetLocation(node->GetAttributeDoubleValue(L"x", 0), node->GetAttributeDoubleValue(L"y", 0)); SetSpeed(node->GetAttributeDoubleValue(L"speedx", 0), node->GetAttributeDoubleValue(L"speedy", 0)); SetBreed(node->GetAttributeDoubleValue(L"gestatingTime", 0), node->GetAttributeDoubleValue(L"interestTime", 0), node->GetAttributeDoubleValue(L"isInterested", 0), node->GetAttributeDoubleValue(L"isGestating", 0), node->GetAttributeDoubleValue(L"canBreed", 0), node->GetAttributeDoubleValue(L"isMale", 0)); SetFeeding(node->GetAttributeDoubleValue(L"feedingTime", 0), node->GetAttributeDoubleValue(L"isHungry", 0)); SetAge(node->GetAttributeDoubleValue(L"age", 0)); }
Cat::Cat(const char * name, const char *color,ushort weight,ushort Age) { this->name = nullptr; this->color = nullptr; this->weight = 0; this->Age = 0; SetName(name); SetColor(color); Setweight(weight); SetAge(Age); }
/*************************************************************************** * SetAll * ------------------------------------------------------------------------- * This method will set all private members * * Returns: All members will be assigned a value ***************************************************************************/ void Student::SetAll(string newName, string newStanding, string newNumber, long newId, unsigned short newAge, double newGpa, char newGender, int month, int day, int year) { //Calls all set methods to initialize all SetName (newName); SetStanding(newStanding); SetNumber (newNumber); SetId (newId); SetAge (newAge); SetGpa (newGpa); SetGender (newGender); SetAllDate(month, day, year); }
//default constructor ID::ID(): name_(0), age_(0) { SetName(DEFAULT_NAME); SetAge(DEFAULT_AGE); }
void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); if (!IsTicking()) { // The base class tick destroyed us return; } GET_AND_VERIFY_CURRENT_CHUNK(Chunk, POSX_TOINT, POSZ_TOINT); ASSERT((GetTarget() == nullptr) || (GetTarget()->IsPawn() && (GetTarget()->GetWorld() == GetWorld()))); if (m_AttackCoolDownTicksLeft > 0) { m_AttackCoolDownTicksLeft -= 1; } if (m_Health <= 0) { // The mob is dead, but we're still animating the "puff" they leave when they die m_DestroyTimer += a_Dt; if (m_DestroyTimer > std::chrono::seconds(1)) { Destroy(true); } return; } if (m_TicksSinceLastDamaged < 100) { ++m_TicksSinceLastDamaged; } if ((GetTarget() != nullptr)) { ASSERT(GetTarget()->IsTicking()); if (GetTarget()->IsPlayer()) { if (static_cast<cPlayer *>(GetTarget())->IsGameModeCreative()) { SetTarget(nullptr); m_EMState = IDLE; } } } // Process the undead burning in daylight. HandleDaylightBurning(*Chunk, WouldBurnAt(GetPosition(), *Chunk)); bool a_IsFollowingPath = false; if (m_PathfinderActivated) { if (ReachedFinalDestination()) { StopMovingToPosition(); // Simply sets m_PathfinderActivated to false. } else { // Note that m_NextWayPointPosition is actually returned by GetNextWayPoint) switch (m_PathFinder.GetNextWayPoint(*Chunk, GetPosition(), &m_FinalDestination, &m_NextWayPointPosition, m_EMState == IDLE ? true : false)) { case ePathFinderStatus::PATH_FOUND: { /* If I burn in daylight, and I won't burn where I'm standing, and I'll burn in my next position, and at least one of those is true: 1. I am idle 2. I was not hurt by a player recently. Then STOP. */ if ( m_BurnsInDaylight && ((m_TicksSinceLastDamaged >= 100) || (m_EMState == IDLE)) && WouldBurnAt(m_NextWayPointPosition, *Chunk) && !WouldBurnAt(GetPosition(), *Chunk) ) { // If we burn in daylight, and we would burn at the next step, and we won't burn where we are right now, and we weren't provoked recently: StopMovingToPosition(); } else { a_IsFollowingPath = true; // Used for proper body / head orientation only. MoveToWayPoint(*Chunk); } break; } case ePathFinderStatus::PATH_NOT_FOUND: { StopMovingToPosition(); break; } default: { } } } } SetPitchAndYawFromDestination(a_IsFollowingPath); switch (m_EMState) { case IDLE: { // If enemy passive we ignore checks for player visibility. InStateIdle(a_Dt, a_Chunk); break; } case CHASING: { // If we do not see a player anymore skip chasing action. InStateChasing(a_Dt, a_Chunk); break; } case ESCAPING: { InStateEscaping(a_Dt, a_Chunk); break; } case ATTACKING: break; } // switch (m_EMState) BroadcastMovementUpdate(); if (m_AgingTimer > 0) { m_AgingTimer--; if ((m_AgingTimer <= 0) && IsBaby()) { SetAge(1); m_World->BroadcastEntityMetadata(*this); } } }
//constructor with 2 parameters ID::ID(const char* name, int age): name_(0), age_(0) { SetName(name); SetAge(age); }
//copy constructor ID::ID(const ID& rhs): name_(0), age_(0) { SetName(rhs.GetName()); SetAge(rhs.GetAge()); }
CStandInput::CStandInput() { setWindowTitle("标准输入框"); label1=new QLabel("姓名"); label2=new QLabel("性别"); label3=new QLabel("年龄"); label4=new QLabel("身高"); labelName=new QLabel("李明"); labelName->setFrameStyle(QFrame::Panel|QFrame::Sunken); labelSex=new QLabel("男"); labelSex->setFrameStyle(QFrame::Panel|QFrame::Sunken); labelAge=new QLabel("22"); labelAge->setFrameStyle(QFrame::Panel|QFrame::Sunken); labelStature=new QLabel("175cm"); labelStature->setFrameStyle(QFrame::Panel|QFrame::Sunken); nameButton=new QPushButton; nameButton->setIcon(QIcon("btn.png")); nameButton->setText("设置姓名"); sexButton=new QPushButton; sexButton->setIcon(QIcon("btn.png")); sexButton->setText("设置性别"); ageButton=new QPushButton; ageButton->setIcon(QIcon("btn.png")); ageButton->setText("设置年龄"); statureButton=new QPushButton; statureButton->setIcon(QIcon("btn.png")); statureButton->setText("设置身高"); QGridLayout *layout=new QGridLayout(this); connect(nameButton,SIGNAL(clicked()),this,SLOT(SetName())); connect(sexButton,SIGNAL(clicked()),this,SLOT(SetSex())); connect(ageButton,SIGNAL(clicked()),this,SLOT(SetAge())); connect(statureButton,SIGNAL(clicked()),this,SLOT(SetStature())); layout->addWidget(label1,0,0); layout->addWidget(labelName,0,1); layout->addWidget(nameButton,0,2); layout->addWidget(label2,1,0); layout->addWidget(labelSex,1,1); layout->addWidget(sexButton,1,2); layout->addWidget(label3,2,0); layout->addWidget(labelAge,2,1); layout->addWidget(ageButton,2,2); layout->addWidget(label4,3,0); layout->addWidget(labelStature,3,1); layout->addWidget(statureButton,3,2); resize(250,150); }