'y' was not declared in this scope

0

56 21 C:\Users\Raven\Desktop\tibiafun\position.h [Error] 'y' was not declared in this scope

#ifndef __OTSERV_POS_H
#define __OTSERV_POS_H

#include <cmath>
#include <iostream>


enum Direction {
	NORTH = 0,
	EAST = 1,
	SOUTH = 2,
	WEST = 3,
	SOUTHWEST = 4,
	SOUTHEAST = 5,
	NORTHWEST = 6,
	NORTHEAST = 7,
};

class Position {
public:

  // for now we just initialise the position to a startpoint
  //Position() : x(247), y(218), z(7) { };
  Position() : x(31), y(31), z(7) { };
	~Position() {};

	 Position(int32_t _x, int32_t _y, int32_t _z)
	: x(_x), y(_y), z(_z) {};

	int32_t x,y,z;

	bool operator<(const Position& p) const {
		if(z < p.z)
			return true;
		if(z > p.z)
			return false;

		if(y < p.y)
			return true;
		if(y > p.y)
			return false;

		if(x < p.x)
			return true;
		if(x > p.x)
			return false;

		return false;
	}

	bool operator>(const Position& p) const {
		return ! (*this < p);
	}

	bool operator==(const Position p)  const {
		if(p.x==x && p.y==y && p.z ==z)
			return true;
		else
			return false;
	}

	bool operator!=(const Position p)  const {
		if(p.x==x && p.y==y && p.z ==z)
			return false;
		else
			return true;
	}

	Position operator-(const Position p1){
		return Position(x-p1.x, y-p1.y,z-p1.z);
	}

	/*
	void dist(){
		x=abs(x);
		y=abs(y);
		z=abs(z);
	}
		
	bool operator==(const position p){
		return (x==p.x && y== p.x && z==p.z);
	}
	*/

};

std::ostream& operator<<(std::ostream&, const Position&);
std::ostream& operator<<(std::ostream&, const Direction&);


class PositionEx : public Position{
public:  
    PositionEx() { };
    ~PositionEx() {};

    PositionEx(int32_t _x, int32_t _y, int32_t _z, int32_t _stackpos)
        : Position(_x,_y,_z), stackpos(_stackpos) {};

    PositionEx(int32_t _x, int32_t _y, int32_t _z)
        : Position(_x,_y,_z), stackpos(0) {};

    PositionEx(Position p)
        : Position(p.x,p.y,p.z), stackpos(0) {};

    PositionEx(Position p,int32_t _stackpos)
        : Position(p.x,p.y,p.z), stackpos(_stackpos) {};

    int32_t stackpos;

    bool operator==(const PositionEx p)  const
    {
        if(p.x==x && p.y==y && p.z ==z && p.stackpos == stackpos)
            return true;
        else
            return false;
    }

    bool operator!=(const PositionEx p)  const
    {
        if(p.x==x && p.y==y && p.z ==z && p.stackpos != stackpos)
            return false;
        else
            return true;
    }

};


#endif
 
0
  1. Analizuj wyłącznie pierwszy błąd który podaje kompilator, no przynajmniej dopóki nie będziesz przynajmniej średnio zaawansowany.
  2. Gdzie masz deklaracje tego int32_t ?
0

tzn ?
arraySystem::Int32,2^ t2;

0

Tak to jest jak dzieci próbują robić OTSy :D

0

dodałem #include <stdint.h>
i działa problem z __int rozwiązałem a co zrobić z tym _y?

0

skompilować jeszcze raz.

0

teraz taki problem mam 144 10 [Error] 'xmlNodePtr' does not name a type

up wziąłem pierwszy lepszy source do gry i chce się uczyć naprawiając i sobie pisząc w notatniku trochę głupi sposób nauki no ale cóż

0

I którego słowa nie rozumiesz w komunikacie kompilatora?

0
_13th_Dragon napisał(a):

I którego słowa nie rozumiesz w komunikacie kompilatora?

nie określa typu?

0

Czyli kompilator uważa że xmlNodePtrnie jest żadnym typem.
Czyli to samo co z int32_t

0
_13th_Dragon napisał(a):

Czyli kompilator uważa że xmlNodePtrnie jest żadnym typem.
Czyli to samo co z int32_t

dodałem #include <stdint.h>
ale nie działa

0

Chrzani waść: http://ideone.com/Q7HWgb

0
_13th_Dragon napisał(a):

Chrzani waść: http://ideone.com/Q7HWgb

działa działa ale to nie spojrzałem bo to chodzi o ten pliczek
[spoiler]#ifndef __OTSERV_ITEM_H
#define __OTSERV_ITEM_H

*#include <libxml/parser.h> * usuniete
#include <iostream>
#include <list>
#include <vector>

#include "thing.h"
#include "items.h"

class Creature;
class Player;
class Container;

class Item : public Thing
{
protected:
uint16_t id; // the same id as in ItemType
unsigned char count; // number of stacked items
unsigned char chargecount; //number of charges on the item
unsigned char fluid;
uint16_t actionId;
uint16_t uniqueId;
std::string *specialDescription;
std::string *text; //text written
std::string *writer; //Last person that wrote

#ifdef YUR_RINGS_AMULETS
int32_t time;
int32_t charges;
#endif //YUR_RINGS_AMULETS
std::string *readable;

private:
int useCount;

public:
static Item* CreateItem(const uint16_t _type, uint16_t _count = 0); //Factory member to create item of right type based on type
static Items items;

uint16_t getID() const;    // ID as in ItemType
void setID(unsigned short newid);
   std::string getWriter();
   void setWriter(std::string name);

