void Player::RepopAtGraveyard(float ox, float oy, float oz, uint32 mapid) { bool first = true; // float closestX = 0, closestY = 0, closestZ = 0, closestO = 0; StorageContainerIterator<GraveyardTeleport> * itr; LocationVector src(ox, oy, oz); LocationVector dest; LocationVector temp; float closest_dist = 999999.0f; float dist; if(m_bg && m_bg->HookHandleRepop(this)) { return; } else { itr = GraveyardStorage.MakeIterator(); GraveyardTeleport* pGrave = NULL; while(!itr->AtEnd()) { pGrave = itr->Get(); if(pGrave->MapId == mapid && (pGrave->FactionID == GetTeam() || pGrave->FactionID == 3)) { temp.ChangeCoords(pGrave->X, pGrave->Y, pGrave->Z); dist = src.DistanceSq(temp); if(first || dist < closest_dist) { first = false; closest_dist = dist; dest = temp; } } if(!itr->Inc()) break; } /* Fix on 3/13/2010, defaults to last graveyard, if none fit the criteria. Keeps the player from hanging out to dry.*/ if(first && pGrave != NULL)//crappy Databases with no graveyards. { dest.ChangeCoords(pGrave->X, pGrave->Y, pGrave->Z); first = false; } itr->Destruct(); } if(sHookInterface.OnRepop(this) && !first)//dest has now always a value != {0,0,0,0}//but there may be DBs with no graveyards { SafeTeleport(mapid, 0, dest); } /* Todo: Generate error message here, compensate for failed teleport. */ // //correct method as it works on official server, and does not require any damn sql // //no factions! no zones! no sqls! 1word: blizz-like // float closestX , closestY , closestZ ; // uint32 entries=sWorldSafeLocsStore.GetNumRows(); // GraveyardEntry*g; // uint32 mymapid=mapid // float mx=ox,my=oy; // float last_distance=9e10; // // for(uint32 x= 0;x<entries;x++) // { // g=sWorldSafeLocsStore.LookupEntry(x); // if(g->mapid!=mymapid)continue; // float distance=(mx-g->x)*(mx-g->x)+(my-g->y)*(my-g->y); // if(distance<last_distance) // { // closestX=g->x; // closestY=g->y; // closestZ=g->z; // last_distance=distance; // } // // // } // if(last_distance<1e10) //#endif }
Toggle shoutbox Lastest Announcements
![]() |
Page 1 of 1
Is It Just Me Or This Needs To Be Rewritten? taken from Player.cpp
#1
Posted 09 July 2014 - 03:00 AM
#2
Posted 09 July 2014 - 06:30 AM
What's wrong with it and why don't you rewrite it, if it needs a rewrite?
"The demand for free goods is infinite."
#3
Posted 09 July 2014 - 08:37 AM
Do you hate me because I am romanian? Or do you hate everyone?
It's not hate... It's just... You don't like noobs.
It's not hate... It's just... You don't like noobs.
#4
Posted 09 July 2014 - 11:23 AM
lexythelord, on 09 July 2014 - 08:37 AM, said:
Do you hate me because I am romanian? Or do you hate everyone?
It's not hate... It's just... You don't like noobs.
It's not hate... It's just... You don't like noobs.
I don't hate anyone, I simply asked 2 questions.
So again, why is it wrong? What's wrong with it?
Once we've established that, the next question arises: Why don't you rewrite it then?
"The demand for free goods is infinite."
#5
Posted 07 August 2014 - 11:48 AM
@ lexythelord: No its not "You don't like noobs."! It is more like "If it needs to be rewritten, start rewriting it".
#6
Posted 07 August 2014 - 09:48 PM
Tulba, what are you doing at these forums? It`s completely dead.
#7
Posted 08 August 2014 - 07:47 AM
Just because everyone says "it's dead" it is not dead.
Maybe give it a chance to become more alive
Maybe give it a chance to become more alive

Share this topic:
Page 1 of 1