Server Help

Bot Questions - MERVBot with Eclipse?

Samapico - Mon Sep 06, 2010 12:58 pm
Post subject: MERVBot with Eclipse?
Anyone ever made mervbot plugins with Eclipse?

I seem to be having trouble getting it to run properly...

I installed MinGW, all the include paths are set...


I get dozens of errors like this:
..\spawn.cpp:583:37: error: no matching function for call to 'botInfo::tell(BotEvent)'
Everytime a tell is called, like:
Code: Show/Hide

void botInfo::sendPublic(char *msg)
{
   tell(makeSay(MSG_Public, 0, 0, msg));
}


This refers to this function:
Code: Show/Hide
void botInfo::tell(BotEvent &event)
{
   if (callback && handle)
   {
      event.handle = handle;
      callback(event);
   }
}

What is the '&' for in the declaration?
Edit: Apparently void (int *a) { *a += 5; } is equivalent to void (int &a) { a += 5; } , looks confusing to me, but whatever tongue.gif (Thanks to JoWiE)

Also, a bunch of these:
..\spawn.cpp:205:38: error: cast from 'void*' to 'Uint16' loses precision
These aren't warnings, they're errors...

I also get hundreds of these warnings:
..\/..\player.cpp:89:19: warning: deprecated conversion from string constant to 'char*'
Anytime a "string" is passed to a function that takes a char*


What's wrong?
Samapico - Mon Sep 06, 2010 1:57 pm
Post subject:
I'm on windows 7 x64, if that's any help
Samapico - Mon Sep 06, 2010 3:17 pm
Post subject:
Got rid of the "cast from 'void*' to 'Uint16' loses precision " errors by changing all these casts to 'int'. void* and int are guaranteed to be the same size, so I guess g++ likes that more, or something.

Stuck with:
..\spawn.cpp:588:39: error: no matching function for call to 'botInfo::tell(BotEvent)'
..\spawn.cpp:41:6: note: candidate is: void botInfo::tell(BotEvent&)

hmm
Samapico - Mon Sep 06, 2010 3:27 pm
Post subject:
Possible solution:

Code: Show/Hide

void botInfo::sendPublic(char *msg)
{
   tell(makeSay(MSG_Public, 0, 0, msg));
}

changed to:
Code: Show/Hide

void botInfo::sendPublic(char *msg)
{
   BotEvent evt = makeSay(MSG_Public, 0, 0, msg)
   tell(evt);
}




Yep... that did the trick... was a pain in the butt to change all over the place though.
cycad - Tue Sep 07, 2010 2:46 pm
Post subject:
Careful, void* and int aren't necessarily the same size on x64, and I don't know of any standard that guarantees they would be.

As for the string conversion warnings, you can disable them with -Wno-write-strings
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group