   virtual Container* getContainer()
   {
    return NULL;
   }
   virtual const Container* getContainer() const
   {
    return NULL;
   }

WeaponType getWeaponType() const;
amu_t	getAmuType() const;
subfight_t getSubfightType() const;
virtual double getWeight() const;
   int32_t getAttack() const;
   int32_t getArmor() const;
   int32_t getDefense() const;
   int32_t getSlotPosition() const;
   int32_t getRWInfo() const;
   int32_t getWorth() const;

bool isBlocking() const;
bool isStackable() const;
bool isFluidContainer() const;
#ifdef HUCZU_LOOT_INFO
   bool isContainer() const;
   #endif //HUCZU_LOOT_INFO
//bool isMultiType() const;
bool isAlwaysOnTop() const;
bool isGroundTile() const;
bool isSplash() const;
bool isNotMoveable() const;
bool isPickupable() const;
bool isWeapon() const;
   bool isShield() const;
bool isUseable() const;
   bool isWand() const;

bool floorChangeDown() const;
bool floorChangeNorth() const;
bool floorChangeSouth() const;
bool floorChangeEast() const;
bool floorChangeWest() const;

#ifdef YUR_RINGS_AMULETS
void setItemTime(int32_t _time)
{
time = _time;
}
void setCharges(int32_t _charges)
{
charges = _charges;
}
int32_t getCharges() const
{
return charges;
}
int32_t getTime() const
{
return time;
}
void useCharge()
{
--charges;
}
void useTime(int32_t thinkTicks)
{
time -= thinkTicks;
}
void setGlimmer();
void removeGlimmer();
#endif //YUR_RINGS_AMULETS
void setReadable(const std::string& text)
{
readable = new std::string(text);
}
#ifdef TP_TRASH_BINS
bool isDeleter() const { return items[id].isDeleter; }
#endif //TP_TRASH_BINS
bool decoration;
#ifdef HUCZU_LOOT_INFO
virtual std::string getLootDescription() const;
#endif //HUCZU_LOOT_INFO

virtual std::string getDescription(bool fullDescription) const;
std::string getName() const ;
void setSpecialDescription(std::string desc);
std::string getSpecialDescription();
void clearSpecialDescription();
void setText(std::string desc);
void clearText();
   std::string getText();

virtual int32_t unserialize(xmlNodePtr p);
virtual xmlNodePtr serialize();

// get the number of items
uint16_t getItemCountOrSubtype() const;
void setItemCountOrSubtype(unsigned char n);

unsigned char getItemCharge() const {return chargecount;};
void setItemCharge(unsigned char n) {chargecount = n;};

unsigned char getFluidType() const {return fluid;};
void setFluidType(unsigned char n) {fluid = n;};

void setActionId(uint16_t n);
uint16_t getActionId() const;

void setUniqueId(uint16_t n);
uint16_t getUniqueId() const;

virtual int32_t getDecayTime();
bool canDecay();

/**
 * Called when the item is about to decay/transform to the next step.
 * \returns The item to decay to.
 */
virtual Item* decay();
bool isDecaying;

bool rotate();

// Constructor for items
Item(const uint16_t _type);
Item(const uint16_t _type, uint16_t _count);
Item();
Item(const Item &i);

virtual ~Item();
virtual void useThing() {
	//std::cout << "Item: useThing() " << this << std::endl;
	useCount++;
};

virtual void releaseThing() {
	useCount--;
	//std::cout << "Item: releaseThing() " << this << std::endl;
	//if (useCount == 0)
	if (useCount <= 0)
		delete this;
};

virtual bool canMovedTo(const Tile *tile) const;

};

class Teleport : public Item
{
public:
Teleport(const uint16_t _type);
virtual ~Teleport();
virtual void useThing() {
//std::cout << "Teleport: useThing() " << this << std::endl;
useCount++;
};

virtual void releaseThing() {
	useCount--;
	//std::cout << "Teleport: releaseThing() " << this << std::endl;
	//if (useCount == 0)
	if (useCount <= 0)
		delete this;
};

void setDestPos(const Position &pos) {destPos = pos;};
const Position& getDestPos() const {return destPos;};

private:
int32_t useCount;
virtual int32_t unserialize(xmlNodePtr p);
virtual xmlNodePtr serialize();
Position destPos;
};

#endif
[/spoiler]

0

i mam jeszcze takie małe pytanko ten source jest pod linuxa.to da radę powoli przerobić to pod windowsa?

1

Owszem, ale z twoją wiedzą obstawiam czas wykonania w okolice 3-ch lat.

0
_13th_Dragon napisał(a):

Owszem, ale z twoją wiedzą obstawiam czas wykonania w okolice 3-ch lat.

a znasz może jakiś dobry sposób na szybko naukę ?

0

Tak, da się nauczyć języka programowania na poziomie średnio zaawansowanym w tydzień.
Ale jest jeden warunek: - musisz już znać jakiś tuzin innych języków z czego kilka na poziomie zaawansowanym.

0
_13th_Dragon napisał(a):

Tak, da się nauczyć języka programowania na poziomie średnio zaawansowanym w tydzień.
Ale jest jeden warunek: - musisz już znać jakiś tuzin innych języków z czego kilka na poziomie zaawansowanym.

hmm a jakie masz na myśli php,js?

1 użytkowników online, w tym zalogowanych: 0, gości: 1