Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(35) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(354) |
Feb
(363) |
Mar
(542) |
Apr
(494) |
May
(232) |
Jun
(349) |
Jul
(221) |
Aug
(154) |
Sep
(124) |
Oct
(89) |
Nov
(121) |
Dec
(133) |
2003 |
Jan
(279) |
Feb
(490) |
Mar
(448) |
Apr
(295) |
May
(151) |
Jun
(209) |
Jul
(367) |
Aug
(371) |
Sep
(284) |
Oct
(492) |
Nov
(540) |
Dec
(240) |
2004 |
Jan
(381) |
Feb
(497) |
Mar
(556) |
Apr
(394) |
May
(332) |
Jun
(263) |
Jul
(533) |
Aug
(348) |
Sep
(398) |
Oct
(520) |
Nov
(511) |
Dec
(703) |
2005 |
Jan
(700) |
Feb
(354) |
Mar
(456) |
Apr
(300) |
May
(444) |
Jun
(405) |
Jul
(312) |
Aug
(480) |
Sep
(302) |
Oct
(660) |
Nov
(448) |
Dec
(658) |
2006 |
Jan
(543) |
Feb
(313) |
Mar
(293) |
Apr
(293) |
May
(244) |
Jun
(256) |
Jul
(257) |
Aug
(194) |
Sep
(64) |
Oct
(174) |
Nov
(340) |
Dec
(250) |
2007 |
Jan
(281) |
Feb
(350) |
Mar
(245) |
Apr
(348) |
May
(262) |
Jun
(188) |
Jul
(233) |
Aug
(303) |
Sep
(426) |
Oct
(470) |
Nov
(181) |
Dec
(242) |
2008 |
Jan
(176) |
Feb
(268) |
Mar
(253) |
Apr
(136) |
May
(198) |
Jun
(207) |
Jul
(134) |
Aug
(166) |
Sep
(65) |
Oct
(113) |
Nov
(248) |
Dec
(222) |
2009 |
Jan
(170) |
Feb
(163) |
Mar
(247) |
Apr
(225) |
May
(202) |
Jun
(84) |
Jul
(281) |
Aug
(138) |
Sep
(292) |
Oct
(118) |
Nov
(140) |
Dec
(278) |
2010 |
Jan
(304) |
Feb
(219) |
Mar
(110) |
Apr
(88) |
May
(94) |
Jun
(53) |
Jul
(74) |
Aug
(98) |
Sep
(63) |
Oct
(90) |
Nov
(134) |
Dec
(216) |
2011 |
Jan
(166) |
Feb
(179) |
Mar
(94) |
Apr
(82) |
May
(140) |
Jun
(141) |
Jul
(92) |
Aug
(56) |
Sep
(35) |
Oct
(38) |
Nov
(75) |
Dec
(187) |
2012 |
Jan
(96) |
Feb
(49) |
Mar
(36) |
Apr
(111) |
May
(87) |
Jun
(28) |
Jul
(40) |
Aug
(15) |
Sep
(28) |
Oct
(23) |
Nov
(18) |
Dec
(32) |
2013 |
Jan
(44) |
Feb
(53) |
Mar
(32) |
Apr
(46) |
May
(16) |
Jun
(10) |
Jul
(19) |
Aug
(31) |
Sep
(55) |
Oct
(110) |
Nov
(105) |
Dec
(108) |
2014 |
Jan
(76) |
Feb
(70) |
Mar
(59) |
Apr
(125) |
May
(28) |
Jun
(9) |
Jul
(10) |
Aug
(20) |
Sep
(34) |
Oct
(52) |
Nov
(29) |
Dec
(17) |
2015 |
Jan
(18) |
Feb
(17) |
Mar
(17) |
Apr
|
May
(1) |
Jun
(8) |
Jul
(6) |
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(2) |
2016 |
Jan
(10) |
Feb
(42) |
Mar
(65) |
Apr
(44) |
May
(23) |
Jun
(9) |
Jul
(4) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(3) |
Dec
(24) |
2017 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
1
(6) |
2
(3) |
3
(1) |
4
(2) |
5
(1) |
6
(1) |
7
(1) |
8
|
9
(1) |
10
(8) |
11
(5) |
12
(4) |
13
(3) |
14
|
15
(6) |
16
(7) |
17
(8) |
18
(11) |
19
(13) |
20
(12) |
21
(7) |
22
(10) |
23
(6) |
24
(2) |
25
(6) |
26
(19) |
27
(2) |
28
(19) |
29
(3) |
30
(2) |
31
(18) |
From: <ravna-ps@us...> - 2011-12-31 21:54:04
|
Revision: 7963 http://planeshift.svn.sourceforge.net/planeshift/?rev=7963&view=rev Author: ravna-ps Date: 2011-12-31 21:53:53 +0000 (Sat, 31 Dec 2011) Log Message: ----------- Fixed the incorrect showing of "next page" when none was possible. Changed the display of the "limit to sector + next/prev page to always show, even if there are no records found. (So one can change the parameters of the search.) Fixed a minor display bug which sometimes showed negative numbers if you inserted your own limit. Also guaranteed correct sql behavior by filtering impossible limit input. Modified Paths: -------------- www/webconsole-new/rules/pathpoints.php Modified: www/webconsole-new/rules/pathpoints.php =================================================================== --- www/webconsole-new/rules/pathpoints.php 2011-12-31 20:35:50 UTC (rev 7962) +++ www/webconsole-new/rules/pathpoints.php 2011-12-31 21:53:53 UTC (rev 7963) @@ -36,8 +36,12 @@ if (isset($_GET['limit']) && is_numeric($_GET['limit'])) { $start = $_GET['limit'] - 30; + if ($start < 0) + { + $start = 0; + } $limit = $_GET['limit']; - $query = $query . " LIMIT $start, 30"; // limit 1, 10 is offset 1, 30 records. + $query = $query . " LIMIT $start, 30"; // limit 1, 30 is offset 1, 30 records. } else { @@ -45,88 +49,88 @@ $limit = 30; } $result = mysql_query2($query); - if (mysql_numrows($result) == 0){ - echo '<p class="error">No Paths Found</p>'; + + $sid = 0; + if (isset($_GET['sector'])) + { + $sid = $_GET['sector']; } - else + $prev_lim = ($limit - 30 < 0 ? 0 : $limit - 30); + if ($limit > 30) { - $sid = 0; - if (isset($_GET['sector'])) + echo '<a href="./index.php?do=listpathpoints'; + if (isset($_GET['sort'])) { - $sid = $_GET['sector']; + echo '&sort='.$_GET['sort']; } - $prev_lim = $limit - 30; - if ($limit > 30) + echo '&limit='.$prev_lim.'&sector='.$sid.'">Previous Page</a> '; + } + echo ' - Displaying records '.$prev_lim.' through '.$limit.' - '; + $where = ($sid == 0 ? '' : " LEFT JOIN sc_waypoint_links AS wl ON p.path_id=wl.id LEFT JOIN sc_waypoints AS w ON wl.wp1=w.id WHERE w.loc_sector_id=$sid"); + $result2 = mysql_query2('SELECT COUNT(DISTINCT p.path_id) AS mylimit FROM sc_path_points AS p'.$where); + $row2 = mysql_fetch_array($result2); + if ($row2['mylimit'] > $limit) + { + echo '<a href="./index.php?do=listpathpoints'; + if (isset($_GET['sort'])) { - echo '<a href="./index.php?do=listpathpoints'; - if (isset($_GET['sort'])) - { - echo '&sort='.$_GET['sort']; - } - echo '&limit='.$prev_lim.'&sector='.$sid.'">Previous Page</a> '; + echo '&sort='.$_GET['sort']; } - echo ' - Displaying records '.$prev_lim.' through '.$limit.' - '; - $where = ($sid == 0 ? '' : " LEFT JOIN sc_waypoint_links AS wl ON p.path_id=wl.id LEFT JOIN sc_waypoints AS w ON wl.wp1=w.id WHERE w.loc_sector_id=$sid"); - $result2 = mysql_query2('select count(p.id) AS mylimit FROM sc_path_points AS p'.$where); - $row2 = mysql_fetch_array($result2); - if ($row2['mylimit'] > $limit) + $next_lim = $limit + 30; + echo '&limit='.$next_lim.'&sector='.$sid.'">Next Page</a>'; + } + $sectors = PrepSelect('sectorid'); + echo '<form action="./index.php" method="get"><input type="hidden" name="do" value="listpathpoints"/>'; + $sid = 0; + if (isset($_GET['sector'])) + { + $sid = $_GET['sector']; + } + if (isset($_GET['sort'])) + { + echo '<input type="hidden" name="sort" value="'.$_GET['sort'].'"/>'; + } + if (isset($_GET['limit'])) + { + echo '<input type="hidden" name="limit" value="'.$_GET['limit'].'"/>'; + } + echo DrawSelectBox('sectorid', $sectors, 'sector' ,$sid, true); + echo '<input type="submit" name="submit" value="Limit By Sector" /></form>'; + if (mysql_numrows($result) == 0){ + echo '<p class="error">No Paths Found</p>'; + return; + } + + echo '<table border="1">'; + echo '<tr><th><a href="./index.php?do=listpathpoints&sort=path_id&limit='.$limit.'§or='.$sid.'">Path ID</a></th>'; + echo '<th><a href="./index.php?do=listpathpoints&sort=sector&limit='.$limit.'§or='.$sid.'">Starting Sector</a></th>'; + echo '<th><a href="./index.php?do=listpathpoints&sort=wp1&limit='.$limit.'§or='.$sid.'">wp1</a></th>'; + echo '<th><a href="./index.php?do=listpathpoints&sort=wp2&limit='.$limit.'§or='.$sid.'">wp2</a></th>'; + if (checkaccess('rules','edit')) + { + echo '<th>Actions</th>'; + } + echo '</tr>'; + while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) + { + echo '<tr>'; + echo '<td>'.$row['path_id'].'</td>'; + echo '<td>'.$row['sector'].'</td>'; + echo '<td>'.$row['wp1_name'].'<br />'.$row['wp1_coords'].'</td>'; + echo '<td>'.$row['wp2_name'].'<br />'.$row['wp2_coords'].'</td>'; + if (checkaccess('rules', 'edit')) { - echo '<a href="./index.php?do=listpathpoints'; - if (isset($_GET['sort'])) + echo '<td><a href="./index.php?do=editpathpoint&path_id='.$row['path_id'].'">Edit</a>'; + if (checkaccess('rules', 'delete')) { - echo '&sort='.$_GET['sort']; + echo '<br/><a href="./index.php?do=deletepathpoint&path_id='.$row['path_id'].'">Delete</a>'; } - $next_lim = $limit + 30; - echo '&limit='.$next_lim.'&sector='.$sid.'">Next Page</a>'; + echo '</td>'; } - $sectors = PrepSelect('sectorid'); - echo '<form action="./index.php" method="get"><input type="hidden" name="do" value="listpathpoints"/>'; - $sid = 0; - if (isset($_GET['sector'])) - { - $sid = $_GET['sector']; - } - if (isset($_GET['sort'])) - { - echo '<input type="hidden" name="sort" value="'.$_GET['sort'].'"/>'; - } - if (isset($_GET['limit'])) - { - echo '<input type="hidden" name="limit" value="'.$_GET['limit'].'"/>'; - } - echo DrawSelectBox('sectorid', $sectors, 'sector' ,$sid, true); - echo '<input type="submit" name="submit" value="Limit By Sector" /></form>'; - - echo '<table border="1">'; - echo '<tr><th><a href="./index.php?do=listpathpoints&sort=path_id&limit='.$limit.'§or='.$sid.'">Path ID</a></th>'; - echo '<th><a href="./index.php?do=listpathpoints&sort=sector&limit='.$limit.'§or='.$sid.'">Starting Sector</a></th>'; - echo '<th><a href="./index.php?do=listpathpoints&sort=wp1&limit='.$limit.'§or='.$sid.'">wp1</a></th>'; - echo '<th><a href="./index.php?do=listpathpoints&sort=wp2&limit='.$limit.'§or='.$sid.'">wp2</a></th>'; - if (checkaccess('rules','edit')) - { - echo '<th>Actions</th>'; - } echo '</tr>'; - while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) - { - echo '<tr>'; - echo '<td>'.$row['path_id'].'</td>'; - echo '<td>'.$row['sector'].'</td>'; - echo '<td>'.$row['wp1_name'].'<br />'.$row['wp1_coords'].'</td>'; - echo '<td>'.$row['wp2_name'].'<br />'.$row['wp2_coords'].'</td>'; - if (checkaccess('rules', 'edit')) - { - echo '<td><a href="./index.php?do=editpathpoint&path_id='.$row['path_id'].'">Edit</a>'; - if (checkaccess('rules', 'delete')) - { - echo '<br/><a href="./index.php?do=deletepathpoint&path_id='.$row['path_id'].'">Delete</a>'; - } - echo '</td>'; - } - echo '</tr>'; - } - echo '</table>'; } + echo '</table>'; + echo '<hr/>'; } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ravna-ps@us...> - 2011-12-31 20:35:56
|
Revision: 7962 http://planeshift.svn.sourceforge.net/planeshift/?rev=7962&view=rev Author: ravna-ps Date: 2011-12-31 20:35:50 +0000 (Sat, 31 Dec 2011) Log Message: ----------- Changed edit Path Points to correctly display both waypointlink name and starting/ending waypoint names + coords Modified Paths: -------------- www/webconsole-new/rules/pathpoints.php Modified: www/webconsole-new/rules/pathpoints.php =================================================================== --- www/webconsole-new/rules/pathpoints.php 2011-12-31 17:42:06 UTC (rev 7961) +++ www/webconsole-new/rules/pathpoints.php 2011-12-31 20:35:50 UTC (rev 7962) @@ -149,7 +149,7 @@ return; } $prev_id = 0; - for($i = 0; count($_POST['id']) > $i; $i++) + for ($i = 0; count($_POST['id']) > $i; $i++) { $id = mysql_real_escape_string($_POST['id'][$i]); $x = mysql_real_escape_string($_POST['x'][$i]); @@ -219,15 +219,23 @@ mysql_query2($query); // We set the next entry to refer to the one before the deleted enty (so the chain remains unbroken). echo '<p class="error">Line successfully deleted.</p>'; } - $query = "SELECT pp.id, s.name AS sector_name, pp.prev_point, pp.x, pp.y, pp.z, pp.loc_sector_id FROM sc_path_points AS pp LEFT JOIN sectors AS s ON s.id=pp.loc_sector_id WHERE path_id='$path_id'"; + $query = "SELECT pp.id, pp.prev_point, pp.x, pp.y, pp.z, pp.loc_sector_id FROM sc_path_points AS pp LEFT JOIN sectors AS s ON s.id=pp.loc_sector_id WHERE path_id='$path_id'"; $result = mysql_query2($query); + $query2 = "SELECT wl.name, wp1.name AS wp1_name, wp2.name AS wp2_name, wp1.x AS wp1_x, wp1.y AS wp1_y, wp1.z AS wp1_z, s1.name AS wp1_sector_name, wp2.x AS wp2_x, wp2.y AS wp2_y, wp2.z AS wp2_z, s2.name AS wp2_sector_name FROM sc_waypoint_links AS wl LEFT JOIN sc_waypoints AS wp1 ON wl.wp1=wp1.id LEFT JOIN sc_waypoints AS wp2 ON wl.wp2=wp2.id LEFT JOIN sectors AS s1 ON s1.id=wp1.loc_sector_id LEFT JOIN sectors AS s2 ON s2.id=wp2.loc_sector_id WHERE wl.id='$path_id'"; + $result2 = mysql_query2($query2); + $row2 = mysql_fetch_array($result2, MYSQL_ASSOC); echo '<form action="./index.php?do=editpathpoint&path_id='.$path_id.'" method="post"><input type="hidden" name="path_id" value="'.$path_id.'" />'; - echo '<p class="header">Path Points listing for waypoint link: '.$path_id.'</p>'; - echo '<p>Please note that neither insert nor delete "remember" any other changes you make, so hit "Save Changes" first. (You can however edit multiple lines at once, and you do not need to save "delete" iteself.)</p>'; + echo '<h3 class="bold">Path Points listing for waypoint link: '.$row2['name'].' ('.$path_id.') from "'.$row2['wp1_name'].'" to "'.$row2['wp2_name'].'"</h3>'; + echo '<p>Please note that both insert and delete ignore any other changes you make, so hit "Save Changes" first. (You can however edit multiple lines at once, and you do not need to save "delete" iteself.)</p>'; echo '<table border="1">'; echo '<tr><th>Id</th><th>X</th><th>Y</th><th>Z</th><th>Sector</th><th>Actions</th></tr>'; + // list starting waypoint + echo '<tr><td>WP 1</td>'; + echo '<td>'.$row2['wp1_x'].'</td>'; + echo '<td>'.$row2['wp1_y'].'</td>'; + echo '<td>'.$row2['wp1_z'].'</td>'; + echo '<td>'.$row2['wp1_sector_name'].'</td><td><a href="./index.php?do=editpathpoint&path_id='.$path_id.'&insert=0">Insert</a></td></tr>'; $prev = 0; - $count_down = mysql_num_rows($result) - 1; $sectors = PrepSelect('sectorid'); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) // This slightly more complex loop serves to get the entries in proper order. { @@ -237,29 +245,12 @@ echo '<td><input type="hidden" name="id[]" value="-1" /></td><td><input type="text" name="x[]" value="" /></td>'; echo '<td><input type="text" name="y[]" value="" /></td>'; echo '<td><input type="text" name="z[]" value="" /></td>'; - echo '<td>'.DrawSelectBox('sectorid', $sectors, 'loc_sector_id[]', '', true).'</td></tr>'; + echo '<td>'.DrawSelectBox('sectorid', $sectors, 'loc_sector_id[]', '', true).'</td><td></td></tr>'; $insert = -1; // set it to a value that will never be encountered. } - if ($row['prev_point'] == $prev && ($prev == 0 || $count_down == 0)) // In these 2 cases we have the first and last point, they equal the position of the waypoint 1/2 in the waypoint link, and thus can not be changed. - { + if ($row['prev_point'] == $prev) { echo '<tr>'; echo '<td><input type="hidden" name="id[]" value="'.$row['id'].'" />'.$row['id'].'</td>'; - echo '<td><input type="text" name="x[]" value="'.$row['x'].'" />'.$row['x'].'</td>'; - echo '<td><input type="text" name="y[]" value="'.$row['y'].'" />'.$row['y'].'</td>'; - echo '<td><input type="text" name="z[]" value="'.$row['z'].'" />'.$row['z'].'</td>'; - echo '<td>'.DrawSelectBox('sectorid', $sectors, 'loc_sector_id[]', $row['loc_sector_id']).'</td>'; - if ($prev == 0) - { - echo '<td><a href="./index.php?do=editpathpoint&path_id='.$path_id.'&insert='.$row['id'].'">Insert</a></td>'; - } - echo '</tr>'; - $prev = $row['id']; - mysql_data_seek($result, 0); - $count_down--; - } - else if ($row['prev_point'] == $prev) { - echo '<tr>'; - echo '<td><input type="hidden" name="id[]" value="'.$row['id'].'" />'.$row['id'].'</td>'; echo '<td><input type="text" name="x[]" value="'.$row['x'].'" /></td>'; echo '<td><input type="text" name="y[]" value="'.$row['y'].'" /></td>'; echo '<td><input type="text" name="z[]" value="'.$row['z'].'" /></td>'; @@ -267,9 +258,14 @@ echo '<td><a href="./index.php?do=editpathpoint&path_id='.$path_id.'&insert='.$row['id'].'">Insert</a><br><br><a href="./index.php?do=editpathpoint&path_id='.$path_id.'&delete='.$row['id'].'">Delete</a></td></tr>'; $prev = $row['id']; mysql_data_seek($result, 0); - $count_down--; } // No else, we want the loop to continue, so else { continue; } could be done, but just a waste of space. :) } + // Display the info for the end waypoint. + echo '<tr><td>WP 2</td>'; + echo '<td>'.$row2['wp2_x'].'</td>'; + echo '<td>'.$row2['wp2_y'].'</td>'; + echo '<td>'.$row2['wp2_z'].'</td>'; + echo '<td>'.$row2['wp2_sector_name'].'</td><td></td></tr>'; echo '<tr><td colspan="6"><input type="submit" name="commit" value="Save Changes" /></td></tr>'; echo '</table></form>'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <magodra@us...> - 2011-12-31 17:42:12
|
Revision: 7961 http://planeshift.svn.sourceforge.net/planeshift/?rev=7961&view=rev Author: magodra Date: 2011-12-31 17:42:06 +0000 (Sat, 31 Dec 2011) Log Message: ----------- - Fixed reshedule of operations if interrupt perceptions cause need values to change. Modified Paths: -------------- trunk/src/npcclient/npcbehave.cpp trunk/src/server/database/mysql/sc_npctypes.sql Modified: trunk/src/npcclient/npcbehave.cpp =================================================================== --- trunk/src/npcclient/npcbehave.cpp 2011-12-31 17:40:43 UTC (rev 7960) +++ trunk/src/npcclient/npcbehave.cpp 2011-12-31 17:42:06 UTC (rev 7961) @@ -584,7 +584,7 @@ } max_need = b->NewNeed(); } - b->CommitAdvance(); // Update key to correct value + b->CommitAdvance(); // Set current need to new need. } } @@ -632,6 +632,13 @@ npc->DumpBehaviorList(); } + // If the interrupt has change the needs, try once + if (GetHighestNeed() > active->CurrentNeed()) + { + npc->Printf(3,"Need to rechedule since a new need is higest"); + continue; // Start the check once more. + } + // Run the new active behavior ScriptOperation::OperationResult result; Modified: trunk/src/server/database/mysql/sc_npctypes.sql =================================================================== --- trunk/src/server/database/mysql/sc_npctypes.sql 2011-12-31 17:40:43 UTC (rev 7960) +++ trunk/src/server/database/mysql/sc_npctypes.sql 2011-12-31 17:42:06 UTC (rev 7961) @@ -795,11 +795,12 @@ <behavior name="GoHome" resume="yes" completion_decay="-1" > <locate obj="waypoint:name:$name_home" static="no" destination="Move" /> - <percept event="local_move" /> + <percept event="global_move" /> <!-- Simulate going inside by setting invisbile --> - <wait duration="10" anim="stand" /> + <wait duration="5" anim="stand" /> <invisible/> + <wait duration="5" anim="stand" /> <rotate type="relative" value="180" ang_vel="45"/> <percept event="at_sleep" /> </behavior> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <magodra@us...> - 2011-12-31 17:40:50
|
Revision: 7960 http://planeshift.svn.sourceforge.net/planeshift/?rev=7960&view=rev Author: magodra Date: 2011-12-31 17:40:43 +0000 (Sat, 31 Dec 2011) Log Message: ----------- - Fixed waypoint filters so that start and end points isn't filtered. This allows to find _home waypoint that is PRIVATE and have movements that that filter PRIVATE. Step on your own door but not others. Modified Paths: -------------- trunk/src/common/util/pspathnetwork.cpp Modified: trunk/src/common/util/pspathnetwork.cpp =================================================================== --- trunk/src/common/util/pspathnetwork.cpp 2011-12-31 15:46:20 UTC (rev 7959) +++ trunk/src/common/util/pspathnetwork.cpp 2011-12-31 17:40:43 UTC (rev 7960) @@ -481,7 +481,8 @@ { wp = iter.Next(); - if (routeFilter->Filter(wp)) + // Filter the waypoints with exception of the start and end point. + if ((wp != start) && (wp != end) && routeFilter->Filter(wp)) { wp->excluded = true; continue; // No need to think more about this waypoint This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 15:46:26
|
Revision: 7959 http://planeshift.svn.sourceforge.net/planeshift/?rev=7959&view=rev Author: weltall2 Date: 2011-12-31 15:46:20 +0000 (Sat, 31 Dec 2011) Log Message: ----------- fixed used variable Modified Paths: -------------- trunk/src/server/bulkobjects/pscharacter.cpp Modified: trunk/src/server/bulkobjects/pscharacter.cpp =================================================================== --- trunk/src/server/bulkobjects/pscharacter.cpp 2011-12-31 15:40:28 UTC (rev 7958) +++ trunk/src/server/bulkobjects/pscharacter.cpp 2011-12-31 15:46:20 UTC (rev 7959) @@ -590,7 +590,7 @@ return false; } - if(!LoadVariables(pid)) + if(!LoadVariables(use_id)) { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ravna-ps@us...> - 2011-12-31 15:40:34
|
Revision: 7958 http://planeshift.svn.sourceforge.net/planeshift/?rev=7958&view=rev Author: ravna-ps Date: 2011-12-31 15:40:28 +0000 (Sat, 31 Dec 2011) Log Message: ----------- Fixed the creation of path points, which was adding also the start/end waypoint as part of the path, while the path should only be the part between the two. Modified Paths: -------------- www/webconsole-new/rules/pathpoints.php Modified: www/webconsole-new/rules/pathpoints.php =================================================================== --- www/webconsole-new/rules/pathpoints.php 2011-12-31 15:31:52 UTC (rev 7957) +++ www/webconsole-new/rules/pathpoints.php 2011-12-31 15:40:28 UTC (rev 7958) @@ -328,17 +328,20 @@ echo '<p class="error">Invalid Path ID</p>'; return; } + $query = "SELECT wl.name, wp1.name AS wp1_name, wp2.name AS wp2_name, wp1.x AS wp1_x, wp1.y AS wp1_y, wp1.z AS wp1_z, wp1.loc_sector_id AS wp1_loc, s1.name AS wp1_sector_name, wp2.x AS wp2_x, wp2.y AS wp2_y, wp2.z AS wp2_z, wp2.loc_sector_id AS wp2_loc, s2.name AS wp2_sector_name FROM sc_waypoint_links AS wl LEFT JOIN sc_waypoints AS wp1 ON wl.wp1=wp1.id LEFT JOIN sc_waypoints AS wp2 ON wl.wp2=wp2.id LEFT JOIN sectors AS s1 ON s1.id=wp1.loc_sector_id LEFT JOIN sectors AS s2 ON s2.id=wp2.loc_sector_id WHERE wl.id='$path_id'"; + $result = mysql_query2($query); + $row = mysql_fetch_array($result, MYSQL_ASSOC); $sectors = PrepSelect('sectorid'); - echo '<p class="bold">Create Path Point</p>'."\n"; // new path point + echo '<p class="bold">Create Path Points for waypoint link '.$row['name'].' ('.$path_id.') from "'.$row['wp1_name'].'" to "'.$row['wp2_name'].'"</p>'."\n"; // new path point echo 'If you leave any row empty, it will not be added.'; echo '<form action="./index.php?do=createpathpoint" method="post" /><table border="1">'; echo '<tr><th>X</th><th>Y</th><th>Z</th><th>Sector</th></tr>'; - // This is the first line, this time we get the data from the $_POST (unlike the first time, see the next elseif). - echo '<td><input type="hidden" name="path_id" value="'.$path_id.'" /><input type="hidden" name="x[]" value="'.$_POST['x'][0].'" />'.$_POST['x'][0].'</td>'; - echo '<td><input type="hidden" name="y[]" value="'.$_POST['y'][0].'" />'.$_POST['y'][0].'</td>'; - echo '<td><input type="hidden" name="z[]" value="'.$_POST['z'][0].'" />'.$_POST['z'][0].'</td>'; - echo '<td><input type="hidden" name="loc_sector_id[]" value="'.$_POST['loc_sector_id'][0].'" /><input type="hidden" name="wp1_name" value="'.$_POST['wp1_name'].'" />'.$_POST['wp1_name'].'</td></tr>'; - for ($i = 1; $i < count($_POST['x'])-1; $i++) // count either of the values to see how many lines there already were. Start at 1 and go to count-1 to avoid printing the first and last point again. + // This is the first line, we obtain it from sql. + echo '<td><input type="hidden" name="path_id" value="'.$path_id.'" />'.$row['wp1_x'].'</td>'; + echo '<td>'.$row['wp1_y'].'</td>'; + echo '<td>'.$row['wp1_z'].'</td>'; + echo '<td>'.$row['wp1_sector_name'].'</td></tr>'; + for ($i = 0; $i < count($_POST['x']); $i++) // count either of the values to see how many lines there already were. { echo '<tr>'; echo '<td><input type="text" name="x[]" value="'.$_POST['x'][$i].'" /></td>'; @@ -354,12 +357,11 @@ echo '<td><input type="text" name="z[]" value="" /></td>'; echo '<td>'.DrawSelectBox('sectorid', $sectors, 'loc_sector_id[]', '', true).'</td></tr>'; } - // This is the last line, this time we get the data from the $_POST (unlike the first time, see the next elseif). - $last = count($_POST['x'])-1; // get the last entry. - echo '<tr><td><input type="hidden" name="path_id" value="'.$path_id.'" /><input type="hidden" name="x[]" value="'.$_POST['x'][$last].'" />'.$_POST['x'][$last].'</td>'; - echo '<td><input type="hidden" name="y[]" value="'.$_POST['y'][$last].'" />'.$_POST['y'][$last].'</td>'; - echo '<td><input type="hidden" name="z[]" value="'.$_POST['z'][$last].'" />'.$_POST['z'][$last].'</td>'; - echo '<td><input type="hidden" name="loc_sector_id[]" value="'.$_POST['loc_sector_id'][$last].'" /><input type="hidden" name="wp2_name" value="'.$_POST['wp2_name'].'" />'.$_POST['wp2_name'].'</td></tr>'; + // This is the last line, we obtain it from sql (waypointlink). + echo '<tr><td>'.$row['wp2_x'].'</td>'; + echo '<td>'.$row['wp2_y'].'</td>'; + echo '<td>'.$row['wp2_z'].'</td>'; + echo '<td>'.$row['wp2_sector_name'].'</td></tr>'; echo '<tr><td colspan="2">Add <input type="text" name="more_fields" value="0"> more fields to this form <input type=submit name="add" value="add"/></td></tr>'; echo '<tr><td></td><td><input type=submit name="commit" value="Create Path"/></td></tr>'; echo '</table></form>'."\n"; @@ -384,19 +386,19 @@ echo '<p class="error">A path for this waypoint ('.$path_id.') already exists.</p>'; return; } + $query = "SELECT wl.name, wp1.name AS wp1_name, wp2.name AS wp2_name, wp1.x AS wp1_x, wp1.y AS wp1_y, wp1.z AS wp1_z, wp1.loc_sector_id AS wp1_loc, s1.name AS wp1_sector_name, wp2.x AS wp2_x, wp2.y AS wp2_y, wp2.z AS wp2_z, wp2.loc_sector_id AS wp2_loc, s2.name AS wp2_sector_name FROM sc_waypoint_links AS wl LEFT JOIN sc_waypoints AS wp1 ON wl.wp1=wp1.id LEFT JOIN sc_waypoints AS wp2 ON wl.wp2=wp2.id LEFT JOIN sectors AS s1 ON s1.id=wp1.loc_sector_id LEFT JOIN sectors AS s2 ON s2.id=wp2.loc_sector_id WHERE wl.id='$path_id'"; + $result = mysql_query2($query); + $row = mysql_fetch_array($result, MYSQL_ASSOC); $sectors = PrepSelect('sectorid'); - echo '<p class="bold">Create Path Point</p>'."\n"; // new path point + echo '<p class="bold">Create Path Point for: '.$row['name'].' ('.$path_id.') from "'.$row['wp1_name'].'" to "'.$row['wp2_name'].'"</p>'."\n"; // new path point echo 'If you leave any row empty, it will not be added.'; echo '<form action="./index.php?do=createpathpoint" method="post" /><table border="1">'; echo '<tr><th>X</th><th>Y</th><th>Z</th><th>Sector</th></tr>'; - $query = "SELECT wp1.x AS wp1_x, wp1.y AS wp1_y, wp1.z AS wp1_z, wp1.loc_sector_id AS wp1_loc, s1.name AS wp1_name, wp2.x AS wp2_x, wp2.y AS wp2_y, wp2.z AS wp2_z, wp2.loc_sector_id AS wp2_loc, s2.name AS wp2_name FROM sc_waypoint_links AS wl LEFT JOIN sc_waypoints AS wp1 ON wl.wp1=wp1.id LEFT JOIN sc_waypoints AS wp2 ON wl.wp2=wp2.id LEFT JOIN sectors AS s1 ON s1.id=wp1.loc_sector_id LEFT JOIN sectors AS s2 ON s2.id=wp2.loc_sector_id WHERE wl.id='$path_id'"; - $result = mysql_query2($query); - $row = mysql_fetch_array($result, MYSQL_ASSOC); // This is the first line, get data from the waypoint link (sql), to obtain x/y/z for wp1. - echo '<td><input type="hidden" name="path_id" value="'.$path_id.'" /><input type="hidden" name="x[]" value="'.$row['wp1_x'].'" />'.$row['wp1_x'].'</td>'; - echo '<td><input type="hidden" name="y[]" value="'.$row['wp1_y'].'" />'.$row['wp1_y'].'</td>'; - echo '<td><input type="hidden" name="z[]" value="'.$row['wp1_z'].'" />'.$row['wp1_z'].'</td>'; - echo '<td><input type="hidden" name="loc_sector_id[]" value="'.$row['wp1_loc'].'" /><input type="hidden" name="wp1_name" value="'.$row['wp1_name'].'" />'.$row['wp1_name'].'</td></tr>'; + echo '<td><input type="hidden" name="path_id" value="'.$path_id.'" />'.$row['wp1_x'].'</td>'; + echo '<td>'.$row['wp1_y'].'</td>'; + echo '<td>'.$row['wp1_z'].'</td>'; + echo '<td>'.$row['wp1_sector_name'].'</td></tr>'; for ($i = 0; $i < 3; $i++) // form wasn't used before, show 3 rows to give the user some space. { echo '<tr>'; @@ -406,10 +408,10 @@ echo '<td>'.DrawSelectBox('sectorid', $sectors, 'loc_sector_id[]', '', true).'</td></tr>'; } // This is the last line, get data from the waypoint link (sql), to obtain x/y/z for wp2. - echo '<tr><td><input type="hidden" name="path_id" value="'.$path_id.'" /><input type="hidden" name="x[]" value="'.$row['wp2_x'].'" />'.$row['wp2_x'].'</td>'; - echo '<td><input type="hidden" name="y[]" value="'.$row['wp2_y'].'" />'.$row['wp2_y'].'</td>'; - echo '<td><input type="hidden" name="z[]" value="'.$row['wp2_z'].'" />'.$row['wp2_z'].'</td>'; - echo '<td><input type="hidden" name="loc_sector_id[]" value="'.$row['wp2_loc'].'" /><input type="hidden" name="wp2_name" value="'.$row['wp2_name'].'" />'.$row['wp2_name'].'</td></tr>'; + echo '<tr><td>'.$row['wp2_x'].'</td>'; + echo '<td>'.$row['wp2_y'].'</td>'; + echo '<td>'.$row['wp2_z'].'</td>'; + echo '<td>'.$row['wp2_sector_name'].'</td></tr>'; echo '<tr><td colspan="2">Add <input type="text" name="more_fields" value="0"> more fields to this form <input type=submit name="add" value="add"/></td></tr>'; echo '<tr><td></td><td><input type=submit name="commit" value="Create Path"/></td></tr>'; echo '</table></form>'."\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 15:31:58
|
Revision: 7957 http://planeshift.svn.sourceforge.net/planeshift/?rev=7957&view=rev Author: weltall2 Date: 2011-12-31 15:31:52 +0000 (Sat, 31 Dec 2011) Log Message: ----------- avoid some function calls Modified Paths: -------------- trunk/src/npcclient/npcbehave.cpp Modified: trunk/src/npcclient/npcbehave.cpp =================================================================== --- trunk/src/npcclient/npcbehave.cpp 2011-12-31 14:43:28 UTC (rev 7956) +++ trunk/src/npcclient/npcbehave.cpp 2011-12-31 15:31:52 UTC (rev 7957) @@ -1462,6 +1462,8 @@ iMovable* npcMovable = pcmesh->GetMesh()->GetMovable(); + iSectorList *npcSectors = npcMovable->GetSectors(); + pos = npcMovable->GetPosition(); // rotation @@ -1473,9 +1475,9 @@ } // Sector - if (npcMovable->GetSectors()->GetCount()) + if (npcSectors->GetCount()) { - sector = npcMovable->GetSectors()->Get(0); + sector = npcSectors->Get(0); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <magodra@us...> - 2011-12-31 14:43:34
|
Revision: 7956 http://planeshift.svn.sourceforge.net/planeshift/?rev=7956&view=rev Author: magodra Date: 2011-12-31 14:43:28 +0000 (Sat, 31 Dec 2011) Log Message: ----------- - Removed unused variable. Modified Paths: -------------- trunk/src/npcclient/npcbehave.cpp Modified: trunk/src/npcclient/npcbehave.cpp =================================================================== --- trunk/src/npcclient/npcbehave.cpp 2011-12-31 14:36:29 UTC (rev 7955) +++ trunk/src/npcclient/npcbehave.cpp 2011-12-31 14:43:28 UTC (rev 7956) @@ -558,7 +558,6 @@ while (true) { float max_need = -999.0; - bool behaviours_changed = false; // Go through and update needs based on time for (size_t i=0; i<behaviors.GetSize(); i++) @@ -582,7 +581,6 @@ { behaviors[i] = behaviors[0]; behaviors[0] = b; // now highest need is elem 0 - behaviours_changed = true; } max_need = b->NewNeed(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <magodra@us...> - 2011-12-31 14:36:36
|
Revision: 7955 http://planeshift.svn.sourceforge.net/planeshift/?rev=7955&view=rev Author: magodra Date: 2011-12-31 14:36:29 +0000 (Sat, 31 Dec 2011) Log Message: ----------- - Added automatic hide/show on /path reload - Made all the waypoint/path updates iterate all displaying clients. Should allow for more than one to edit/view changes in same sector. NB! psEffects dosn't have sector so don't display in multiple sectors with warping protals. Modified Paths: -------------- trunk/src/server/adminmanager.cpp trunk/src/server/adminmanager.h trunk/src/server/client.cpp trunk/src/server/client.h trunk/src/server/database/mysql/sc_npctypes.sql Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2011-12-31 12:34:21 UTC (rev 7954) +++ trunk/src/server/adminmanager.cpp 2011-12-31 14:36:29 UTC (rev 7955) @@ -3633,7 +3633,7 @@ if(IsHelp(words[1])) return; - if(words.GetCount() >= index && subCommandList.IsSubCommand(words[index])) + if(words.GetCount() > index && subCommandList.IsSubCommand(words[index])) { subCmd = words[index++]; } @@ -3647,7 +3647,7 @@ } } - if(words.GetCount() >= index) + if(words.GetCount() > index) { ParseError(me, "Too many arguments"); } @@ -5910,8 +5910,230 @@ return psserver->GetCacheManager()->NextEffectUID(); } +void AdminManager::HideAllPaths(bool clearSelected) +{ + ClientIterator i(*clients); + while(i.HasNext()) + { + Client *client = i.Next(); + // Cleare selected while we are iterating over the clients. + if (clearSelected) + { + client->PathSetPath(NULL); + } + if (client->PathIsDisplaying()) + { + HidePaths(client); + } + if (client->WaypointIsDisplaying()) + { + HideWaypoints(client); + } + } +} + +void AdminManager::HidePaths(Client* client) +{ + if (client->PathIsDisplaying()) + { + csList<iSector*>::Iterator iter = client->GetPathDisplaying(); + while (iter.HasNext()) + { + iSector* sector = iter.Next(); + HidePaths(client, sector); + } + } +} + +void AdminManager::HideWaypoints(Client* client) +{ + if (client->WaypointIsDisplaying()) + { + csList<iSector*>::Iterator iter = client->GetWaypointDisplaying(); + while (iter.HasNext()) + { + iSector* sector = iter.Next(); + HideWaypoints(client, sector); + } + } +} + +void AdminManager::HidePaths(Client* client, iSector* sector) +{ + csList<psPathPoint*> list; + if (pathNetwork->FindPointsInSector(sector,list)) + { + csList<psPathPoint*>::Iterator iter(list); + while (iter.HasNext()) + { + psPathPoint* point = iter.Next(); + + // Don't send enpoints of paths + if (!point->GetWaypoint()) + { + psStopEffectMessage msg(client->GetClientNum(), point->GetEffectID(this)); + msg.SendMessage(); + } + + } + } +} + +void AdminManager::HideWaypoints(Client* client, iSector* sector) +{ + csList<Waypoint*> list; + if (pathNetwork->FindWaypointsInSector(sector,list)) + { + csList<Waypoint*>::Iterator iter(list); + while (iter.HasNext()) + { + Waypoint* waypoint = iter.Next(); + psStopEffectMessage msg(client->GetClientNum(), waypoint->GetEffectID(this)); + msg.SendMessage(); + } + } +} + + +void AdminManager::RedisplayAllPaths() +{ + ClientIterator i(*clients); + while(i.HasNext()) + { + Client* client = i.Next(); + + if (client->PathIsDisplaying()) + { + ShowPaths(client); + } + if (client->WaypointIsDisplaying()) + { + ShowWaypoints(client); + } + + } +} + +void AdminManager::ShowPaths(Client* client) +{ + if (client->PathIsDisplaying()) + { + csList<iSector*>::Iterator iter = client->GetPathDisplaying(); + while (iter.HasNext()) + { + iSector* sector = iter.Next(); + ShowPaths(client, sector); + } + } +} + +void AdminManager::ShowWaypoints(Client* client) +{ + if (client->WaypointIsDisplaying()) + { + csList<iSector*>::Iterator iter = client->GetWaypointDisplaying(); + while (iter.HasNext()) + { + iSector* sector = iter.Next(); + ShowWaypoints(client, sector); + } + } +} + +void AdminManager::ShowPaths(Client* client, iSector* sector) +{ + csList<psPathPoint*> list; + if (pathNetwork->FindPointsInSector(sector,list)) + { + csList<psPathPoint*>::Iterator iter(list); + while (iter.HasNext()) + { + psPathPoint* point = iter.Next(); + + // Don't send enpoints of paths + if (!point->GetWaypoint()) + { + psEffectMessage msg(client->GetClientNum(),"admin_path_point", + point->GetPosition(),0,0,point->GetEffectID(this),point->GetRadius()); + msg.SendMessage(); + } + + } + + } +} + +void AdminManager::ShowWaypoints(Client* client, iSector* sector) +{ + csList<Waypoint*> list; + if (pathNetwork->FindWaypointsInSector(sector,list)) + { + csList<Waypoint*>::Iterator iter(list); + while (iter.HasNext()) + { + Waypoint* waypoint = iter.Next(); + + psEffectMessage msg(client->GetClientNum(),"admin_waypoint", + waypoint->GetPosition(),0,0,waypoint->GetEffectID(this),waypoint->GetRadius()); + msg.SendMessage(); + } + } +} + +void AdminManager::UpdateDisplayPath(psPathPoint* point) +{ + ClientIterator i(*clients); + while(i.HasNext()) + { + Client* client = i.Next(); + + if (client->PathIsDisplaying()) + { + csList<iSector*>::Iterator iter = client->GetPathDisplaying(); + while (iter.HasNext()) + { + iSector* sector = iter.Next(); + + // Hide + psStopEffectMessage hide(client->GetClientNum(), point->GetEffectID(this)); + hide.SendMessage(); + // Display + psEffectMessage show(client->GetClientNum(),"admin_path_point",point->GetPosition(),0,0,point->GetEffectID(this),point->GetRadius()); + show.SendMessage(); + } + } + } +} + +void AdminManager::UpdateDisplayWaypoint(Waypoint* wp) +{ + ClientIterator i(*clients); + while(i.HasNext()) + { + Client* client = i.Next(); + + if (client->WaypointIsDisplaying()) + { + csList<iSector*>::Iterator iter = client->GetWaypointDisplaying(); + while (iter.HasNext()) + { + iSector* sector = iter.Next(); + + // Hide + psStopEffectMessage hide(client->GetClientNum(), wp->GetEffectID(this)); + hide.SendMessage(); + // Display + // TODO: Include sector in psEffectMessage + psEffectMessage show(client->GetClientNum(),"admin_waypoint",wp->GetPosition(),0,0, + wp->GetEffectID(this),wp->GetRadius()); + show.SendMessage(); + } + } + } +} + void AdminManager::HandlePath(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* cmddata, Client *client) { AdminCmdDataPath* data = dynamic_cast<AdminCmdDataPath*>(cmddata); @@ -5955,18 +6177,7 @@ { if (wp->Adjust(db,myPos,mySectorName)) { - if (client->WaypointIsDisplaying()) - { - // Move the displayed waypoint - - // Hide - psStopEffectMessage hide(me->clientnum, wp->GetEffectID(this)); - hide.SendMessage(); - // Display - psEffectMessage show(me->clientnum,"admin_waypoint",myPos,0,0,wp->GetEffectID(this),wp->GetRadius()); - show.SendMessage(); - } - + UpdateDisplayWaypoint(wp); psserver->SendSystemInfo(me->clientnum, "Adjusted waypoint %s(%d) at range %.2f", wp->GetName(), wp->GetID(), rangeWP); @@ -5976,16 +6187,7 @@ { if (pathPoint->Adjust(db,indexPoint,myPos,mySectorName)) { - if (client->PathIsDisplaying()) - { - // Hide - psStopEffectMessage hide(me->clientnum, point->GetEffectID(this)); - hide.SendMessage(); - // Display - psEffectMessage show(me->clientnum,"admin_path_point",myPos,0,0,point->GetEffectID(this),point->GetRadius()); - show.SendMessage(); - } - + UpdateDisplayPath(point); psserver->SendSystemInfo(me->clientnum, "Adjusted point(%d) %d of path %s(%d) at range %.2f", point->GetID(),indexPoint,path->GetName(),path->GetID(),rangePoint); @@ -6130,18 +6332,7 @@ { wp->RecalculateEdges(EntityManager::GetSingleton().GetWorld(),EntityManager::GetSingleton().GetEngine()); - - if (client->WaypointIsDisplaying()) - { - // Hide - psStopEffectMessage hide(me->clientnum, wp->GetEffectID(this)); - hide.SendMessage(); - // Display - psEffectMessage show(me->clientnum,"admin_waypoint",wp->GetPosition(),0,0, - wp->GetEffectID(this),wp->GetRadius()); - show.SendMessage(); - } - + UpdateDisplayWaypoint(wp); psserver->SendSystemInfo(me->clientnum, "Waypoint %s updated with new radius %.3f.", wp->GetName(),wp->GetRadius()); return; @@ -6171,12 +6362,7 @@ psPathPoint* point = path->AddPoint(db, myPos, mySectorName); - if (client->PathIsDisplaying()) - { - psEffectMessage msg(me->clientnum,"admin_path_point",myPos,0,0,point->GetEffectID(this)); - msg.SendMessage(); - } - + UpdateDisplayPath(point); psserver->SendSystemInfo( me->clientnum, "Added point."); } @@ -6234,12 +6420,7 @@ } - if (client->PathIsDisplaying()) - { - psEffectMessage msg(me->clientnum,"admin_path_point",myPos,0,0,newPoint->GetEffectID(this)); - msg.SendMessage(); - } - + UpdateDisplayPath(newPoint); psserver->SendSystemInfo( me->clientnum, "Inserted point."); } else if (data->subCmd == "start") @@ -6288,17 +6469,7 @@ wp = pathNetwork->CreateWaypoint(wpName,myPos,mySectorName,data->radius,data->flagName); - if (client->WaypointIsDisplaying()) - { - // Move the displayed waypoint - - // Hide - psStopEffectMessage hide(me->clientnum, wp->GetEffectID(this)); - hide.SendMessage(); - // Display - psEffectMessage show(me->clientnum,"admin_waypoint",myPos,0,0,wp->GetEffectID(this),wp->GetRadius()); - show.SendMessage(); - } + UpdateDisplayWaypoint(wp); psserver->SendSystemInfo( me->clientnum, "Starting path, using new waypoint %s(%d)", wp->GetName(), wp->GetID()); } @@ -6356,11 +6527,7 @@ wp = pathNetwork->CreateWaypoint(wpName,myPos,mySectorName,data->radius,data->waypointFlags); - if (client->WaypointIsDisplaying()) - { - psEffectMessage msg(me->clientnum,"admin_waypoint",myPos,0,0,wp->GetEffectID(this),wp->GetRadius()); - msg.SendMessage(); - } + UpdateDisplayWaypoint(wp); } client->PathSetPath(NULL); @@ -6381,46 +6548,16 @@ { if (data->cmdTarget.IsEmpty() || data->cmdTarget == 'P') { - csList<psPathPoint*> list; - if (pathNetwork->FindPointsInSector(mySector,list)) - { - csList<psPathPoint*>::Iterator iter(list); - while (iter.HasNext()) - { - psPathPoint* point = iter.Next(); + ShowPaths(client,mySector); - // Don't send enpoints of paths - if (!point->GetWaypoint()) - { - psEffectMessage msg(me->clientnum,"admin_path_point", - point->GetPosition(),0,0,point->GetEffectID(this),point->GetRadius()); - msg.SendMessage(); - } - - } - - } - - client->PathSetIsDisplaying(true); + client->PathSetIsDisplaying(mySector); psserver->SendSystemInfo(me->clientnum, "Displaying all path points in sector %s",mySectorName.GetDataSafe()); } if (data->cmdTarget.IsEmpty() || data->cmdTarget == 'W') { - csList<Waypoint*> list; - if (pathNetwork->FindWaypointsInSector(mySector,list)) - { - csList<Waypoint*>::Iterator iter(list); - while (iter.HasNext()) - { - Waypoint* waypoint = iter.Next(); - - psEffectMessage msg(me->clientnum,"admin_waypoint", - waypoint->GetPosition(),0,0,waypoint->GetEffectID(this),waypoint->GetRadius()); - msg.SendMessage(); - } - } + ShowWaypoints(client, mySector); - client->WaypointSetIsDisplaying(true); + client->WaypointSetIsDisplaying(mySector); psserver->SendSystemInfo(me->clientnum, "Displaying all waypoints in sector %s",mySectorName.GetDataSafe()); } } @@ -6428,41 +6565,16 @@ { if (data->cmdTarget.IsEmpty() || data->cmdTarget == 'P') { - csList<psPathPoint*> list; - if (pathNetwork->FindPointsInSector(mySector,list)) - { - csList<psPathPoint*>::Iterator iter(list); - while (iter.HasNext()) - { - psPathPoint* point = iter.Next(); + HidePaths(client); - // Don't send enpoints of paths - if (!point->GetWaypoint()) - { - psStopEffectMessage msg(me->clientnum, point->GetEffectID(this)); - msg.SendMessage(); - } - - } - } - client->PathSetIsDisplaying(false); + client->PathClearDisplaying(); psserver->SendSystemInfo(me->clientnum, "All path points hidden"); } if (data->cmdTarget.IsEmpty() || data->cmdTarget == "W") { - csList<Waypoint*> list; - if (pathNetwork->FindWaypointsInSector(mySector,list)) - { - csList<Waypoint*>::Iterator iter(list); - while (iter.HasNext()) - { - Waypoint* waypoint = iter.Next(); - psStopEffectMessage msg(me->clientnum, waypoint->GetEffectID(this)); - msg.SendMessage(); - } - - } - client->WaypointSetIsDisplaying(false); + HideWaypoints(client); + + client->WaypointClearDisplaying(); psserver->SendSystemInfo(me->clientnum, "All waypoints hidden"); } } @@ -6570,16 +6682,8 @@ { if (wp->Adjust(db,myPos,mySectorName)) { - if (client->WaypointIsDisplaying()) - { - // Hide - psStopEffectMessage hide(me->clientnum, wp->GetEffectID(this)); - hide.SendMessage(); - // Display - psEffectMessage show(me->clientnum,"admin_waypoint",myPos,0,0,wp->GetEffectID(this),wp->GetRadius()); - show.SendMessage(); - } + UpdateDisplayWaypoint(wp); psserver->SendSystemInfo(me->clientnum, "Moved waypoint %s(%d)", wp->GetName(), wp->GetID()); @@ -6617,16 +6721,7 @@ { if (point->Adjust(db,myPos,mySectorName)) { - if (client->PathIsDisplaying()) - { - // Hide - psStopEffectMessage hide(me->clientnum, point->GetEffectID(this)); - hide.SendMessage(); - // Show - psEffectMessage show(me->clientnum,"admin_path_point",myPos,0,0,point->GetEffectID(this),point->GetRadius()); - show.SendMessage(); - } - + UpdateDisplayPath(point); psserver->SendSystemInfo(me->clientnum, "Adjusted point(%d)", point->GetID()); @@ -6687,11 +6782,7 @@ { return; } - if (client->WaypointIsDisplaying()) - { - psEffectMessage msg(me->clientnum,"admin_waypoint",myPos,0,0,wp->GetEffectID(this),wp->GetRadius()); - msg.SendMessage(); - } + UpdateDisplayWaypoint(wp); psPath * path1 = pathNetwork->CreatePath("",path->start,wp, "" ); psPath * path2 = pathNetwork->CreatePath("",wp,path->end, "" ); @@ -11457,10 +11548,15 @@ } else if(data->subCmd == "path") { + HideAllPaths(true); // And cleare Selected Paths + delete pathNetwork; pathNetwork = new psPathNetwork(); pathNetwork->Load(EntityManager::GetSingleton().GetEngine(),db, EntityManager::GetSingleton().GetWorld()); + + RedisplayAllPaths(); + psserver->SendSystemOK(client->GetClientNum(), "Successfully reloaded path network."); } Modified: trunk/src/server/adminmanager.h =================================================================== --- trunk/src/server/adminmanager.h 2011-12-31 12:34:21 UTC (rev 7954) +++ trunk/src/server/adminmanager.h 2011-12-31 14:36:29 UTC (rev 7955) @@ -3506,7 +3506,68 @@ /** Implement the abstract function from the iEffectIDAllocator */ virtual uint32_t GetEffectID(); + + /** @brif Hide all paths for all clients + * @param clearSelected Clear selected path when iterating. + */ + void HideAllPaths(bool clearSelected); + /** @brif Hide all paths for a client + * @param client The client to hide paths for. + */ + void HidePaths(Client* client); + + /** @brif Hide all waypoints for a client + * @param client The client to hide waypoints for. + */ + void HideWaypoints(Client* client); + + /** @brif Hide all paths for a client in a sector + * @param client The client to hide paths for. + * @param sector The sector to hide paths in. + */ + void HidePaths(Client* client, iSector* sector); + + /** @brif Hide all waypoints for a client in a sector. + * @param client The client ot hide waypoints for. + * @param sector The sector to hide paths in. + */ + void HideWaypoints(Client* client, iSector* sector); + + /** @brif Show paths and waypoints for all clients that have enabled display. + */ + void RedisplayAllPaths(); + + /** @brif Show paths for client in all sectors that has been enabled. + * @param client The client to show paths for. + */ + void ShowPaths(Client* client); + + /** @brif Show waypoint for client in all sectors that has been enabled. + * @param client The client to show waypoints for. + */ + void ShowWaypoints(Client* client); + + /** @brif Show path for a client in a given sector. + * @param client The client to show paths for. + * @param sector The sector to show paths in. + */ + void ShowPaths(Client* client, iSector* sector); + + /** @brif Show waypoints for a client in a given sector. + * @param client The client to show waypoints for. + * @param sector The sector to show paths in. + */ + void ShowWaypoints(Client* client, iSector* sector); + + /** @brif Update the display of paths in clients. + */ + void UpdateDisplayPath(psPathPoint* point); + + /** @brif Update the display of waypoints in clients. + */ + void UpdateDisplayWaypoint(Waypoint* wp); + /** @brief Handle online path editing. * @param me The incoming message from the GM * @param msg The cracked command message. Modified: trunk/src/server/client.cpp =================================================================== --- trunk/src/server/client.cpp 2011-12-31 12:34:21 UTC (rev 7954) +++ trunk/src/server/client.cpp 2011-12-31 14:36:29 UTC (rev 7955) @@ -55,8 +55,7 @@ Client::Client () : accumulatedLag(0), zombie(false), allowedToDisconnect(true), ready(false), accountID(0), playerID(0), securityLevel(0), superclient(false), - name(""), waypointEffectID(0), waypointIsDisplaying(false), - pathEffectID(0), pathPath(NULL), pathIsDisplaying(false), + name(""), waypointEffectID(0), pathEffectID(0), pathPath(NULL), locationEffectID(0), locationIsDisplaying(false),cheatMask(NO_CHEAT) { actor = 0; @@ -474,6 +473,50 @@ spamPoints, advisorPoints, accountID.Unbox()); } +void Client::PathSetIsDisplaying( iSector* sector ) +{ + pathDisplaySectors.PushBack(sector); +} + +void Client::PathClearDisplaying() +{ + pathDisplaySectors.DeleteAll(); +} + +csList<iSector*>::Iterator Client::GetPathDisplaying() +{ + return csList<iSector*>::Iterator(pathDisplaySectors); +} + +bool Client::PathIsDisplaying() +{ + return !pathDisplaySectors.IsEmpty(); +} + + +void Client::WaypointSetIsDisplaying( iSector* sector ) +{ + waypointDisplaySectors.PushBack(sector); +} + +void Client::WaypointClearDisplaying() +{ + waypointDisplaySectors.DeleteAll(); +} + +csList<iSector*>::Iterator Client::GetWaypointDisplaying() +{ + return csList<iSector*>::Iterator(waypointDisplaySectors); +} + + +bool Client::WaypointIsDisplaying() +{ + return !waypointDisplaySectors.IsEmpty(); +} + + + uint32_t Client::LocationGetEffectID() { if (locationEffectID == 0) Modified: trunk/src/server/client.h =================================================================== --- trunk/src/server/client.h 2011-12-31 12:34:21 UTC (rev 7954) +++ trunk/src/server/client.h 2011-12-31 14:36:29 UTC (rev 7955) @@ -352,11 +352,15 @@ psPath * PathGetPath() { return pathPath; } void PathSetPath(psPath * path) { pathPath = path; } - void PathSetIsDisplaying( bool displaying ) { pathIsDisplaying = displaying; } - bool PathIsDisplaying() { return pathIsDisplaying; } + void PathSetIsDisplaying( iSector* sector ); + void PathClearDisplaying(); + csList<iSector*>::Iterator GetPathDisplaying(); + bool PathIsDisplaying(); - void WaypointSetIsDisplaying( bool displaying ) { waypointIsDisplaying = displaying; } - bool WaypointIsDisplaying() { return waypointIsDisplaying; } + void WaypointSetIsDisplaying( iSector* sector ); + void WaypointClearDisplaying(); + csList<iSector*>::Iterator GetWaypointDisplaying(); + bool WaypointIsDisplaying(); /// Online edit of location @@ -448,12 +452,16 @@ // Path edit global vars for client csString waypointPathName; int waypointPathIndex; + uint32_t waypointEffectID; - bool waypointIsDisplaying; uint32_t pathEffectID; + psPath *pathPath; - bool pathIsDisplaying; + + csList<iSector*> waypointDisplaySectors; + csList<iSector*> pathDisplaySectors; + // Location edit global vars for client uint32_t locationEffectID; bool locationIsDisplaying; Modified: trunk/src/server/database/mysql/sc_npctypes.sql =================================================================== --- trunk/src/server/database/mysql/sc_npctypes.sql 2011-12-31 12:34:21 UTC (rev 7954) +++ trunk/src/server/database/mysql/sc_npctypes.sql 2011-12-31 14:36:29 UTC (rev 7955) @@ -216,6 +216,13 @@ <navigate anim="walk" failure="move_failed" /> </behavior> +<!-- Global movement with use of waypoint navigation --> +<behavior name="GlobalMove" complection_decay="-1" resume="yes" failure="move_failed" > + <!-- Find the target and move there --> + <copy_locate source="Move" destination="Active" /> + <wander anim="walk" private="false" failure="move_failed" /> +</behavior> + <!-- Local movement without the waypoint navigation --> <behavior name="LocalMove" complection_decay="-1" resume="yes" failure="move_failed" > <!-- Find the final target and move there --> @@ -225,6 +232,7 @@ <react event="move" behavior="Move" /> <react event="local_move" behavior="LocalMove" /> +<react event="global_move" behavior="GlobalMove" /> <react event="move_failed" behavior="MoveFailed" />'); @@ -765,29 +773,48 @@ </behavior>'); -INSERT INTO sc_npctypes VALUES("117","MoveTest5","Answerer","","$walk","","","","", +INSERT INTO sc_npctypes VALUES("117","MoveTest5","Answerer,Move","","$walk","","","","", '<!-- Example Citizen behaviour --> -<behavior name="GoHome" decay="0" growth="0" initial="0"> - <locate obj="waypoint" static="no" /> <!-- Locate nearest waypoint --> - <navigate anim="walk" /> <!-- Local navigation --> +<!-- Go find nearest waypoint at startup --> +<behavior name="Initialize" resume="yes" completion_decay="-1" initial="1000"> + <locate obj="waypoint" static="no" destination="Move" /> + <percept event="local_move" /> +</behavior> - <locate obj="waypoint:name:$name_home" static="no" /> - <wander anim="walk" /> <!-- Navigate using waypoints --> +<!-- Create a behavior that cause the npc to go visible when going from home --> +<behavior name="WokenFromSleep" completion_decay="-1" > + <visible/> +</behavior> + +<behavior name="AtSleep" loop="yes" completion_decay="-1" interrupt="woken_from_sleep" > + <loop> + <wait duration="10.0" /> + </loop> +</behavior> + +<behavior name="GoHome" resume="yes" completion_decay="-1" > + <locate obj="waypoint:name:$name_home" static="no" destination="Move" /> + <percept event="local_move" /> + <!-- Simulate going inside by setting invisbile --> <wait duration="10" anim="stand" /> <invisible/> - <wait duration="30" anim="stand" /> - <visible/> + <rotate type="relative" value="180" ang_vel="45"/> + <percept event="at_sleep" /> </behavior> +<react event="GoHome" behavior="GoHome" /> -<behavior name="GoWork" decay="0" growth="0" initial="0"> - <locate obj="waypoint" static="no" /> <!-- Locate nearest waypoint --> - <navigate anim="walk" /> <!-- Local navigation --> +<react event="at_sleep" behavior="AtSleep" /> +<react event="woken_from_sleep" behavior="AtSleep" absolute="0" /> +<react event="woken_from_sleep" behavior="WokenFromSleep" /> - <locate obj="waypoint:name:$name_work" static="no" /> - <wander anim="walk" /> <!-- Navigate using waypoints --> +<behavior name="GoWork" resume="yes" completion_decay="-1" > + <locate obj="waypoint:name:$name_work" static="no" destination="Move" /> + <percept event="global_move" /> + <rotate type="relative" value="180" ang_vel="45"/> </behavior> +<react event="GoWork" behavior="GoWork" /> <react event="time" value="0,0,,," random=",5,,," behavior="GoWork" /> <react event="time" value="1,0,,," random=",5,,," behavior="GoHome" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 12:34:27
|
Revision: 7954 http://planeshift.svn.sourceforge.net/planeshift/?rev=7954&view=rev Author: weltall2 Date: 2011-12-31 12:34:21 +0000 (Sat, 31 Dec 2011) Log Message: ----------- missing plus Modified Paths: -------------- trunk/src/server/adminmanager.cpp Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2011-12-31 12:33:25 UTC (rev 7953) +++ trunk/src/server/adminmanager.cpp 2011-12-31 12:34:21 UTC (rev 7954) @@ -3657,7 +3657,7 @@ csString AdminCmdDataReload::GetHelpMessage() { - return "Syntax: \"" + command + " " + subCommandList.GetHelpMessage() "\""; + return "Syntax: \"" + command + " " + subCommandList.GetHelpMessage() + "\""; } AdminCmdDataListWarnings::AdminCmdDataListWarnings(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 12:33:31
|
Revision: 7953 http://planeshift.svn.sourceforge.net/planeshift/?rev=7953&view=rev Author: weltall2 Date: 2011-12-31 12:33:25 +0000 (Sat, 31 Dec 2011) Log Message: ----------- improved a bit parsing and output of /reload Modified Paths: -------------- trunk/src/server/adminmanager.cpp trunk/src/server/adminmanager.h Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2011-12-31 11:34:10 UTC (rev 7952) +++ trunk/src/server/adminmanager.cpp 2011-12-31 12:33:25 UTC (rev 7953) @@ -3622,24 +3622,34 @@ AdminCmdDataReload::AdminCmdDataReload(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words) : AdminCmdData("/reload"), itemID(0) { + subCommandList.Push("item","<itemID> - reloads the specified item"); + subCommandList.Push("serveroptions","#Reload all the server options"); + subCommandList.Push("mathscript","#Reload all the mathscripts"); + subCommandList.Push("path","#Reload all the path data"); + size_t index = 1; // when help is requested, return immediate - if (IsHelp(words[1])) + if(IsHelp(words[1])) return; - subCmd = words[index++]; - if (subCmd == "item") + if(words.GetCount() >= index && subCommandList.IsSubCommand(words[index])) { + subCmd = words[index++]; + } + + if(subCmd == "item") + { itemID = words.GetInt(index++); if (itemID == 0) { ParseError(me, "Missing or invalid item id"); } } - else if(subCmd != "serveroptions" && subCmd != "mathscript" && subCmd != "path") + + if(words.GetCount() >= index) { - ParseError(me,"Not a valid subcommand: " + subCmd); + ParseError(me, "Too many arguments"); } } @@ -3647,7 +3657,7 @@ csString AdminCmdDataReload::GetHelpMessage() { - return "Syntax: \"" + command + " item <itemID>/script/serveroptions/mathscript/path\""; + return "Syntax: \"" + command + " " + subCommandList.GetHelpMessage() "\""; } AdminCmdDataListWarnings::AdminCmdDataListWarnings(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words) Modified: trunk/src/server/adminmanager.h =================================================================== --- trunk/src/server/adminmanager.h 2011-12-31 11:34:10 UTC (rev 7952) +++ trunk/src/server/adminmanager.h 2011-12-31 12:33:25 UTC (rev 7953) @@ -2566,8 +2566,9 @@ class AdminCmdDataReload : public AdminCmdData { public: - csString subCmd; ///< sub command (item) + csString subCmd; ///< sub command int itemID; ///< item id + AdminCmdSubCommandParser subCommandList; ///< list of subcommands /** @brief Creates obj for specified command that reloads item stats. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 11:34:16
|
Revision: 7952 http://planeshift.svn.sourceforge.net/planeshift/?rev=7952&view=rev Author: weltall2 Date: 2011-12-31 11:34:10 +0000 (Sat, 31 Dec 2011) Log Message: ----------- fixed messages Modified Paths: -------------- trunk/src/server/adminmanager.cpp Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2011-12-31 08:40:25 UTC (rev 7951) +++ trunk/src/server/adminmanager.cpp 2011-12-31 11:34:10 UTC (rev 7952) @@ -3647,7 +3647,7 @@ csString AdminCmdDataReload::GetHelpMessage() { - return "Syntax: \"" + command + " item <itemID>/script/serveroptions\""; + return "Syntax: \"" + command + " item <itemID>/script/serveroptions/mathscript/path\""; } AdminCmdDataListWarnings::AdminCmdDataListWarnings(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words) @@ -11451,7 +11451,7 @@ pathNetwork = new psPathNetwork(); pathNetwork->Load(EntityManager::GetSingleton().GetEngine(),db, EntityManager::GetSingleton().GetWorld()); - psserver->SendSystemOK(client->GetClientNum(), "Successfully reloaded math scripts."); + psserver->SendSystemOK(client->GetClientNum(), "Successfully reloaded path network."); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 08:40:31
|
Revision: 7951 http://planeshift.svn.sourceforge.net/planeshift/?rev=7951&view=rev Author: weltall2 Date: 2011-12-31 08:40:25 +0000 (Sat, 31 Dec 2011) Log Message: ----------- added the new commands to the svn database Modified Paths: -------------- trunk/src/server/database/mysql/command_access.sql trunk/src/server/database/mysql/upgrade_schema.sql Modified: trunk/src/server/database/mysql/command_access.sql =================================================================== --- trunk/src/server/database/mysql/command_access.sql 2011-12-31 08:39:52 UTC (rev 7950) +++ trunk/src/server/database/mysql/command_access.sql 2011-12-31 08:40:25 UTC (rev 7951) @@ -56,6 +56,7 @@ INSERT INTO command_group_assignment VALUES( "setattrib others", 30 ); INSERT INTO command_group_assignment VALUES( "setkillexp others", 30 ); INSERT INTO command_group_assignment VALUES( "/serverquit", 30 ); +INSERT INTO command_group_assignment VALUES( "/npcclientquit", 30 ); INSERT INTO command_group_assignment VALUES( "requested death", 30 ); INSERT INTO command_group_assignment VALUES( "/time", 30 ); INSERT INTO command_group_assignment VALUES( "/version", 30 ); @@ -66,6 +67,7 @@ INSERT INTO command_group_assignment VALUES( "/key", 30 ); INSERT INTO command_group_assignment VALUES( "full modify", 30 ); INSERT INTO command_group_assignment VALUES( "spawn all", 30 ); +INSERT INTO command_group_assignment VALUES( "/percept", 30 ); # GM5 and above INSERT INTO command_group_assignment VALUES( "/disablequest", 30 ); Modified: trunk/src/server/database/mysql/upgrade_schema.sql =================================================================== --- trunk/src/server/database/mysql/upgrade_schema.sql 2011-12-31 08:39:52 UTC (rev 7950) +++ trunk/src/server/database/mysql/upgrade_schema.sql 2011-12-31 08:40:25 UTC (rev 7951) @@ -1673,8 +1673,11 @@ Actor:InterruptSpellCasting() }" ); +INSERT INTO command_group_assignment VALUES( "/npcclientquit", 30 ); +INSERT INTO command_group_assignment VALUES( "/percept", 30 ); + # Insert your upgrade before this line. Remember when you set a new db_version # to update the server_options.sql file and update psserver.cpp as well. # This to ensure that everything is working if you use the create_all.sql to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 08:39:58
|
Revision: 7950 http://planeshift.svn.sourceforge.net/planeshift/?rev=7950&view=rev Author: weltall2 Date: 2011-12-31 08:39:52 +0000 (Sat, 31 Dec 2011) Log Message: ----------- set quit as executable remotely Modified Paths: -------------- trunk/src/npcclient/command.cpp Modified: trunk/src/npcclient/command.cpp =================================================================== --- trunk/src/npcclient/command.cpp 2011-12-31 08:36:32 UTC (rev 7949) +++ trunk/src/npcclient/command.cpp 2011-12-31 08:39:52 UTC (rev 7950) @@ -437,7 +437,7 @@ { "list", false, com_list, "List entities ( list [char|ent|loc|npc|path|race|recipe|tribe|warpspace|waypoint] <filter> )" }, { "print", false, com_print, "List all behaviors/hate of 1 NPC"}, { "info", false, com_info, "Short print for 1 NPC"}, - { "quit", false, com_quit, "Makes the npc client exit"}, + { "quit", true, com_quit, "Makes the npc client exit"}, { "setlog", false, com_setlog, "Set server log" }, { "setmaxfile", false, com_setmaxfile, "Set maximum message class for output file"}, { "setmaxout", false, com_setmaxout, "Set maximum message class for standard output"}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 08:36:39
|
Revision: 7949 http://planeshift.svn.sourceforge.net/planeshift/?rev=7949&view=rev Author: weltall2 Date: 2011-12-31 08:36:32 +0000 (Sat, 31 Dec 2011) Log Message: ----------- added a confirmation message Modified Paths: -------------- trunk/src/server/adminmanager.cpp Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2011-12-31 08:35:52 UTC (rev 7948) +++ trunk/src/server/adminmanager.cpp 2011-12-31 08:36:32 UTC (rev 7949) @@ -11447,10 +11447,12 @@ } else if(data->subCmd == "path") { - delete pathNetwork; - pathNetwork = new psPathNetwork(); - pathNetwork->Load(EntityManager::GetSingleton().GetEngine(),db, - EntityManager::GetSingleton().GetWorld()); + delete pathNetwork; + pathNetwork = new psPathNetwork(); + pathNetwork->Load(EntityManager::GetSingleton().GetEngine(),db, + EntityManager::GetSingleton().GetWorld()); + psserver->SendSystemOK(client->GetClientNum(), "Successfully reloaded math scripts."); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <weltall2@us...> - 2011-12-31 08:35:59
|
Revision: 7948 http://planeshift.svn.sourceforge.net/planeshift/?rev=7948&view=rev Author: weltall2 Date: 2011-12-31 08:35:52 +0000 (Sat, 31 Dec 2011) Log Message: ----------- added support to quit npcclients from clients and to reload paths Modified Paths: -------------- trunk/src/npcclient/networkmgr.cpp trunk/src/npcclient/networkmgr.h trunk/src/server/adminmanager.cpp trunk/src/server/adminmanager.h Modified: trunk/src/npcclient/networkmgr.cpp =================================================================== --- trunk/src/npcclient/networkmgr.cpp 2011-12-31 04:00:31 UTC (rev 7947) +++ trunk/src/npcclient/networkmgr.cpp 2011-12-31 08:35:52 UTC (rev 7948) @@ -34,6 +34,7 @@ #include <ibgloader.h> #include "util/log.h" #include "util/serverconsole.h" +#include "util/command.h" #include "util/eventmanager.h" #include "net/connection.h" @@ -236,9 +237,7 @@ } case MSGTYPE_NPC_COMMAND: { - psServerCommandMessage msg(message); - // TODO: Do something more with this than printing it. - CPrintf(CON_CMDOUTPUT, msg.command.GetData()); + HandleConsoleCommand(message); break; } case MSGTYPE_NPC_WORKDONE: @@ -248,6 +247,35 @@ } } +void NetworkManager::HandleConsoleCommand(MsgEntry *me) +{ + csString buffer; + + psServerCommandMessage msg(me); + printf("Got command: %s\n", msg.command.GetDataSafe() ); + + size_t i = msg.command.FindFirst(' '); + csString word; + msg.command.SubString(word,0,i); + const COMMAND *cmd = find_command(word.GetDataSafe()); + + if (cmd && cmd->allowRemote) + { + int ret = execute_line(msg.command, &buffer); + if (ret == -1) + buffer = "Error executing command on the server."; + } + else + { + buffer = cmd ? "That command is not allowed to be executed remotely" + : "No command by that name. Please try again."; + } + printf("%s\n", buffer.GetData()); + + /*psServerCommandMessage retn(me->clientnum, buffer); + retn.SendMessage();*/ +} + void NetworkManager::HandleRaceList( MsgEntry* me) { psNPCRaceListMessage mesg( me ); Modified: trunk/src/npcclient/networkmgr.h =================================================================== --- trunk/src/npcclient/networkmgr.h 2011-12-31 04:00:31 UTC (rev 7947) +++ trunk/src/npcclient/networkmgr.h 2011-12-31 08:35:52 UTC (rev 7948) @@ -73,7 +73,8 @@ // void RemoveEntity(psCelPersistMessage& pmsg); void PrepareCommandMessage(); - + + void HandleConsoleCommand(MsgEntry *me); void HandleRaceList( MsgEntry* me ); void HandleAllEntities(MsgEntry *message); void HandleActor( MsgEntry* me ); Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2011-12-31 04:00:31 UTC (rev 7947) +++ trunk/src/server/adminmanager.cpp 2011-12-31 08:35:52 UTC (rev 7948) @@ -3637,7 +3637,7 @@ ParseError(me, "Missing or invalid item id"); } } - else if(subCmd != "serveroptions" && subCmd != "mathscript") + else if(subCmd != "serveroptions" && subCmd != "mathscript" && subCmd != "path") { ParseError(me,"Not a valid subcommand: " + subCmd); } @@ -3828,6 +3828,21 @@ return "Syntax: \"" + command + " [-1/time] <reason>\""; } +AdminCmdDataNPCClientQuit::AdminCmdDataNPCClientQuit(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words) +: AdminCmdData("/npcclientquit") +{ + // when help is requested, return immediate + if (IsHelp(words[1])) + return; +} + +ADMINCMDFACTORY_IMPLEMENT_MSG_FACTORY_CREATE(AdminCmdDataNPCClientQuit) + +csString AdminCmdDataNPCClientQuit::GetHelpMessage() +{ + return "Syntax: \"" + command + "\""; +} + AdminCmdDataSimple::AdminCmdDataSimple(csString commandName, AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage &msg, Client *client, WordArray &words) : AdminCmdData(commandName) { @@ -4013,6 +4028,7 @@ RegisterMsgFactoryFunction(new AdminCmdDataSetKillExp()); RegisterMsgFactoryFunction(new AdminCmdDataAssignFaction()); RegisterMsgFactoryFunction(new AdminCmdDataServerQuit()); + RegisterMsgFactoryFunction(new AdminCmdDataNPCClientQuit()); RegisterMsgFactoryFunction(new AdminCmdDataRndMsgTest()); RegisterMsgFactoryFunction(new AdminCmdDataList()); @@ -4448,6 +4464,10 @@ { HandleServerQuit(me, msg, data, client); } + else if (data->command == "/npcclientquit") + { + HandleNPCClientQuit(me, msg, data, client); + } else if (data->command == "/version") { HandleVersion(me, msg, data, client); @@ -11425,6 +11445,13 @@ psserver->GetMathScriptEngine()->ReloadScripts(); psserver->SendSystemOK(client->GetClientNum(), "Successfully reloaded math scripts."); } + else if(data->subCmd == "path") + { + delete pathNetwork; + pathNetwork = new psPathNetwork(); + pathNetwork->Load(EntityManager::GetSingleton().GetEngine(),db, + EntityManager::GetSingleton().GetWorld()); + } } void AdminManager::HandleListWarnings(psAdminCmdMessage& msg, AdminCmdData* cmddata, Client *client) @@ -11576,6 +11603,16 @@ psserver->QuitServer(data->time, client); } +void AdminManager::HandleNPCClientQuit(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* cmddata, Client *client ) +{ + //AdminCmdDataNPCClientQuit* data = dynamic_cast<AdminCmdDataNPCClientQuit*>(cmddata); + + psServerCommandMessage message(0, "quit"); + message.Multicast(psserver->GetNPCManager()->GetSuperClients(), -1, PROX_LIST_ANY_RANGE); + +} + + void AdminManager::HandleVersion(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* cmddata, Client *client ) { // AdminCmdDataSimple* data = dynamic_cast<AdminCmdDataSimple*>(cmddata); Modified: trunk/src/server/adminmanager.h =================================================================== --- trunk/src/server/adminmanager.h 2011-12-31 04:00:31 UTC (rev 7947) +++ trunk/src/server/adminmanager.h 2011-12-31 08:35:52 UTC (rev 7948) @@ -2809,6 +2809,45 @@ virtual csString GetHelpMessage(); }; +/** @brief Class for terminating the server. + */ +class AdminCmdDataNPCClientQuit : public AdminCmdData +{ +public: + /** @brief Creates obj for specified command that ends the server. + */ + AdminCmdDataNPCClientQuit() + : AdminCmdData("/npcclientquit") + {}; + + /** @brief Parses the given message and stores its data. + * @param msgManager message manager that handles this command + * @param me The incoming message from the GM + * @param msg psAdminCmdMessage containing the message + * @param client client of the network communication + * @param words command message to parse + */ + AdminCmdDataNPCClientQuit(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage& msg, Client *client, WordArray &words); + + virtual ~AdminCmdDataNPCClientQuit() + {}; + + /** @brief Creates an object containing the parsed data for server stop. + * @param msgManager message manager that handles this command + * @param me The incoming message from the GM + * @param msg psAdminCmdMessage containing the message + * @param client client of the network communication + * @param words command message to parse + * @return AdminCmdData* pointer to object containing parsed data. When parsing failed the valid flag is set to false. + */ + virtual AdminCmdData* CreateCmdData(AdminManager* msgManager, MsgEntry* me, psAdminCmdMessage& msg, Client *client, WordArray &words); + + /** @brief Returns a helpmessage that fits to the parser of the class. + * @return csString: a help message to send back to the client + */ + virtual csString GetHelpMessage(); +}; + /** @brief Simple one word commands. */ class AdminCmdDataSimple : public AdminCmdData @@ -3974,20 +4013,29 @@ */ void AssignFaction(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* data, Client *client); - /** @brief Allows to quit/reboot the server remotely from a clien + /** @brief Allows to quit/reboot the server remotely from a client * * @param me The incoming message from the GM * @param msg The cracked command message. - * @param data A pointer to the command parser object with target data + * @param data A pointer to the command parser object with target data * @param client The GM client the command came from. */ void HandleServerQuit(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* data, Client *client ); + /** @brief Allows to quit/reboot the npcclient remotely from a client + * + * @param me The incoming message from the GM + * @param msg The cracked command message. + * @param data A pointer to the command parser object with target data + * @param client The GM client the command came from. + */ + void HandleNPCClientQuit(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* data, Client *client ); + /** @brief Allows to get version the server remotely from a client * * @param me The incoming message from the GM * @param msg The cracked command message. - * @param data A pointer to the command parser object with target data + * @param data A pointer to the command parser object with target data * @param client The GM client the command came from. */ void HandleVersion(MsgEntry* me, psAdminCmdMessage& msg, AdminCmdData* data, Client *client ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <magodra@us...> - 2011-12-31 04:00:37
|
Revision: 7947 http://planeshift.svn.sourceforge.net/planeshift/?rev=7947&view=rev Author: magodra Date: 2011-12-31 04:00:31 +0000 (Sat, 31 Dec 2011) Log Message: ----------- - Added support for interrupted Perceptions on behaviors. Modified Paths: -------------- trunk/src/npcclient/npcbehave.cpp trunk/src/npcclient/npcbehave.h trunk/src/npcclient/perceptions.cpp Modified: trunk/src/npcclient/npcbehave.cpp =================================================================== --- trunk/src/npcclient/npcbehave.cpp 2011-12-31 02:36:40 UTC (rev 7946) +++ trunk/src/npcclient/npcbehave.cpp 2011-12-31 04:00:31 UTC (rev 7947) @@ -462,6 +462,13 @@ behaviors.Interrupt(npc); } +float NPCType::GetHighestNeed() +{ + return behaviors.GetHighestNeed(); +} + + + float NPCType::GetAngularVelocity(NPC * /*npc*/) { if (ang_vel != 999) @@ -739,7 +746,29 @@ return reply; } +float BehaviorSet::GetHighestNeed() +{ + float highest = 0.0; + float temp; + for (size_t i=0; i<behaviors.GetSize(); i++) + { + if ((temp = behaviors[i]->CurrentNeed()) > highest) + { + highest = temp; + } + if ((temp = behaviors[i]->NewNeed()) > highest) + { + highest = temp; + } + } + + return highest; +} + + + + //--------------------------------------------------------------------------- Behavior::Behavior() @@ -803,6 +832,7 @@ completion_decay = other.completion_decay; init_need = other.init_need; resume_after_interrupt = other.resume_after_interrupt; + interruptPerception = other.interruptPerception; current_need = other.current_need; new_need = -999; interrupted = false; @@ -842,6 +872,7 @@ init_need = node->GetAttributeValueAsFloat("initial"); is_applicable_when_dead = node->GetAttributeValueAsBool("when_dead"); resume_after_interrupt = node->GetAttributeValueAsBool("resume",false); + interruptPerception = node->GetAttributeValue("interrupt"); failurePerception = node->GetAttributeValue("failure"); if (node->GetAttributeValue("min")) @@ -1332,6 +1363,12 @@ npc->Printf(2,"Interrupting behaviour %s at step %d - %s", name.GetData(),current_step,sequence[current_step]->GetName()); + if (interruptPerception.Length()) + { + Perception perception(interruptPerception); + npc->TriggerEvent(&perception); + } + sequence[current_step]->InterruptOperation(npc,eventmgr); interrupted = true; } Modified: trunk/src/npcclient/npcbehave.h =================================================================== --- trunk/src/npcclient/npcbehave.h 2011-12-31 02:36:40 UTC (rev 7946) +++ trunk/src/npcclient/npcbehave.h 2011-12-31 04:00:31 UTC (rev 7947) @@ -160,6 +160,9 @@ */ csString InfoBehaviors(NPC *npc); + /** Return hight current or new need. + */ + float GetHighestNeed(); }; @@ -233,6 +236,10 @@ { return behaviors.GetCurrentBehavior(); } + + /** Return hight current or new need. + */ + float GetHighestNeed(); float GetAngularVelocity(NPC *npc); float GetVelocity(NPC *npc); @@ -271,6 +278,7 @@ float completion_decay; ///< need lessens AFTER behavior script is complete. Use -1 to remove all need float init_need; ///< starting need, also used in ClearState resets bool resume_after_interrupt; ///< Resume at active step after interrupt. + csString interruptPerception; ///< Perception to fire if interrupted. float current_need; ///< The current need of this behavior after last advance float new_need; ///< The accumulated change to the need after last advance Modified: trunk/src/npcclient/perceptions.cpp =================================================================== --- trunk/src/npcclient/perceptions.cpp 2011-12-31 02:36:40 UTC (rev 7946) +++ trunk/src/npcclient/perceptions.cpp 2011-12-31 04:00:31 UTC (rev 7947) @@ -284,11 +284,7 @@ case DESIRE_GUARANTIED: who->Printf(10, "Guarantied need to behavior %s", affected[i]->GetName()); - float highest = 0; - if (who->GetCurrentBehavior()) - { - highest = who->GetCurrentBehavior()->CurrentNeed(); - } + float highest = who->GetBrain()->GetHighestNeed(); if (who->GetCurrentBehavior() != affected[i]) { affected[i]->ApplyNeedAbsolute(who, highest + 25); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <magodra@us...> - 2011-12-31 02:36:46
|
Revision: 7946 http://planeshift.svn.sourceforge.net/planeshift/?rev=7946&view=rev Author: magodra Date: 2011-12-31 02:36:40 +0000 (Sat, 31 Dec 2011) Log Message: ----------- - Modified the /path point command to be a /path point [add|insert|remove] - Enabled the /path point that where not listed in the subCommandList and hench not recognized. - Fixed a place where edit of waypoints didn't remove the old effect. - Fixed several index errors in the pathnetwork code that caused the information about last path not to show on /path info. - Updated help file with /path point info. - Updated test data to use consistent naming of behaviors. Modified Paths: -------------- trunk/data/help.xml trunk/src/common/util/pspath.cpp trunk/src/common/util/pspath.h trunk/src/common/util/pspathnetwork.cpp trunk/src/common/util/pspathnetwork.h trunk/src/server/adminmanager.cpp trunk/src/server/database/mysql/sc_npctypes.sql trunk/src/server/database/mysql/tribes.sql Modified: trunk/data/help.xml =================================================================== --- trunk/data/help.xml 2011-12-30 16:27:04 UTC (rev 7945) +++ trunk/data/help.xml 2011-12-31 02:36:40 UTC (rev 7946) @@ -1435,9 +1435,9 @@ To create a path you need to do the following commands: 1) /path format <format> -2) /path start -3) /path point (Any number of times) -4) /path stop</content> +2) /path start <radius> +3) /path point add (Any number of times) +4) /path stop <radius></content> </Contents> <topic name="/path adjust"> <Contents> @@ -1536,9 +1536,11 @@ </topic> <topic name="/path point"> <Contents> - <content type="text">/path point + <content type="text">/path point [add|insert|remove] -Add a new point to the current selected path at your position. A path will be automaticaly be selected on the /path start command. You could use the /path select command as well to select a new path.</content> +Add, insert or remove a point to or from the current selected path at your position. + +A path will be automaticaly be selected on the /path start command. You could use the /path select command as well to select a new path.</content> </Contents> </topic> <topic name="/path remove"> Modified: trunk/src/common/util/pspath.cpp =================================================================== --- trunk/src/common/util/pspath.cpp 2011-12-30 16:27:04 UTC (rev 7945) +++ trunk/src/common/util/pspath.cpp 2011-12-31 02:36:40 UTC (rev 7946) @@ -111,6 +111,31 @@ } +bool psPathPoint::Remove(iDataConnection * db) +{ + int result = db->CommandPump("DELETE from sc_path_points WHERE id=%d",id); + + return (result == 1); +} + + +bool psPathPoint::UpdatePrevPointId(iDataConnection * db, int prevPointId) +{ + if (this->prevPointId != prevPointId) + { + SetPrevious(prevPointId); + + int result = db->CommandPump("UPDATE sc_path_points SET prev_point=%d WHERE id=%d", + this->prevPointId,id); + + return (result == 1); + } + + return true; +} + + + bool psPathPoint::Adjust(iDataConnection * db, csVector3 & pos, csString sector) { int result = db->CommandPump("UPDATE sc_path_points SET x=%.2f,y=%.2f,z=%.2f," @@ -255,10 +280,82 @@ { points[i]->prevPointId = points[i-1]->GetID(); } + + // Path isn't valid anymore + precalculationValid = false; return pp; } +psPathPoint* psPath::InsertPoint(iDataConnection *db, int index, const csVector3& pos, const char * sectorName) +{ + psPathPoint * pp = new psPathPoint(); + + pp->id = -1; + pp->pos = pos; + pp->radius = 0.0; + pp->sectorName = sectorName; + + if (!pp->Create(db,id)) + { + return NULL; + } + + points.Insert(index,pp); + + if (!UpdatePrevPointIndexes(db)) + { + return NULL; + } + + + // Path isn't valid anymore + precalculationValid = false; + + return pp; +} + +bool psPath::RemovePoint(iDataConnection *db, psPathPoint* point) +{ + size_t pos = points.Find(point); + if (pos == ((size_t)(-1))) + { + return false; + } + + return RemovePoint(db, pos); +} + + +bool psPath::RemovePoint(iDataConnection *db, int index) +{ + psPathPoint* point = points.Extract(index); + point->Remove(db); + delete point; + + if (!UpdatePrevPointIndexes(db)) + { + return false; + } + + return true; +} + + +bool psPath::UpdatePrevPointIndexes(iDataConnection* db) +{ + // Update points prev ids + for (size_t i = 1; i < points.GetSize()-1; i++) + { + if (!points[i]->UpdatePrevPointId(db, i > 1 ? points[i-1]->GetID():0)) + { + return false; + } + } + return true; +} + + void psPath::SetStart(Waypoint * wp) { psPathPoint* pathPoint = AddPoint(wp->loc.pos, wp->loc.radius, wp->loc.sectorName, true); //Add start wp as a point @@ -289,7 +386,7 @@ return sqrt(csSquaredDist::PointLine(p,l1,l2)); } -float psPath::Distance(psWorld * world, iEngine *engine,csVector3& pos, iSector * sector, int * index, float * fraction) +float psPath::Distance(psWorld * world, iEngine *engine,const csVector3& pos, const iSector* sector, int * index, float * fraction) const { float dist = -1.0; int idx = -1; @@ -331,7 +428,7 @@ return dist; } -float psPath::DistancePoint(psWorld * world, iEngine *engine,csVector3& pos, iSector * sector, int * index, bool include_ends) +float psPath::DistancePoint(psWorld * world, iEngine *engine,const csVector3& pos,const iSector* sector, int * index, bool include_ends) const { float dist = -1.0; int idx = -1; Modified: trunk/src/common/util/pspath.h =================================================================== --- trunk/src/common/util/pspath.h 2011-12-30 16:27:04 UTC (rev 7945) +++ trunk/src/common/util/pspath.h 2011-12-31 02:36:40 UTC (rev 7946) @@ -66,6 +66,12 @@ /// Establish this path point in the db bool Create(iDataConnection * db, int pathID); + /// Remove this path point in the db + bool Remove(iDataConnection * db); + + /// Update this path point in the db + bool UpdatePrevPointId(iDataConnection * db, int prevPointId); + /// Adjust the point position bool Adjust(iDataConnection * db, csVector3 & pos, csString sector); bool Adjust(csVector3 & pos, csString sector); @@ -158,6 +164,18 @@ /// Add a new point to the path psPathPoint* AddPoint(const csVector3& pos, float radius, const char * sectorName, bool first = false); + /// Insert a new point to the path and update db + psPathPoint* InsertPoint(iDataConnection *db, int index, const csVector3& pos, const char * sectorName); + + /// Remova a point from the path and update db + bool RemovePoint(iDataConnection *db, int index); + + /// Remova a point from the path and update db + bool RemovePoint(iDataConnection *db, psPathPoint* point); + + /// Update the indexes, after insert and removal of points. + bool UpdatePrevPointIndexes(iDataConnection* db); + /// Set the start of the path void SetStart(Waypoint * wp); @@ -168,10 +186,10 @@ virtual void Precalculate(psWorld * world, iEngine *engine, bool forceUpdate = false); /// Calculate distance from point to path - virtual float Distance(psWorld * world, iEngine *engine,csVector3& pos, iSector * sector, int * index = NULL, float * fraction = NULL); + virtual float Distance(psWorld * world, iEngine *engine,const csVector3& pos, const iSector* sector, int * index = NULL, float * fraction = NULL) const; /// Calculate distance from point to path points - virtual float DistancePoint(psWorld * world, iEngine *engine,csVector3& pos, iSector * sector, int * index = NULL, bool include_ends = false); + virtual float DistancePoint(psWorld * world, iEngine *engine,const csVector3& pos, const iSector* sector, int * index = NULL, bool include_ends = false) const; /// Get the start point psPathPoint* GetStartPoint(Direction direction); Modified: trunk/src/common/util/pspathnetwork.cpp =================================================================== --- trunk/src/common/util/pspathnetwork.cpp 2011-12-30 16:27:04 UTC (rev 7945) +++ trunk/src/common/util/pspathnetwork.cpp 2011-12-31 02:36:40 UTC (rev 7946) @@ -360,7 +360,7 @@ psPathPoint* psPathNetwork::FindPathPoint(int id) { - for (size_t p = 0; p < paths.GetSize()-1; p++) + for (size_t p = 0; p < paths.GetSize(); p++) { psPathPoint* point = paths[p]->FindPoint(id); if (point) return point; @@ -369,7 +369,20 @@ return NULL; } +psPathPoint* psPathNetwork::FindPoint(const psPath* path, const csVector3& pos, iSector* sector, float range, int& index) +{ + float dist,tmpFract; + dist = path->Distance(world,engine,pos,sector,&index,&tmpFract); + if (dist < 0.0) + { + return NULL; + } + + return path->points[index]; +} + + psPath *psPathNetwork::FindNearestPath(csVector3& v,iSector *sector, float range, float * found_range, int * index, float * fraction) { psPath * found = NULL; @@ -377,7 +390,7 @@ int tmpIdx; float fract = 0.0, tmpFract; - for (size_t p = 0; p < paths.GetSize()-1; p++) + for (size_t p = 0; p < paths.GetSize(); p++) { float dist2 = paths[p]->Distance(world,engine,v,sector,&tmpIdx,&tmpFract); @@ -408,13 +421,28 @@ } +psPathPoint* psPathNetwork::FindNearestPoint(const psPath* path, const csVector3& v, const iSector *sector, float range) +{ + int tmpIdx; + + float dist2 = path->DistancePoint(world,engine,v,sector,&tmpIdx); + + if (dist2 >= 0.0) + { + return path->points[tmpIdx]; + } + + return NULL; +} + + psPath *psPathNetwork::FindNearestPoint(csVector3& v,iSector *sector, float range, float * found_range, int * index) { psPath * found = NULL; int idx = -1; int tmpIdx; - for (size_t p = 0; p < paths.GetSize()-1; p++) + for (size_t p = 0; p < paths.GetSize(); p++) { float dist2 = paths[p]->DistancePoint(world,engine,v,sector,&tmpIdx); @@ -599,7 +627,7 @@ size_t psPathNetwork::FindPointsInSector(iSector *sector, csList<psPathPoint*>& list) { size_t count = 0; - for (size_t p = 0; p < paths.GetSize()-1; p++) + for (size_t p = 0; p < paths.GetSize(); p++) { count += paths[p]->FindPointsInSector( engine, sector, list ); } Modified: trunk/src/common/util/pspathnetwork.h =================================================================== --- trunk/src/common/util/pspathnetwork.h 2011-12-30 16:27:04 UTC (rev 7945) +++ trunk/src/common/util/pspathnetwork.h 2011-12-31 02:36:40 UTC (rev 7946) @@ -120,11 +120,23 @@ * Find waypoint by id */ psPathPoint* FindPathPoint(int id); + + /** + * Find the point nearest to the path. + * @param index return the index of the path point at the start of this segment. + */ + psPathPoint* FindPoint(const psPath* path, const csVector3& pos, iSector* sector, float range, int& index); /** * Find the path nearest to a point in the world. * @ param Set an maximum range for points to considere. */ + psPathPoint* FindNearestPoint(const psPath* path, const csVector3& v, const iSector *sector, float range); + + /** + * Find the path nearest to a point in the world. + * @ param Set an maximum range for points to considere. + */ psPath *FindNearestPath(csVector3& v, iSector *sector, float range, float * found_range = NULL, int * index = NULL, float * fraction = NULL); /** Modified: trunk/src/server/adminmanager.cpp =================================================================== --- trunk/src/server/adminmanager.cpp 2011-12-30 16:27:04 UTC (rev 7945) +++ trunk/src/server/adminmanager.cpp 2011-12-31 02:36:40 UTC (rev 7946) @@ -2853,6 +2853,7 @@ subCommandList.Push("hide","[points|waypoints]"); subCommandList.Push("info","[<radius>]"); subCommandList.Push("move","[wp|point] <id>|<name>"); + subCommandList.Push("point","add|remove|insert"); subCommandList.Push("radius","<new radius> [<radius>]"); subCommandList.Push("remove","[<radius>]"); subCommandList.Push("rename","[<radius>] <name>"); @@ -3000,7 +3001,23 @@ } else if (subCmd == "point") { - // No params + csString subSubCmd = words[index++]; + if (subSubCmd.IsEmpty()) + { + ParseError(me,"No sub command; add, remove, or insert given."); + } + else if (subSubCmd == "add") + { + subCmd = "point add"; + } + else if (subSubCmd == "remove") + { + subCmd = "point remove"; + } + else if (subSubCmd == "insert") + { + subCmd = "point insert"; + } } else if (subCmd == "radius") { @@ -6086,9 +6103,13 @@ if (client->WaypointIsDisplaying()) { - psEffectMessage msg(me->clientnum,"admin_waypoint",wp->GetPosition(),0,0, - wp->GetEffectID(this),wp->GetRadius()); - msg.SendMessage(); + // Hide + psStopEffectMessage hide(me->clientnum, wp->GetEffectID(this)); + hide.SendMessage(); + // Display + psEffectMessage show(me->clientnum,"admin_waypoint",wp->GetPosition(),0,0, + wp->GetEffectID(this),wp->GetRadius()); + show.SendMessage(); } psserver->SendSystemInfo(me->clientnum, "Waypoint %s updated with new radius %.3f.", @@ -6109,7 +6130,7 @@ wp.Format(client->WaypointGetPathName(),client->WaypointGetPathIndex()); psserver->SendSystemInfo( me->clientnum, "New path format, first new WP will be: '%s'",wp.GetDataSafe()); } - else if (data->subCmd == "point") + else if (data->subCmd == "point add") { psPath * path = client->PathGetPath(); if (!path) @@ -6129,6 +6150,68 @@ psserver->SendSystemInfo( me->clientnum, "Added point."); } + else if (data->subCmd == "point remove") + { + psPath * path = client->PathGetPath(); + if (!path) + { + psserver->SendSystemError(me->clientnum, "You have no path. Please start/select one."); + return; + } + + int index; + psPathPoint * point = NULL; + + if ((point = pathNetwork->FindNearestPoint(path, myPos, mySector, data->radius)) == NULL) + { + psserver->SendSystemError(me->clientnum, "Found no path point near you at selected path %s.",path->GetName()); + } + + path->RemovePoint(db, point); + + if (client->PathIsDisplaying()) + { + psStopEffectMessage msg(me->clientnum, point->GetEffectID(this)); + msg.SendMessage(); + } + + psserver->SendSystemInfo( me->clientnum, "Removed point."); + + } + else if (data->subCmd == "point insert") + { + psPath * path = client->PathGetPath(); + if (!path) + { + psserver->SendSystemError(me->clientnum, "You have no path. Please start/select one."); + return; + } + + int index; + psPathPoint * point = NULL; + + if ((point = pathNetwork->FindPoint(path, myPos, mySector, data->radius, index)) == NULL) + { + psserver->SendSystemError(me->clientnum, "Found no path point near you at selected path %s.",path->GetName()); + return; + } + + psPathPoint* newPoint = path->InsertPoint(db, index+1, myPos, mySectorName); + if (!newPoint) + { + psserver->SendSystemError(me->clientnum, "Failed to insert point."); + return; + } + + + if (client->PathIsDisplaying()) + { + psEffectMessage msg(me->clientnum,"admin_path_point",myPos,0,0,newPoint->GetEffectID(this)); + msg.SendMessage(); + } + + psserver->SendSystemInfo( me->clientnum, "Inserted point."); + } else if (data->subCmd == "start") { float range; Modified: trunk/src/server/database/mysql/sc_npctypes.sql =================================================================== --- trunk/src/server/database/mysql/sc_npctypes.sql 2011-12-30 16:27:04 UTC (rev 7945) +++ trunk/src/server/database/mysql/sc_npctypes.sql 2011-12-31 02:36:40 UTC (rev 7946) @@ -17,7 +17,7 @@ # Dumping data for table 'sc_npctypes' # INSERT INTO sc_npctypes VALUES("1","DoNothing","","","","","","","", -'<behavior name="do nothing" decay="0" growth="0" initial="50"> +'<behavior name="DoNothing" decay="0" growth="0" initial="50"> <wait duration="1" anim="stand" /> </behavior>'); @@ -230,11 +230,8 @@ -INSERT INTO sc_npctypes VALUES("100","Smith","GoHomeOnTeleport","","","","","","", -'<behavior name="do nothing" decay="0" growth="0" initial="10"> - <wait duration="1" anim="stand" /> -</behavior> -<behavior name="go_climbing1" initial="0" completion_decay="20" loop="no"> +INSERT INTO sc_npctypes VALUES("100","Smith","GoHomeOnTeleport,DoNothing","","","","","","", +'<behavior name="go_climbing1" initial="0" completion_decay="20" loop="no"> <moveto x="-53.6003" y="0.0" z="-155.041" anim="walk" /> <moveto x="-8.89576" y="0.0" z="-162.498" anim="walk" /> <moveto x="18.4303" y="21.9941" z="-163.082" anim="walk" /> @@ -871,10 +868,6 @@ <rotate type="absolute" value="180" ang_vel="20"/> </behavior> -<behavior name="do nothing" decay="0" growth="0" initial="1"> - <wait duration="1" anim="stand" /> -</behavior> - <behavior name="turn to face" completion_decay="-1" growth="0" initial="0" > <locate obj="perception" /> <rotate type="locatedest" anim="walk" ang_vel="20" /> @@ -898,10 +891,6 @@ <rotate type="absolute" value="90" ang_vel="20"/> </behavior> -<behavior name="do nothing" decay="0" growth="0" initial="1"> - <wait duration="1" anim="stand" /> -</behavior> - <!-- Running the wheel --> <behavior name="winch_up" completion_decay="100"> <rotate type="absolute" value="180" ang_vel="20"/> Modified: trunk/src/server/database/mysql/tribes.sql =================================================================== --- trunk/src/server/database/mysql/tribes.sql 2011-12-30 16:27:04 UTC (rev 7945) +++ trunk/src/server/database/mysql/tribes.sql 2011-12-31 02:36:40 UTC (rev 7946) @@ -34,5 +34,5 @@ # Dumping data for table characters # -INSERT INTO `tribes` VALUES (1,'Mining tribe',3,-70,0,-175,20,100,'Gold Ore','gold','mine','Dig',1.00,0.0,0,10,'do nothing', 100); -INSERT INTO `tribes` VALUES (2,'Hunting tribe',3,-75,0,-230,5,5,'Meat','meat','hunting_ground','Hunt',1.00,0.50,100,60,'do nothing', 101); +INSERT INTO `tribes` VALUES (1,'Mining tribe',3,-70,0,-175,20,100,'Gold Ore','gold','mine','Dig',1.00,0.0,0,10,'DoNothing', 100); +INSERT INTO `tribes` VALUES (2,'Hunting tribe',3,-75,0,-230,5,5,'Meat','meat','hunting_ground','Hunt',1.00,0.50,100,60,'DoNothing', 101); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |