mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
Remove trailing whitespace
This commit is contained in:
+75
-75
@@ -64,18 +64,18 @@ void NPC::AI_SetRoambox(float iDist, float iMaxX, float iMinX, float iMaxY, floa
|
||||
|
||||
void NPC::DisplayWaypointInfo(Client *c) {
|
||||
|
||||
c->Message(0, "Mob is on grid %d, in spawn group %d, on waypoint %d/%d",
|
||||
c->Message(0, "Mob is on grid %d, in spawn group %d, on waypoint %d/%d",
|
||||
GetGrid(),
|
||||
GetSp2(),
|
||||
GetCurWp(),
|
||||
GetMaxWp() );
|
||||
|
||||
|
||||
|
||||
|
||||
vector<wplist>::iterator cur, end;
|
||||
cur = Waypoints.begin();
|
||||
end = Waypoints.end();
|
||||
for(; cur != end; cur++) {
|
||||
c->Message(0,"Waypoint %d: (%.2f,%.2f,%.2f,%.2f) pause %d",
|
||||
c->Message(0,"Waypoint %d: (%.2f,%.2f,%.2f,%.2f) pause %d",
|
||||
cur->index,
|
||||
cur->x,
|
||||
cur->y,
|
||||
@@ -121,13 +121,13 @@ void NPC::ResumeWandering()
|
||||
LogFile->write(EQEMuLog::Error, "NPC not paused - can't resume wandering: %lu", (unsigned long)GetNPCTypeID());
|
||||
return;
|
||||
}
|
||||
|
||||
if (cur_wp_x == GetX() && cur_wp_y == GetY())
|
||||
|
||||
if (cur_wp_x == GetX() && cur_wp_y == GetY())
|
||||
{ // are we we at a waypoint? if so, trigger event and start to next
|
||||
char temp[100];
|
||||
itoa(cur_wp,temp,10); //do this before updating to next waypoint
|
||||
CalculateNewWaypoint();
|
||||
SetAppearance(eaStanding, false);
|
||||
CalculateNewWaypoint();
|
||||
SetAppearance(eaStanding, false);
|
||||
parse->EventNPC(EVENT_WAYPOINT_DEPART, this, nullptr, temp, 0);
|
||||
} // if not currently at a waypoint, we continue on to the one we were headed to before the stop
|
||||
}
|
||||
@@ -220,14 +220,14 @@ void NPC::UpdateWaypoint(int wp_index)
|
||||
vector<wplist>::iterator cur;
|
||||
cur = Waypoints.begin();
|
||||
cur += wp_index;
|
||||
|
||||
|
||||
cur_wp_x = cur->x;
|
||||
cur_wp_y = cur->y;
|
||||
cur_wp_z = cur->z;
|
||||
cur_wp_pause = cur->pause;
|
||||
cur_wp_heading = cur->heading;
|
||||
mlog(AI__WAYPOINTS, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, cur_wp_x, cur_wp_y, cur_wp_z, cur_wp_heading);
|
||||
|
||||
|
||||
//fix up pathing Z
|
||||
if(zone->HasMap() && RuleB(Map, FixPathingZAtWaypoints))
|
||||
{
|
||||
@@ -242,8 +242,8 @@ void NPC::UpdateWaypoint(int wp_index)
|
||||
if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaWaypoint))
|
||||
cur_wp_z = newz + 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void NPC::CalculateNewWaypoint()
|
||||
@@ -326,7 +326,7 @@ void NPC::CalculateNewWaypoint()
|
||||
cur_wp = cur_wp + 1;
|
||||
break;
|
||||
}
|
||||
case 5: //pick random closest 5 and pick one that's in sight
|
||||
case 5: //pick random closest 5 and pick one that's in sight
|
||||
{
|
||||
list<wplist> closest;
|
||||
GetClosestWaypoint(closest, 5, GetX(), GetY(), GetZ());
|
||||
@@ -411,29 +411,29 @@ void NPC::GetClosestWaypoint(list<wplist> &wp_list, int count, float m_x, float
|
||||
}
|
||||
}
|
||||
|
||||
void NPC::SetWaypointPause()
|
||||
{
|
||||
//Declare time to wait on current WP
|
||||
|
||||
if (cur_wp_pause == 0) {
|
||||
AIwalking_timer->Start(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch (pausetype)
|
||||
{
|
||||
case 0: //Random Half
|
||||
AIwalking_timer->Start((cur_wp_pause - MakeRandomInt(0, cur_wp_pause-1)/2)*1000);
|
||||
break;
|
||||
case 1: //Full
|
||||
AIwalking_timer->Start(cur_wp_pause*1000);
|
||||
break;
|
||||
case 2: //Random Full
|
||||
AIwalking_timer->Start(MakeRandomInt(0, cur_wp_pause-1)*1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void NPC::SetWaypointPause()
|
||||
{
|
||||
//Declare time to wait on current WP
|
||||
|
||||
if (cur_wp_pause == 0) {
|
||||
AIwalking_timer->Start(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch (pausetype)
|
||||
{
|
||||
case 0: //Random Half
|
||||
AIwalking_timer->Start((cur_wp_pause - MakeRandomInt(0, cur_wp_pause-1)/2)*1000);
|
||||
break;
|
||||
case 1: //Full
|
||||
AIwalking_timer->Start(cur_wp_pause*1000);
|
||||
break;
|
||||
case 2: //Random Full
|
||||
AIwalking_timer->Start(MakeRandomInt(0, cur_wp_pause-1)*1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NPC::SaveGuardSpot(bool iClearGuardSpot) {
|
||||
@@ -520,9 +520,9 @@ float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
|
||||
bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, bool checkZ) {
|
||||
if(GetID()==0)
|
||||
return true;
|
||||
|
||||
|
||||
_ZP(Mob_CalculateNewPosition2);
|
||||
|
||||
|
||||
if ((x_pos-x == 0) && (y_pos-y == 0)) {//spawn is at target coords
|
||||
if(z_pos-z != 0) {
|
||||
z_pos = z;
|
||||
@@ -540,15 +540,15 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
z_pos = z;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int compare_steps = IsBoat() ? 1 : 20;
|
||||
if(tar_ndx < compare_steps && tarx==x && tary==y){
|
||||
x_pos = x_pos + tar_vx*tar_vector;
|
||||
y_pos = y_pos + tar_vy*tar_vector;
|
||||
z_pos = z_pos + tar_vz*tar_vector;
|
||||
|
||||
|
||||
mlog(AI__WAYPOINTS, "Calculating new position2 to (%.3f, %.3f, %.3f), old vector (%.3f, %.3f, %.3f)", x, y, z, tar_vx, tar_vy, tar_vz);
|
||||
|
||||
|
||||
uint8 NPCFlyMode = 0;
|
||||
|
||||
if(IsNPC()) {
|
||||
@@ -581,13 +581,13 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
z_pos = newz + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tar_ndx++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (tar_ndx>50) {
|
||||
tar_ndx--;
|
||||
} else {
|
||||
@@ -601,7 +601,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
float ny = this->y_pos;
|
||||
float nz = this->z_pos;
|
||||
// float nh = this->heading;
|
||||
|
||||
|
||||
tar_vx = x - nx;
|
||||
tar_vy = y - ny;
|
||||
tar_vz = z - nz;
|
||||
@@ -645,7 +645,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
z_pos = z;
|
||||
|
||||
mlog(AI__WAYPOINTS, "Only a single step to get there... jumping.");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,7 +657,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
heading = CalculateHeadingToTarget(x, y);
|
||||
mlog(AI__WAYPOINTS, "Next position2 (%.3f, %.3f, %.3f) (%d steps)", x_pos, y_pos, z_pos, numsteps);
|
||||
}
|
||||
|
||||
|
||||
uint8 NPCFlyMode = 0;
|
||||
|
||||
if(IsNPC()) {
|
||||
@@ -691,10 +691,10 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, float speed, b
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SetMoving(true);
|
||||
moved=true;
|
||||
|
||||
|
||||
delta_x=x_pos-nx;
|
||||
delta_y=y_pos-ny;
|
||||
delta_z=z_pos-nz;
|
||||
@@ -722,14 +722,14 @@ bool Mob::CalculateNewPosition2(float x, float y, float z, float speed, bool che
|
||||
bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool checkZ) {
|
||||
if(GetID()==0)
|
||||
return true;
|
||||
|
||||
|
||||
_ZP(Mob_CalculateNewPosition);
|
||||
|
||||
|
||||
float nx = x_pos;
|
||||
float ny = y_pos;
|
||||
float nz = z_pos;
|
||||
// float nh = heading;
|
||||
|
||||
|
||||
// if NPC is rooted
|
||||
if (speed == 0.0) {
|
||||
SetHeading(CalculateHeadingToTarget(x, y));
|
||||
@@ -752,9 +752,9 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec
|
||||
return false;
|
||||
pRunAnimSpeed = (uint8)(speed*NPC_RUNANIM_RATIO);
|
||||
speed *= NPC_SPEED_MULTIPLIER;
|
||||
|
||||
|
||||
mlog(AI__WAYPOINTS, "Calculating new position to (%.3f, %.3f, %.3f) vector (%.3f, %.3f, %.3f) rate %.3f RAS %d", x, y, z, tar_vx, tar_vy, tar_vz, speed, pRunAnimSpeed);
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// 2: get unit vector
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -774,7 +774,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec
|
||||
z_pos = z_pos + tar_vz*tar_vector;
|
||||
mlog(AI__WAYPOINTS, "Next position (%.3f, %.3f, %.3f)", x_pos, y_pos, z_pos);
|
||||
}
|
||||
|
||||
|
||||
uint8 NPCFlyMode = 0;
|
||||
|
||||
if(IsNPC()) {
|
||||
@@ -794,7 +794,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec
|
||||
|
||||
mlog(AI__WAYPOINTS, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz,x_pos,y_pos,z_pos);
|
||||
|
||||
if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
|
||||
if( (newz > -2000) && ABS(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaMoving)) // Sanity check.
|
||||
{
|
||||
if(ABS(x - x_pos) < 0.5 && ABS(y - y_pos) < 0.5)
|
||||
{
|
||||
@@ -808,7 +808,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//OP_MobUpdate
|
||||
if((old_test_vector!=test_vector) || tar_ndx>20){ //send update
|
||||
tar_ndx=0;
|
||||
@@ -821,7 +821,7 @@ bool Mob::CalculateNewPosition(float x, float y, float z, float speed, bool chec
|
||||
SendPosUpdate();
|
||||
}
|
||||
tar_ndx++;
|
||||
|
||||
|
||||
// now get new heading
|
||||
SetAppearance(eaStanding, false); // make sure they're standing
|
||||
pLastChange = Timer::GetCurrentTime();
|
||||
@@ -837,7 +837,7 @@ void NPC::AssignWaypoints(int32 grid) {
|
||||
this->CastToNPC()->SetGrid(grid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
@@ -884,7 +884,7 @@ void NPC::AssignWaypoints(int32 grid) {
|
||||
adverrorinfo = 7564;
|
||||
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
{
|
||||
if(row[0] != 0 && row[1] != 0 && row[2] != 0 && row[3] != 0)
|
||||
{
|
||||
wplist newwp;
|
||||
@@ -892,7 +892,7 @@ void NPC::AssignWaypoints(int32 grid) {
|
||||
newwp.x = atof(row[0]);
|
||||
newwp.y = atof(row[1]);
|
||||
newwp.z = atof(row[2]);
|
||||
|
||||
|
||||
if(zone->HasMap() && RuleB(Map, FixPathingZWhenLoading) )
|
||||
{
|
||||
if(!RuleB(Watermap, CheckWaypointsInWaterWhenLoading) || !zone->HasWaterMap() ||
|
||||
@@ -941,8 +941,8 @@ void Mob::SendTo(float new_x, float new_y, float new_z) {
|
||||
|
||||
if(flymode == FlyMode1)
|
||||
return;
|
||||
|
||||
//fix up pathing Z, this shouldent be needed IF our waypoints
|
||||
|
||||
//fix up pathing Z, this shouldent be needed IF our waypoints
|
||||
//are corrected instead
|
||||
if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo) )
|
||||
{
|
||||
@@ -967,8 +967,8 @@ void Mob::SendToFixZ(float new_x, float new_y, float new_z) {
|
||||
x_pos = new_x;
|
||||
y_pos = new_y;
|
||||
z_pos = new_z + 0.1;
|
||||
|
||||
//fix up pathing Z, this shouldent be needed IF our waypoints
|
||||
|
||||
//fix up pathing Z, this shouldent be needed IF our waypoints
|
||||
//are corrected instead
|
||||
|
||||
if(zone->HasMap() && RuleB(Map, FixPathingZOnSendTo))
|
||||
@@ -1146,7 +1146,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
||||
{
|
||||
float difference;
|
||||
difference = sqrtf(pow(fabs(x-dbx),2) + pow(fabs(y-dby),2));
|
||||
client->Message(0,
|
||||
client->Message(0,
|
||||
"Grid assign: spawn2 id = %d updated - fuzzy match: deviation %f",
|
||||
spawn2id, difference
|
||||
);
|
||||
@@ -1176,7 +1176,7 @@ void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
||||
* zoneid: The ID number of the zone the grid is being created/deleted in
|
||||
*/
|
||||
|
||||
void ZoneDatabase::ModifyGrid(Client *c, bool remove, uint32 id, uint8 type, uint8 type2, uint16 zoneid) {
|
||||
void ZoneDatabase::ModifyGrid(Client *c, bool remove, uint32 id, uint8 type, uint8 type2, uint16 zoneid) {
|
||||
char *query = 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!remove)
|
||||
@@ -1211,7 +1211,7 @@ void ZoneDatabase::ModifyGrid(Client *c, bool remove, uint32 id, uint8 type, uin
|
||||
*/
|
||||
|
||||
void ZoneDatabase::AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading)
|
||||
{
|
||||
{
|
||||
char *query = 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
@@ -1265,7 +1265,7 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
|
||||
// See what grid number our spawn is assigned
|
||||
if(RunQuery(query, MakeAnyLenString(&query,"SELECT pathgrid FROM spawn2 WHERE id=%i",spawn2id),errbuf,&result))
|
||||
{
|
||||
@@ -1308,8 +1308,8 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
}
|
||||
else // NPC had a grid assigned to it
|
||||
CreatedNewGrid = false;
|
||||
|
||||
|
||||
|
||||
|
||||
// Find out what the next waypoint is for this grid
|
||||
query = 0;
|
||||
if(RunQuery(query, MakeAnyLenString(&query,"SELECT max(`number`) FROM grid_entries WHERE zoneid='%i' AND gridid='%i'",zoneid,grid_num),errbuf,&result))
|
||||
@@ -1335,10 +1335,10 @@ uint32 ZoneDatabase::AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float
|
||||
if(c) c->LogSQL(query);
|
||||
}
|
||||
safe_delete_array(query);
|
||||
|
||||
|
||||
if(CreatedNewGrid)
|
||||
return grid_num;
|
||||
|
||||
|
||||
return 0;
|
||||
} /*** END ZoneDatabase::AddWPForSpawn() ***/
|
||||
|
||||
@@ -1353,7 +1353,7 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) {
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
uint32 tmp=0;
|
||||
if (row[0])
|
||||
if (row[0])
|
||||
tmp = atoi(row[0]);
|
||||
mysql_free_result(result);
|
||||
tmp++;
|
||||
|
||||
Reference in New Issue
Block a user