Changeset 279 for trunk/src/game/WaypointManager.cpp
- Timestamp:
- 11/22/08 00:36:22 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/WaypointManager.cpp
r272 r279 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 25 25 #include "ProgressBar.h" 26 26 #include "MapManager.h" 27 #include "ObjectMgr.h" 27 28 28 29 INSTANTIATE_SINGLETON_1(WaypointManager); … … 30 31 bool WaypointBehavior::isEmpty() 31 32 { 32 return emote == 0 && spell == 0 && model1 == 0 && model2 == 0 && text[0].empty() && 33 text[1].empty() && text[2].empty() && text[3].empty() && text[4].empty(); 33 if (emote || spell || model1 || model2) 34 return false; 35 36 for(int i = 0; i < MAX_WAYPOINT_TEXT; ++i) 37 if(textid[i]) 38 return false; 39 40 return true; 34 41 } 35 42 36 43 WaypointBehavior::WaypointBehavior(const WaypointBehavior &b) 37 44 { 38 emote = b.emote; spell = b.spell; model1 = b.model1; model2 = b.model2; 39 text[0] = b.text[0]; text[1] = b.text[1]; text[2] = b.text[2]; 40 text[3] = b.text[3]; text[4] = b.text[4]; 45 emote = b.emote; 46 spell = b.spell; 47 model1 = b.model1; 48 model2 = b.model2; 49 for(int i=0; i < MAX_WAYPOINT_TEXT; ++i) 50 textid[i] = b.textid[i]; 41 51 } 42 52 … … 67 77 } 68 78 69 result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, text 1, text2, text3, text4, text5, id, point FROM creature_movement");79 result = WorldDatabase.Query("SELECT position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id, point FROM creature_movement"); 70 80 if(result) 71 81 { … … 114 124 be.emote = fields[7].GetUInt32(); 115 125 be.spell = fields[8].GetUInt32(); 116 be.text[0] = fields[9].GetCppString(); 117 be.text[1] = fields[10].GetCppString(); 118 be.text[2] = fields[11].GetCppString(); 119 be.text[3] = fields[12].GetCppString(); 120 be.text[4] = fields[13].GetCppString(); 126 127 // load and store without holes in array 128 int j = 0; 129 for(int i = 0; i < MAX_WAYPOINT_TEXT; ++i) 130 { 131 be.textid[j] = fields[9+i].GetUInt32(); 132 if(be.textid[j]) 133 { 134 if (be.textid[j] < MIN_DB_SCRIPT_STRING_ID || be.textid[j] >= MAX_DB_SCRIPT_STRING_ID) 135 { 136 sLog.outErrorDb( "Table `db_script_string` not have string id %u", be.textid[j]); 137 continue; 138 } 139 140 if (!objmgr.GetTrinityStringLocale (be.textid[j])) 141 { 142 sLog.outErrorDb("ERROR: Waypoint path %d (point %d), have invalid text id (%i) in `textid%d, ignored.", 143 id, point, be.textid[j], i+1); 144 continue; 145 } 146 147 ++j; // to next internal field 148 } 149 } 150 // fill array tail 151 for(; j < MAX_WAYPOINT_TEXT; ++j) 152 be.textid[j] = 0; 121 153 122 154 // save memory by not storing empty behaviors … … 266 298 if(!node.behavior) node.behavior = new WaypointBehavior(); 267 299 268 if(field == "text1") node.behavior->text[0] = text ? text : "";269 if(field == "text2") node.behavior->text[1] = text ? text : "";270 if(field == "text3") node.behavior->text[2] = text ? text : "";271 if(field == "text4") node.behavior->text[3] = text ? text : "";272 if(field == "text5") node.behavior->text[4] = text ? text : "";300 // if(field == "text1") node.behavior->text[0] = text ? text : ""; 301 // if(field == "text2") node.behavior->text[1] = text ? text : ""; 302 // if(field == "text3") node.behavior->text[2] = text ? text : ""; 303 // if(field == "text4") node.behavior->text[3] = text ? text : ""; 304 // if(field == "text5") node.behavior->text[4] = text ? text : ""; 273 305 if(field == "emote") node.behavior->emote = text ? atoi(text) : 0; 274 306 if(field == "spell") node.behavior->spell = text ? atoi(text) : 0;