Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Error parsing

 
Post new topic   Reply to topic Printable version
 View previous topic  Could any1 make me a bot about.... Post :: Post Help me (again LoL)  View next topic  
Author Message
The Arctica
Guest


Offline

PostPosted: Fri Dec 03, 2004 6:09 pm    Post subject: Error parsing Reply to topic Reply with quote

Hello,

I'm building a bot but the function doesn't really matter. Anyways, i'm trying to put a _listnode in it but it gives erros all the time. Here's the code and the error:

Code: Show/Hide
               int countnum=0;
               _listnode  *parse1 = playerlist->head;

               {
                  Player *p = parse1->item;

                  if (p->ship != SHIP_Spectator)
                  {
                     pilots[countnum].PlayerCall=String(p->name);
                     countnum++;
                  }

                  parse1 = parse1->next;
               }


Quote:
Compiling...
spawn.cpp
d:\bots\ds soccer\mervbot\src\soccer\spawn.cpp(69) : error C2440: 'initializing' : cannot convert from 'class _listnode<struct Player> *' to 'class _listnode *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\bots\ds soccer\mervbot\src\soccer\spawn.cpp(72) : error C2440: 'initializing' : cannot convert from ' *' to 'struct Player *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\bots\ds soccer\mervbot\src\soccer\spawn.cpp(76) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class String' (or there is no acceptable conversion)
d:\bots\ds soccer\mervbot\src\soccer\spawn.cpp(80) : error C2440: '=' : cannot convert from 'class _listnode<AnonymousStruct> *' to 'class _listnode *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
command.cpp
Error executing cl.exe.

soccer.dll - 4 error(s), 0 warning(s)
Back to top
-Smong-
Guest


Offline

PostPosted: Fri Dec 03, 2004 6:22 pm    Post subject: Reply to topic Reply with quote

Quote:
_listnode *parse1 = playerlist->head;
Maybe lose the '*'.

Quote:
pilots[countnum].PlayerCall=String(p->name);

You can't assign a String to PlayerCall, which is interesting as I have seen people post code like:
Code: Show/Hide
String s = "*setfreq ";
s += p->ship;
Where assignment is done.
Back to top
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Dec 03, 2004 6:32 pm    Post subject: Reply to topic Reply with quote

The Arctica wrote:
_listnode *parse1 = playerlist->head;

Actually, you need to specify the struct type. _listnodes can store any kind of data whatever, so (to put it simply), you must tell the compiler what type of stuff you're putting in it right now. Example "_listnode <Player> *parsel;" which is what you need to use here.

The Arctica wrote:
pilots[countnum].PlayerCall=String(p->name);

There's an error there, but what Smong said isn't the problem. What datatype is PlayerCall?
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
50% Packetloss
Server Help Squatter


Age:40
Gender:Gender:Male
Joined: Sep 09 2003
Posts: 561
Location: Santa Clarita, California
Offline

PostPosted: Fri Dec 03, 2004 8:37 pm    Post subject: Reply to topic Reply with quote

Code: Show/Hide

int countnum=0;
               _listnode <Player> *parse1 = playerlist->head;

while(parse1 != NULL)
               {
                  Player *p = parse1->item;

                  if (p->ship != SHIP_Spectator)
                  {
                     //pilots[countnum].PlayerCall=String(p->name);

//if PlayerCall is of the type String then you can just do PlayerCall= p->name and it work. Otherwise, if its a char[20] then you use strncpy or strcpy to copy in the player's name. Hopefully there is some control over how many piolets are in the game or you might have a buffer overrun on that pilots array. Dont overindex it!
                     countnum++;
                  }

                  parse1 = parse1->next;
               }
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
The Arctica
Guest


Offline

PostPosted: Sat Dec 04, 2004 2:42 am    Post subject: Error parsing Reply to topic Reply with quote

Code: Show/Hide
Compiling...
spawn.cpp
command.cpp
Linking...
   Creating library Debug/soccer.lib and object Debug/soccer.exp

soccer.dll - 0 error(s), 0 warning(s)


Thanks alot guys! icon_biggrin.gif
Back to top
SuSE
Me measures good


Joined: Dec 02 2002
Posts: 2307
Offline

PostPosted: Sat Dec 04, 2004 4:02 am    Post subject: Reply to topic Reply with quote

$3
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Sat Dec 04, 2004 11:55 am    Post subject: Reply to topic Reply with quote

When you're finished w/ your plugin, don't compile it w/ DEBUG mode in MSVC
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 132 page(s) served in previous 5 minutes.

phpBB Created this page in 0.461782 seconds : 31 queries executed (94.1%): GZIP compression disabled