From 3690f933020cbb24ae12b32a18ad2ca836edcfb0 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 31 May 2014 16:32:15 -0700 Subject: [PATCH] Fix for fear failing, removed #fear command because it was blank anyway, added a cmake command to change the default map/water/path directory --- CMakeLists.txt | 4 +- zone/command.cpp | 176 +-------------------------------------------- zone/command.h | 1 - zone/map.cpp | 14 ++-- zone/water_map.cpp | 7 +- zone/water_map.h | 2 +- 6 files changed, 14 insertions(+), 190 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15b654411..45d3f6c50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,10 +249,12 @@ IF(EQEMU_BUILD_LUA) ADD_DEFINITIONS(-DLUA_EQEMU) ENDIF(EQEMU_BUILD_LUA) +SET(EQEMU_MAP_DIR "./Maps" CACHE STRING "The dir that maps, water maps, and paths are located in.") + ADD_DEFINITIONS(-DEQDEBUG=${EQEMU_DEBUG_LEVEL}) ADD_DEFINITIONS(-DINVERSEXY) ADD_DEFINITIONS(-DFIELD_ITEMS) -ADD_DEFINITIONS(-DMAP_DIR="./Maps") +ADD_DEFINITIONS(-DMAP_DIR="${EQEMU_MAP_DIR}") ADD_DEFINITIONS(-DRATEBASE=${EQEMU_STREAM_SEND_RATE}) ADD_DEFINITIONS(-DDECAYBASE=${EQEMU_STREAM_DECAY_RATE}) ADD_DEFINITIONS(-DRETRANSMIT_TIMEOUT_MULT=${EQEMU_STREAM_RETRANSMIT_TIMEOUT_MUL}) diff --git a/zone/command.cpp b/zone/command.cpp index f521ddf08..b573907a3 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -389,7 +389,6 @@ int command_init(void) { command_add("logsql","- enable SQL logging",200,command_logsql) || command_add("bestz","- Ask map for a good Z coord for your x,y coords.",0,command_bestz) || command_add("ginfo","- get group info on target.",20,command_ginfo) || - command_add("fear","- view and edit fear grids and hints",200,command_fear) || command_add("path","- view and edit pathing",200,command_path) || command_add("flags","- displays the flags of you or your target",0,command_flags) || command_add("flagedit","- Edit zone flags on your target",100,command_flagedit) || @@ -7466,179 +7465,6 @@ void command_qglobal(Client *c, const Seperator *sep) { } } -void command_fear(Client *c, const Seperator *sep) { -/* - //super-command for editing fear grids and hints -// char errbuf[MYSQL_ERRMSG_SIZE]; -// char *query = 0; - if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) { - c->Message(0, "Syntax: #fear [view|close|add|link|list|del]."); - c->Message(0, "...view - spawn an NPC at each fear grid point, and fear hint"); - c->Message(0, "...close - spawn an NPC at the closest fear point"); - c->Message(0, "...path [##] [draw|npc] - draw a path (or spawn an NPC) at each fear point for ## hops"); -// c->Message(0, "...add [force|disjoint]- add a new fear hint point where your standing"); -// c->Message(0, "....... force requires this point not move when combining nodes"); -// c->Message(0, "....... disjoint marks the graph connected to this node as a valid disjoint graph"); -// c->Message(0, "...link [id1] [id2] - make a fear hint link between two hint points"); -// c->Message(0, "...list - show a list of all fear hint points for this zone"); -// c->Message(0, "...find [range] - show a list of all fear hint points eithin range of you"); -// c->Message(0, "...del [id] - remove the fear hint 'id'"); -// c->Message(0, "...start - fears your target until you #fear stop them"); -// c->Message(0, "...stop - Stops fear on your target"); - return; - } - - if(!strcasecmp(sep->arg[1], "view")) { - if(zone->pathing == nullptr) { - c->Message(13, "There is no fear grid file loaded for this zone."); - return; - } - - uint32 count = zone->pathing->CountNodes(); - uint32 r; - char buf[128]; - PathNode_Struct *node = zone->pathing->GetNode(0); //assumes nodes are stored in a linear array - for(r = 0; r < count; r++, node++) { - sprintf(buf, "Fear_Point%d 3", r); - NPC* npc = NPC::SpawnNPC(buf, node->x, node->y, node->z, c->GetHeading(), nullptr); - if(npc == nullptr) - c->Message(13, "Unable to spawn new NPC marker."); - //do we need to do anything else? - } - } else if(!strcasecmp(sep->arg[1], "path")) { - if(zone->pathing == nullptr) { - c->Message(13, "There is no fear grid file loaded for this zone."); - return; - } - - int dist = atoi(sep->arg[2]); - char buf[128]; - - FindPerson_Point it; - vector pts; - pts.reserve(dist+2); - bool path_mode = (strcasecmp(sep->arg[3], "npc") != 0); - - MobFearState fs; - - sprintf(buf, "Close_Fear_Link%d_ 3", dist); - if(!zone->pathing->FindNearestFear(&fs, c->GetX(), c->GetY(), c->GetZ())) { - c->Message(13, "Unable to locate a closest fear path."); - return; - } - - if(path_mode) { - it.x = c->GetX(); - it.y = c->GetY(); - it.z = c->GetZ(); - pts.push_back(it); - it.x = fs.x; - it.y = fs.y; - it.z = fs.z; - pts.push_back(it); - } else { - NPC* npc = NPC::SpawnNPC(buf, fs.x, fs.y, fs.z, c->GetHeading(), nullptr); - if(npc == nullptr) - c->Message(13, "Unable to spawn new NPC marker."); - } - - for(dist--; dist > 0; dist--) { - sprintf(buf, "Close_Fear_Link%d_ 3", dist); - if(!zone->pathing->NextFearPath(&fs)) { - c->Message(13, "Unable to locate next fear path."); - return; - } - - if(path_mode) { - it.x = fs.x; - it.y = fs.y; - it.z = fs.z; - pts.push_back(it); - } else { - NPC::SpawnNPC(buf, fs.x, fs.y, fs.z, c->GetHeading(), nullptr); - } - } - - if(path_mode) { - c->SendPathPacket(pts); - } - - } else if(!strcasecmp(sep->arg[1], "close")) { - if(zone->pathing == nullptr) { - c->Message(13, "There is no fear grid file loaded for this zone."); - return; - } - MobFearState fs; - - if(!zone->pathing->FindNearestFear(&fs, c->GetX(), c->GetY(), c->GetZ())) { - c->Message(13, "Unable to locate a closest fear path."); - return; - } - - NPC* npc = NPC::SpawnNPC("Close_Fear_Point 2", fs.x, fs.y, fs.z, c->GetHeading(), nullptr); - if(npc == nullptr) - c->Message(13, "Unable to spawn new NPC marker."); - - } else if(!strcasecmp(sep->arg[1], "see")) { - - vector points; - - Mob* target = c->GetTarget(); - - if(target == nullptr) { - //empty length packet == not found. - EQApplicationPacket outapp(OP_FindPersonReply, 0); - c->QueuePacket(&outapp); - return; - } - - c->Message(13, "Found NPC '%s'\n", target->GetName()); - - //fill in the path array... - points.resize(4); - points[0].x = c->GetX(); - points[0].y = c->GetY(); - points[0].z = c->GetZ(); - points[1].x = target->GetX(); - points[1].y = target->GetY(); - points[1].z = target->GetZ(); - points[2].x = 10; - points[2].y = 10; - points[2].z = 10; - points[3].x = 0; - points[3].y = 0; - points[3].z = 0; - - - - if(points.size() == 0) { - //empty length packet == not found. - EQApplicationPacket outapp(OP_FindPersonReply, 0); - c->QueuePacket(&outapp); - return; - } - - int len = sizeof(FindPersonResult_Struct) + points.size() * sizeof(FindPerson_Point); - EQApplicationPacket *outapp = new EQApplicationPacket(OP_FindPersonReply, len); - FindPersonResult_Struct* fpr=(FindPersonResult_Struct*)outapp->pBuffer; - - vector::iterator cur, end; - cur = points.begin(); - end = points.end(); - int r; - for(r = 0; cur != end; cur++, r++) { - fpr->path[r] = *cur; - } - cur--; //last element. - fpr->dest = *cur; - - c->FastQueuePacket(&outapp); - } else { - c->Message(15, "Invalid action specified. use '#fear help' for help"); - } - */ -} - void command_path(Client *c, const Seperator *sep) { if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) @@ -7946,7 +7772,7 @@ void command_path(Client *c, const Seperator *sep) } } - return; + c->Message(0, "Unknown path command."); } void Client::Undye() { diff --git a/zone/command.h b/zone/command.h index a36009309..087e1204c 100644 --- a/zone/command.h +++ b/zone/command.h @@ -263,7 +263,6 @@ void command_logs(Client *c, const Seperator *sep); void command_nologs(Client *c, const Seperator *sep); void command_logsql(Client *c, const Seperator *sep); void command_qglobal(Client *c, const Seperator *sep); -void command_fear(Client *c, const Seperator *sep); void command_path(Client *c, const Seperator *sep); void command_ginfo(Client *c, const Seperator *sep); void command_opcode(Client *c, const Seperator *sep); diff --git a/zone/map.cpp b/zone/map.cpp index f31160806..21cbc3f1d 100644 --- a/zone/map.cpp +++ b/zone/map.cpp @@ -121,17 +121,17 @@ bool Map::LineIntersectsZoneNoZLeaps(Vertex start, Vertex end, float step_mag, V int steps = 0; if (step.x > 0 && step.x < 0.001f) - step.x = 0.001f; + step.x = 0.001f; if (step.y > 0 && step.y < 0.001f) - step.y = 0.001f; + step.y = 0.001f; if (step.z > 0 && step.z < 0.001f) - step.z = 0.001f; + step.z = 0.001f; if (step.x < 0 && step.x > -0.001f) - step.x = -0.001f; + step.x = -0.001f; if (step.y < 0 && step.y > -0.001f) - step.y = -0.001f; + step.y = -0.001f; if (step.z < 0 && step.z > -0.001f) - step.z = -0.001f; + step.z = -0.001f; //while we are not past end //always do this once, even if start == end. @@ -148,7 +148,7 @@ bool Map::LineIntersectsZoneNoZLeaps(Vertex start, Vertex end, float step_mag, V float diff = best_z - z; diff = diff < 0 ? -diff : diff; - if (z == -999999 || best_z == -999999 || diff < 12.0) + if (z <= BEST_Z_INVALID || best_z <= BEST_Z_INVALID || diff < 12.0) z = best_z; else return true; diff --git a/zone/water_map.cpp b/zone/water_map.cpp index d0bfa9999..694035815 100644 --- a/zone/water_map.cpp +++ b/zone/water_map.cpp @@ -9,13 +9,10 @@ #include "water_map_v1.h" #include "water_map_v2.h" -WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name, std::string directory) { +WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) { std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower); - - if(directory.length() == 0) - directory = MAP_DIR; - std::string file_path = directory + std::string("/") + zone_name + std::string(".wtr"); + std::string file_path = MAP_DIR + std::string("/") + zone_name + std::string(".wtr"); FILE *f = fopen(file_path.c_str(), "rb"); if(f) { char magic[10]; diff --git a/zone/water_map.h b/zone/water_map.h index 74c1baae2..2141a3000 100644 --- a/zone/water_map.h +++ b/zone/water_map.h @@ -23,7 +23,7 @@ public: WaterMap() { } ~WaterMap() { } - static WaterMap* LoadWaterMapfile(std::string zone_name, std::string directory = ""); + static WaterMap* LoadWaterMapfile(std::string zone_name); virtual WaterRegionType ReturnRegionType(float y, float x, float z) const { return RegionTypeNormal; } virtual bool InWater(float y, float x, float z) const { return false; } virtual bool InVWater(float y, float x, float z) const { return false; }