From: <tu...@us...> - 2009-11-14 11:19:02
|
Revision: 139 http://polserver.svn.sourceforge.net/polserver/?rev=139&view=rev Author: turley Date: 2009-11-14 11:18:46 +0000 (Sat, 14 Nov 2009) Log Message: ----------- bugfix in CanWalk Modified Paths: -------------- trunk/pol-core/pol/module/uomod.cpp Modified: trunk/pol-core/pol/module/uomod.cpp =================================================================== --- trunk/pol-core/pol/module/uomod.cpp 2009-11-14 10:50:43 UTC (rev 138) +++ trunk/pol-core/pol/module/uomod.cpp 2009-11-14 11:18:46 UTC (rev 139) @@ -5546,13 +5546,13 @@ unsigned short tmp_newy = y + move_delta[ tmp_facing ].ymove; // needs to save because if only one direction is blocked, it shouldn't block ;) - bool walk1 = realm->walkheight(x,y,z,&new_z,NULL,NULL,true,movemode,NULL); + bool walk1 = realm->walkheight(tmp_newx,tmp_newy,z,&new_z,NULL,NULL,true,movemode,NULL); tmp_facing = (dir-1) & 0x7; tmp_newx = x + move_delta[ tmp_facing ].xmove; tmp_newy = y + move_delta[ tmp_facing ].ymove; - if (!walk1 && !realm->walkheight(x,y,z,&new_z,NULL,NULL,true,movemode,NULL)) + if (!walk1 && !realm->walkheight(tmp_newx,tmp_newy,z,&new_z,NULL,NULL,true,movemode,NULL)) return new BError("Cannot walk there"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2009-12-04 13:13:45
|
Revision: 158 http://polserver.svn.sourceforge.net/polserver/?rev=158&view=rev Author: turley Date: 2009-12-04 13:13:36 +0000 (Fri, 04 Dec 2009) Log Message: ----------- CanWalk chr::decode_movemode() instead of c&p Modified Paths: -------------- trunk/pol-core/pol/module/uomod.cpp Modified: trunk/pol-core/pol/module/uomod.cpp =================================================================== --- trunk/pol-core/pol/module/uomod.cpp 2009-12-04 12:49:26 UTC (rev 157) +++ trunk/pol-core/pol/module/uomod.cpp 2009-12-04 13:13:36 UTC (rev 158) @@ -5516,74 +5516,67 @@ UFACING direction_toward( xcoord from_x, ycoord from_y, xcoord to_x, ycoord to_y ); BObjectImp* UOExecutorModule::mf_CanWalk(/*movemode, x1, y1, z1, x2_or_dir, y2 := -1, realm := DEF*/) { - xcoord x; - ycoord y; - zcoord z; - long x2_or_dir, y2_; - const String* realm_name; - const String* movemode_name; + xcoord x; + ycoord y; + zcoord z; + long x2_or_dir, y2_; + const String* realm_name; + const String* movemode_name; - if ((getStringParam(0, movemode_name)) && - (getParam(1,x)) && - (getParam(2,y)) && - (getParam(3,z)) && - (getParam(4,x2_or_dir)) && - (getParam(5,y2_)) && - (getStringParam(6, realm_name))) - { - //FIXME c&p from Character::decode_movemode - MOVEMODE movemode = MOVEMODE_NONE; - if ((movemode_name->value()).find( 'L' ) != string::npos) - movemode = static_cast<MOVEMODE>(movemode + MOVEMODE_LAND); - if ((movemode_name->value()).find( 'S' ) != string::npos) - movemode = static_cast<MOVEMODE>(movemode + MOVEMODE_SEA); - if ((movemode_name->value()).find( 'A' ) != string::npos) - movemode = static_cast<MOVEMODE>(movemode + MOVEMODE_AIR); + if ((getStringParam(0, movemode_name)) && + (getParam(1,x)) && + (getParam(2,y)) && + (getParam(3,z)) && + (getParam(4,x2_or_dir)) && + (getParam(5,y2_)) && + (getStringParam(6, realm_name))) + { + MOVEMODE movemode = Character::decode_movemode(movemode_name->value()); - Realm* realm = find_realm(realm_name->value()); - if( !realm ) - return new BError("Realm not found."); - else if( !realm->valid(x, y, z) ) - return new BError("Invalid coordinates for realm."); - UFACING dir; - if (y2_ == -1) - dir=static_cast<UFACING>(x2_or_dir & 0x7); - else - { - if( !realm->valid(static_cast<xcoord>(x2_or_dir), static_cast<ycoord>(y2_), 0) ) - return new BError("Invalid coordinates for realm."); - dir=direction_toward( x,y,static_cast<xcoord>(x2_or_dir),static_cast<ycoord>(y2_)); - } + Realm* realm = find_realm(realm_name->value()); + if( !realm ) + return new BError("Realm not found."); + else if( !realm->valid(x, y, z) ) + return new BError("Invalid coordinates for realm."); + UFACING dir; + if (y2_ == -1) + dir=static_cast<UFACING>(x2_or_dir & 0x7); + else + { + if( !realm->valid(static_cast<xcoord>(x2_or_dir), static_cast<ycoord>(y2_), 0) ) + return new BError("Invalid coordinates for realm."); + dir=direction_toward( x,y,static_cast<xcoord>(x2_or_dir),static_cast<ycoord>(y2_)); + } - if (dir & 1) // check if diagonal movement is allowed - { - short new_z; - u8 tmp_facing = (dir+1) & 0x7; - unsigned short tmp_newx = x + move_delta[ tmp_facing ].xmove; - unsigned short tmp_newy = y + move_delta[ tmp_facing ].ymove; + if (dir & 1) // check if diagonal movement is allowed + { + short new_z; + u8 tmp_facing = (dir+1) & 0x7; + unsigned short tmp_newx = x + move_delta[ tmp_facing ].xmove; + unsigned short tmp_newy = y + move_delta[ tmp_facing ].ymove; - // needs to save because if only one direction is blocked, it shouldn't block ;) - bool walk1 = realm->walkheight(tmp_newx,tmp_newy,z,&new_z,NULL,NULL,true,movemode,NULL); + // needs to save because if only one direction is blocked, it shouldn't block ;) + bool walk1 = realm->walkheight(tmp_newx,tmp_newy,z,&new_z,NULL,NULL,true,movemode,NULL); - tmp_facing = (dir-1) & 0x7; - tmp_newx = x + move_delta[ tmp_facing ].xmove; - tmp_newy = y + move_delta[ tmp_facing ].ymove; + tmp_facing = (dir-1) & 0x7; + tmp_newx = x + move_delta[ tmp_facing ].xmove; + tmp_newy = y + move_delta[ tmp_facing ].ymove; - if (!walk1 && !realm->walkheight(tmp_newx,tmp_newy,z,&new_z,NULL,NULL,true,movemode,NULL)) - return new BError("Cannot walk there"); - } + if (!walk1 && !realm->walkheight(tmp_newx,tmp_newy,z,&new_z,NULL,NULL,true,movemode,NULL)) + return new BError("Cannot walk there"); + } - unsigned short newx = x + move_delta[ dir ].xmove; - unsigned short newy = y + move_delta[ dir ].ymove; - short newz; + unsigned short newx = x + move_delta[ dir ].xmove; + unsigned short newy = y + move_delta[ dir ].ymove; + short newz; - if (!realm->walkheight(newx,newy,z,&newz,NULL,NULL,true,movemode,NULL)) - return new BError("Cannot walk there"); + if (!realm->walkheight(newx,newy,z,&newz,NULL,NULL,true,movemode,NULL)) + return new BError("Cannot walk there"); - return new BLong(newz); - } - else - return new BError("Invalid parameter"); + return new BLong(newz); + } + else + return new BError("Invalid parameter"); } //FIXME move ufacing.h functions into *.cpp then move this function there This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2010-06-26 15:02:04
|
Revision: 255 http://polserver.svn.sourceforge.net/polserver/?rev=255&view=rev Author: turley Date: 2010-06-26 15:01:58 +0000 (Sat, 26 Jun 2010) Log Message: ----------- fixed possible bufferoverrun in sendcharprofile Modified Paths: -------------- trunk/pol-core/pol/module/uomod.cpp Modified: trunk/pol-core/pol/module/uomod.cpp =================================================================== --- trunk/pol-core/pol/module/uomod.cpp 2010-06-22 08:41:03 UTC (rev 254) +++ trunk/pol-core/pol/module/uomod.cpp 2010-06-26 15:01:58 UTC (rev 255) @@ -5712,9 +5712,6 @@ ObjArray* uText; ObjArray* eText; - u16 uwtext[ (SPEECH_MAX_LEN + 1) ]; - u16 ewtext[ (SPEECH_MAX_LEN + 1) ]; - if ( getCharacterParam(exec, 0, chr) && getCharacterParam(exec, 1, of_who) && getStringParam( 2, title ) && @@ -5724,12 +5721,20 @@ if (chr->logged_in && of_who->logged_in) { // Get The Unicode message lengths and convert the arrays to UC + u16 uwtext[ (SPEECH_MAX_LEN + 1) ]; + u16 ewtext[ (SPEECH_MAX_LEN + 1) ]; ulen = uText->ref_arr.size(); + if ( ulen > SPEECH_MAX_LEN ) + return new BError( "Unicode array exceeds maximum size." ); + if(!convertArrayToUC(uText, uwtext, ulen)) return new BError("Invalid parameter type"); elen = eText->ref_arr.size(); + if ( elen > SPEECH_MAX_LEN ) + return new BError( "Unicode array exceeds maximum size." ); + if (!convertArrayToUC(eText, ewtext, elen)) return new BError("Invalid parameter type"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2014-02-01 11:51:13
|
Revision: 757 http://sourceforge.net/p/polserver/code/757 Author: turley Date: 2014-02-01 11:51:08 +0000 (Sat, 01 Feb 2014) Log Message: ----------- fixed some debug logs Modified Paths: -------------- trunk/pol-core/pol/module/uomod.cpp Modified: trunk/pol-core/pol/module/uomod.cpp =================================================================== --- trunk/pol-core/pol/module/uomod.cpp 2014-01-31 18:39:41 UTC (rev 756) +++ trunk/pol-core/pol/module/uomod.cpp 2014-02-01 11:51:08 UTC (rev 757) @@ -5236,9 +5236,9 @@ if ( config.loglevel >= 12 ) { - POLLOG.Format( "[FindPath] Calling FindPath({:d}, {:d}, {:d}, {:d}, {:d}, {:d}, {}, 0x{:X}, {:d})\n" ) + POLLOG.Format( "[FindPath] Calling FindPath({}, {}, {}, {}, {}, {}, {}, 0x{:X}, {})\n" ) << x1 << y1 << z1 << x2 << y2 << z2 << strrealm->data() << flags << theSkirt; - POLLOG.Format( "[FindPath] search for Blockers inside {:d} {:d} {:d} {:d}\n" ) << xL << yL << xH << yH; + POLLOG.Format( "[FindPath] search for Blockers inside {} {} {} {}\n" ) << xL << yL << xH << yH; } AStarBlockers theBlockers( xL, xH, yL, yH ); @@ -5250,7 +5250,7 @@ theBlockers.AddBlocker( chr->x, chr->y, chr->z ); if ( config.loglevel >= 12 ) - POLLOG.Format( "[FindPath] add Blocker {} at {:d} {:d} {:d}\n" ) + POLLOG.Format( "[FindPath] add Blocker {} at {} {} {}\n" ) << chr->name() << chr->x << chr->y << chr->z; } ); } @@ -5260,8 +5260,8 @@ if ( config.loglevel >= 12 ) { - POLLOG.Format( "[FindPath] use StartNode {:d} {:d} {:d}\n" ) << x1 << y1 << z1; - POLLOG.Format( "[FindPath] use EndNode {:d} {:d} {:d}\n" ) << x2 << y2 << z2; + POLLOG.Format( "[FindPath] use StartNode {} {} {}\n" ) << x1 << y1 << z1; + POLLOG.Format( "[FindPath] use EndNode {} {} {}\n" ) << x2 << y2 << z2; } // Create a start state This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2014-06-01 10:10:55
|
Revision: 796 http://sourceforge.net/p/polserver/code/796 Author: turley Date: 2014-06-01 10:10:45 +0000 (Sun, 01 Jun 2014) Log Message: ----------- fixed possible crash during shutdown Modified Paths: -------------- trunk/pol-core/pol/module/uomod.cpp Modified: trunk/pol-core/pol/module/uomod.cpp =================================================================== --- trunk/pol-core/pol/module/uomod.cpp 2014-06-01 09:59:12 UTC (rev 795) +++ trunk/pol-core/pol/module/uomod.cpp 2014-06-01 10:10:45 UTC (rev 796) @@ -224,38 +224,44 @@ if ( target_cursor_chr != NULL ) { // CHECKME can we cancel the cursor request? - target_cursor_chr->client->gd->target_cursor_uoemod = NULL; + if (target_cursor_chr->client != nullptr && target_cursor_chr->client->gd != nullptr ) + target_cursor_chr->client->gd->target_cursor_uoemod = NULL; target_cursor_chr = NULL; } if ( menu_selection_chr != NULL ) { - menu_selection_chr->client->gd->menu_selection_uoemod = NULL; + if ( menu_selection_chr->client != nullptr && menu_selection_chr->client->gd != nullptr ) + menu_selection_chr->client->gd->menu_selection_uoemod = NULL; menu_selection_chr = NULL; } if ( prompt_chr != NULL ) { - prompt_chr->client->gd->prompt_uoemod = NULL; + if ( prompt_chr->client != nullptr && prompt_chr->client->gd != nullptr ) + prompt_chr->client->gd->prompt_uoemod = NULL; prompt_chr = NULL; } if ( gump_chr != NULL ) { - gump_chr->client->gd->remove_gumpmod( this ); - // gump_chr->client->gd->gump_uoemod = NULL; + if ( gump_chr->client != nullptr && gump_chr->client->gd != nullptr ) + gump_chr->client->gd->remove_gumpmod( this ); gump_chr = NULL; } if ( textentry_chr != NULL ) { - textentry_chr->client->gd->textentry_uoemod = NULL; + if ( textentry_chr->client != nullptr && textentry_chr->client->gd != nullptr ) + textentry_chr->client->gd->textentry_uoemod = NULL; textentry_chr = NULL; } if ( resurrect_chr != NULL ) { - resurrect_chr->client->gd->resurrect_uoemod = NULL; + if ( resurrect_chr->client != nullptr && resurrect_chr->client->gd != nullptr ) + resurrect_chr->client->gd->resurrect_uoemod = NULL; resurrect_chr = NULL; } if ( selcolor_chr != NULL ) { - selcolor_chr->client->gd->selcolor_uoemod = NULL; + if ( selcolor_chr->client != nullptr && selcolor_chr->client->gd != nullptr ) + selcolor_chr->client->gd->selcolor_uoemod = NULL; selcolor_chr = NULL; } if ( attached_chr_ != NULL ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tu...@us...> - 2014-07-09 17:52:53
|
Revision: 826 http://sourceforge.net/p/polserver/code/826 Author: turley Date: 2014-07-09 17:52:49 +0000 (Wed, 09 Jul 2014) Log Message: ----------- fixed ListMultisInBox not returning multis if center item is not in the box Modified Paths: -------------- trunk/pol-core/pol/module/uomod.cpp Modified: trunk/pol-core/pol/module/uomod.cpp =================================================================== --- trunk/pol-core/pol/module/uomod.cpp 2014-07-05 09:40:15 UTC (rev 825) +++ trunk/pol-core/pol/module/uomod.cpp 2014-07-09 17:52:49 UTC (rev 826) @@ -2436,8 +2436,25 @@ std::unique_ptr<ObjArray> newarr( new ObjArray ); + // extend the coords to find the center item + // but only as parameter for the filter function + unsigned short x1range = x1; + unsigned short x2range = x2 + RANGE_VISUAL_LARGE_BUILDINGS; + unsigned short y1range = y1; + unsigned short y2range = y2 + RANGE_VISUAL_LARGE_BUILDINGS; + + if (x1range >= RANGE_VISUAL_LARGE_BUILDINGS) + x1range -= RANGE_VISUAL_LARGE_BUILDINGS; + else + x1range = 0; + if (y1range >= RANGE_VISUAL_LARGE_BUILDINGS) + y1range -= RANGE_VISUAL_LARGE_BUILDINGS; + else + y1range = 0; + + internal_InBoxAreaChecks( x1range,y1range,z1,x2range,y2range,z2,realm); // search for multis. this is tricky, since the center might lie outside the box - WorldIterator<MultiFilter>::InBox( x1, y1, x2, y2, realm, [&]( Multi::UMulti* multi ) + WorldIterator<MultiFilter>::InBox( x1range, y1range, x2range, y2range, realm, [&]( Multi::UMulti* multi ) { const Multi::MultiDef& md = multi->multidef(); if ( multi->x + md.minrx > x2 || // east of the box @@ -5843,4 +5860,4 @@ return function_table[idx].funcname; } } -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |