Some help please

Place your questions about osirose here

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Some help please

Postby littlemc on Wed Jun 24, 2009 11:40 pm

well i kind of edited a lot and added a lot of osprose to the osirose, i noticed this warnings and i wanted to know how can i fix them?
thank you for any help

  1. Compiling: ..\World Server\aip\AiActions.cpp
  2. F:\Rev 81\World Server\aip\AiActions.cpp: In function `int F_AI_ACT_010(CWorldServer*, CCharacter*, byte*)':
  3. F:\Rev 81\World Server\aip\AiActions.cpp:272: warning: passing NULL used for non-pointer converting 4 of `CMonster* CMap::AddMonster(UINT, fPoint, UINT, UINT, UINT, bool, UINT)'
  4. F:\Rev 81\World Server\aip\AiActions.cpp:272: warning: passing NULL used for non-pointer converting 5 of `CMonster* CMap::AddMonster(UINT, fPoint, UINT, UINT, UINT, bool, UINT)'
  5. F:\Rev 81\World Server\aip\AiActions.cpp: In function `int F_AI_ACT_020(CWorldServer*, CCharacter*, byte*)':
  6. F:\Rev 81\World Server\aip\AiActions.cpp:581: warning: passing NULL used for non-pointer converting 4 of `CMonster* CMap::AddMonster(UINT, fPoint, UINT, UINT, UINT, bool, UINT)'
  7. F:\Rev 81\World Server\aip\AiActions.cpp:581: warning: passing NULL used for non-pointer converting 5 of `CMonster* CMap::AddMonster(UINT, fPoint, UINT, UINT, UINT, bool, UINT)'
  8. F:\Rev 81\World Server\aip\AiActions.cpp:587: warning: passing NULL used for non-pointer converting 4 of `CMonster* CMap::AddMonster(UINT, fPoint, UINT, UINT, UINT, bool, UINT)'
  9. F:\Rev 81\World Server\aip\AiActions.cpp:587: warning: passing NULL used for non-pointer converting 5 of `CMonster* CMap::AddMonster(UINT, fPoint, UINT, UINT, UINT, bool, UINT)'
  10. F:\Rev 81\World Server\aip\AiActions.cpp:595: warning: passing NULL used for non-pointer converting 4 of `CMonster* CMap::AddMonster(UINT, fPoint, UINT, UINT, UINT, bool, UINT)'
  11. F:\Rev 81\World Server\aip\AiActions.cpp:595: warning: passing NULL used for non-pointer converting 5 of `CMonster* CMap::AddMonster(UINT, fPoint, UINT, UINT, UINT, bool, UINT)'
  12. Compiling: ..\World Server\aip\AiConditions.cpp
  13. F:\Rev 81\World Server\aip\AiConditions.cpp: In function `int F_AI_COND_021(CWorldServer*, CCharacter*, byte*)':
  14. F:\Rev 81\World Server\aip\AiConditions.cpp:632: warning: NULL used in arithmetic




Edit: i fixed it and left only with this one:
  1. F:\Rev 81\World Server\aip\AiConditions.cpp||In function `int F_AI_COND_021(CWorldServer*, CCharacter*, byte*)':|
  2. F:\Rev 81\World Server\aip\AiConditions.cpp|632|warning: NULL used in arithmetic|
  3. ||=== Build finished: 0 errors, 1 warnings ===|
  4.  


i tried to run the server with this warning and i got some warnings on the world server about not the same npc how can i fix that?
and than when i tried to log in the world server crashed when i picked the char

Image
littlemc
Little soul
Little soul
 
Posts: 7
Joined: Wed Jun 24, 2009 3:16 am

Re: Some help please

Postby T-Grave on Thu Jun 25, 2009 11:42 am

search for the warning message in your source files and look what caused it to trigger.
T-Grave
osiRose dev
osiRose dev
 
Posts: 211
Joined: Sun Jun 07, 2009 2:06 pm
Location: Belgium

Re: Some help please

Postby lmame on Thu Jun 25, 2009 11:55 am

Seems like the eventid is badly initialized.
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: Some help please

Postby littlemc on Thu Jun 25, 2009 1:08 pm

yes i can see that XD
but where in the source i can fix it?
littlemc
Little soul
Little soul
 
Posts: 7
Joined: Wed Jun 24, 2009 3:16 am

Re: Some help please

Postby lmame on Thu Jun 25, 2009 1:14 pm

when the NPC is spawned in the map, set event or eventid to 0.
In osRose it's in startup.cpp, LoadNPCs():
  1.    thisnpc->event=0;
  2.     thisnpc->thisnpc = GetNPCDataByID( thisnpc->npctype );
  3.     thisnpc->thisnpc->eventid=0;


But it's surely different in osiRose.
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: Some help please

Postby littlemc on Thu Jun 25, 2009 1:30 pm

this is my code
  1.                if(npc->thisnpc->eventid != GServer->ObjVar[npc->npctype][0])
  2.                 {
  3.                     int new_event_id = GServer->ObjVar[npc->npctype][0];
  4.                     Log(MSG_WARNING,"(2)Event ID not the same NPC %i from %i to %i in map %i, npc->thisnpc->eventid=%i !",npc->npctype,npc->thisnpc->eventid,new_event_id,map->id,npc->thisnpc->eventid);
  5.                     npc->thisnpc->eventid = new_event_id;
  6.                     //LMA: We have to change the event ID here since we didn't send the clientID :(
  7.                     BEGINPACKET( pak, 0x790 );
  8.                     ADDWORD    ( pak, npc->clientid );
  9.                     ADDWORD    ( pak, npc->thisnpc->eventid );
  10.                     GServer->SendToMap(&pak,map->id);
  11.                 }
  12.             }
  13.             pthread_mutex_unlock( &map->MonsterMutex );
  14.         }
  15.         pthread_mutex_unlock( &GServer->MapMutex );
  16.         pthread_mutex_unlock( &GServer->PlayerMutex );
  17.         #ifdef _WIN32
  18.         Sleep(GServer->Config.MapDelay);
  19.         #else
  20.         usleep(GServer->Config.MapDelay);
  21.         #endif
  22.     }
  23.     pthread_exit( NULL );
  24. }
  25.  


what is wrong in it
littlemc
Little soul
Little soul
 
Posts: 7
Joined: Wed Jun 24, 2009 3:16 am

Re: Some help please

Postby lmame on Thu Jun 25, 2009 1:39 pm

I said :
startup.cpp, LoadNPCs()
The world is full of love and peace ^_^
Image
User avatar
lmame
Admin
Admin
 
Posts: 8997
Joined: Mon Aug 06, 2007 4:42 pm
Location: July City

Re: Some help please

Postby littlemc on Thu Jun 25, 2009 1:54 pm

oh sorry, just looked for something similar to the code you gave before, my bad.
here it is
  1. bool CWorldServer::LoadNPCs( )
  2. {
  3.     Log( MSG_LOAD, "NPC spawn        " );
  4.     MYSQL_ROW row;
  5.     MYSQL_RES *result = DB->QStore("SELECT `type`,`map`,`dir`,`x`,`y`,`dialogid` FROM `list_npcs`");
  6.     if(result==NULL) return false;
  7.     while(row = mysql_fetch_row(result))
  8.     {
  9.         CNPC* thisnpc = new (nothrow) CNPC;
  10.         if(thisnpc==NULL)
  11.         {
  12.             Log(MSG_ERROR, "Error allocing memory" );
  13.             DB->QFree( );
  14.             return false;
  15.         }
  16.         thisnpc->clientid = GetNewClientID();
  17.         thisnpc->npctype = atoi(row[0]);
  18.         thisnpc->posMap = atoi(row[1]);
  19.         thisnpc->dir = (float)atof(row[2]);
  20.         thisnpc->pos.x = (float)atof(row[3]);
  21.         thisnpc->pos.y = (float)atof(row[4]);
  22.         thisnpc->thisnpc = GetNPCDataByID( thisnpc->npctype );
  23.         if( thisnpc->thisnpc == NULL)
  24.         {
  25.             delete thisnpc;
  26.             continue;
  27.         }
  28.         thisnpc->thisnpc->dialogid = atoi(row[5]); // This is global to NPC type
  29.         MapList.Index[thisnpc->posMap]->AddNPC( thisnpc );
  30.     }
  31.     DB->QFree( );
  32.     return true;
littlemc
Little soul
Little soul
 
Posts: 7
Joined: Wed Jun 24, 2009 3:16 am

Re: Some help please

Postby PurpleYouko on Thu Jun 25, 2009 2:03 pm

You're missing a few lines of code that are in osprose
here's the osprose version.
  1.  
  2. bool CWorldServer::LoadNPCs( )
  3. {
  4.     Log( MSG_LOAD, "NPC spawn        " );
  5.     MYSQL_ROW row;
  6.     MYSQL_RES *result = DB->QStore("SELECT type,map,dir,x,y,dialogid FROM list_npcs");
  7.     if(result == NULL) return false;
  8.     while(row = mysql_fetch_row(result))
  9.     {
  10.         CNPC* thisnpc = new (nothrow) CNPC;
  11.         if(thisnpc == NULL)
  12.         {
  13.             Log(MSG_ERROR, "Error allocing memory" );
  14.             DB->QFree( );
  15.             return false;
  16.         }
  17.         thisnpc->clientid = GetNewClientID();
  18.         thisnpc->npctype = atoi(row[0]);
  19.         thisnpc->posMap = atoi(row[1]);
  20.         thisnpc->dir = (float)atof(row[2]);
  21.         thisnpc->pos.x = (float)atof(row[3]);
  22.         thisnpc->pos.y = (float)atof(row[4]);
  23.         thisnpc->thisnpc = GetNPCDataByID( thisnpc->npctype );
  24.         thisnpc->thisnpc->_EntityType = ENTITY_NPC;
  25.         if( thisnpc->thisnpc == NULL)
  26.         {
  27.             delete thisnpc;
  28.             continue;
  29.         }
  30.         thisnpc->thisnpc->dialogid = atoi(row[5]); // This is global to NPC type
  31.         MapList.Index[thisnpc->posMap]->AddNPC( thisnpc );
  32.         thisnpc->thisnpc->eventid = 0;
  33.     }
  34.     DB->QFree( );
  35.     return true;
  36. }


you definitely need this
thisnpc->thisnpc->eventid = 0;
It's debatable whether you need to add
thisnpc->thisnpc->_EntityType = ENTITY_NPC;
It's used in a few AIP functions but I'm not entirely sure we need it.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm


Return to Question Zone

Who is online

Users browsing this forum: No registered users and 2 guests