What's new

Kompilacja Creaturescripts - kompilacja

Status
Not open for further replies.

Pucek1993

Active User
Joined
Feb 4, 2016
Messages
71
Reaction score
1
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

tt7pXft.jpg


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;
}
 

Bruce

Active User
Joined
Dec 13, 2008
Messages
112
Reaction score
6
Age
29
Odp: Creaturescripts - kompilacja

Ten kod jest ?le podany, tzn brakuje w nim jeszcze paru funkcji i ?le jest opisane co gdzie pod czym. Na forum gdzie pojawi? si? on pierwotnie wszystkie poprawki by?y w postach :p Zamieszczam wam source czystego yurka w kt?rym w tamtym roku go "poskleja?em" . Wystarczy wkleja? dok?adnie tak jak jest u mnie w projekcie a je?eli b?dzie czego? brakowa? - szuka? i dok?ada?.



Pozdrawiam, Zark
 

Pucek1993

Active User
Joined
Feb 4, 2016
Messages
71
Reaction score
1
Odp: Creaturescripts - kompilacja

Dzi?kuj? Ci bardzo, tak my?la?em - uda?o mi si? na podstawie Kentany 3.0 naprawi? jeden b??d, lecz deklaracji readXMLstring niestety nie uda?o mi si? ogarn?? :)

Kurcz?, wyci??em ale nadal jest jaki? problem, mo?e nie wszystko wyci??em .. mhm :p

PHP:
../game.cpp: In member function `void GameState::onAttackedCreature(Tile*, Creature*, Creature*, int, bool)':
../game.cpp:684: error: 'class Player' has no member named 'dieorlogout'

../game.cpp: In member function `bool Game::removeCreature(Creature*)':
../game.cpp:1235: error: 'class Player' has no member named 'dieorlogout'

make.exe: *** [obj/game.o] Error 1

Execution terminated

edit x2.

Wystarczy?o doda? w player.cpp > "bool dieorlogout;" i posz?o :) Wieczorkiem sprawdz? czy nie crashuje :D
 
Last edited:
Status
Not open for further replies.
Top