Mam malutki problem, wklejam kod ju? 3 raz, dok?adnie tak jak jest opisane - lecz mam wci?? taki sam problem.
http://tibia.net.pl/threads/573972-7-6-Creaturescripts
http://tibia.net.pl/threads/573972-7-6-Creaturescripts
PHP:
D__MIZIAK_TRADE_FIX__ -D_ADRIK_FOLLOW -D__MIZIAK_TASKS__ -fexpensive-optimizations -O3 -g3
../actions.cpp: In member function `bool Actions::loadFromXml(const std::string&)':
../actions.cpp:135: error: `readXMLString' was not declared in this scope
../actions.cpp: In member function `bool Actions::UseItemEx(Player*, const Position&, unsigned char, const Position&, unsigned char, short unsigned int)':
../actions.cpp:370: error: a function-definition is not allowed here before '{' token
make.exe: *** [obj/actions.o] Error 1
Execution terminated
PHP:
bool Actions::loadFromXml(const std::string &_datadir)
{
this->loaded = false;
Action *action = NULL;
datadir = _datadir;
std::string filename = datadir + "actions/actions.xml";
std::transform(filename.begin(), filename.end(), filename.begin(), tolower);
xmlDocPtr doc = xmlParseFile(filename.c_str());
if (doc){
this->loaded=true;
xmlNodePtr root, p;
root = xmlDocGetRootElement(doc);
if (xmlStrcmp(root->name,(const xmlChar*) "actions")){
xmlFreeDoc(doc);
return false;
}
p = root->children;
while (p)
{
const char* str = (char*)p->name;
if (strcmp(str, "action") == 0){
int itemid,uniqueid,actionid;
if(readXMLInteger(p,"itemid",itemid)){
action = loadAction(p);
useItemMap[itemid] = action;
action = NULL;
}
else if(readXMLInteger(p,"uniqueid",uniqueid)){
action = loadAction(p);
uniqueItemMap[uniqueid] = action;
action = NULL;
}
else if(readXMLInteger(p,"actionid",actionid)){
action = loadAction(p);
actionItemMap[actionid] = action;
action = NULL;
}
else{
std::cout << "missing action id." << std::endl;
}
}
else if(strcmp(str, "creature") == 0)
{
std::string evt;
if(readXMLString(p,"event",evt))
{
action = loadAction(p);
std::string id = (char*)xmlGetProp(p,(xmlChar*)"id");
evt += id;
creatureScriptMap[evt] = action;
action = NULL;
}else
puts("missing event declatation.");
}
p = p->next;
}
xmlFreeDoc(doc);
}
return this->loaded;
}