Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 04 Jul 2012
Offline Last Active Aug 24 2015 04:26 AM

Topics I've Started

Issues with IDE Linker? Why is this happening, and how do i fix it?

05 April 2015 - 01:11 PM

Hello, recently i separated one file intro multyple, now i am having compiler complain some of classes having unknown variables.

//The function
int Object::GetAttackDamage()
	int damage = 0;
	if (inventory != NULL)
		BaseItem * equWep = unit->GetEquipedWeapon();
		if (equWep != NULL)
			damage += equWep->wepDamage;

		damage += unit->attackDamage;
	return damage;

//The error
C:/Prog/Code/src/Objects.cpp:155:22: error: 'class BaseItem' has no member named 'wepDamage'
damage += equWep->wepDamage; 

I can confirm that Objects.cpp includes Inventory.h which includes BaseItem.h Which has class BaseItem which inherites BaseItemWeapon which has this member, its publicly inherited so its visible. I don't know whats happening, or what have i done wrong sad.png


Here are raw cut outs of data from project, its clearly visible it is correct AFAIK.



What are common issues, and how would i go solving this issue? I have no clue what to do...

A list of commands for units in 2D RPG, a way to handle it.

16 January 2015 - 05:37 PM

So i am up to this seemingly tough problem, i would like some opinions, and thoughts on how to solve it, or deal with it in a good(Efficient) way.
I have 2D Rpg, where AI can do specific tasks, but i cannot tell it to do a list of them.
For example: I want to do this:
Give unit a order: Go talk to quest_giver_person, receive quest, and finish it.
That would be something like this code vise:
//Unit* unit;
0: unit->moveToTargetUntilInRadius(quest_giver_person.position, glob::COMMUNICATION_RADIUS);//To be very simple, this gets you to target until you are in radius given
1: unit->getQuestFrom(quest_giver_person);//AI Logic handles this, and gets quest
Now we let this execute, we start from 0: this would make the unit generate a path to the given target so the list of commands would look like
We also, regenerate the path every so often, so we actually get to the target if he repositioned.
//Unit* unit;
0: unit->moveUntilPathFinished();//Follows generated path, handles exceptions like collision that shouldn't occur, but gets you to target location in the end
1: unit->moveToTargetUntilInRadius(quest_giver_person.position, glob::COMMUNICATION_RADIUS);//To be very simple, this gets you to target until you are in radius given
2: unit->getQuestFrom(quest_giver_person);//AI Logic handles this, and gets quest
Now 0 command finished, it gets erased and we continue
//Unit* unit;
0: unit->moveToTargetUntilInRadius(quest_giver_person.position, glob::COMMUNICATION_RADIUS);//To be very simple, this gets you to target until you are in radius given
1: unit->getQuestFrom(quest_giver_person);//AI Logic handles this, and gets quest
Now we are in quest_giver_person radius so 0 also gets errased so we get left with
//Unit* unit;
1: unit->getQuestFrom(quest_giver_person);//AI Logic handles this, and gets quest
This would generate a new list of stuff for the AI to do.
I hope this explains the principle of what i am trying to achieve. I will be active if you have questions, or if i missed some crucial data, i will supply it asap!
How the unit is structured, and some functions that would be used in this example:

int main()

int a = 1;
namespace uni
enum MovementType
MTNone = 0,
MTPath = 2,
MTKeysButton = 3,
MTPatrol = 4
class UnitMovement
uni::MovementType moveType;
glob::Direction movDirectionX;
glob::Direction movDirectionY;
bool isMoving;
double moveSpeed;
std::vector<sf::Vector2f> listPath;
int moveTargetVecID;//Target vecID to follow
glob::Direction facingDirection;
int patrolVecID;//This is ID, that indicates to which note in listPath to move to
int patrolIncrementValue;//This is to know if moving forward on path or backwards
unsigned int patrolAmountOfTimes;
UnitMovement(double MoveSpeed);
UnitMovement(double MoveSpeed, const std::vector<sf::Vector2f> & ListPath);
void setMoveToLocation(Object & me, const sf::Vector2f & position);
void setMoveToLocationSmart(Object & me, const sf::Vector2f & position);//Uses AStar
void setAllMovementToHalt();
void setPatrolToLocation(Object & me, const sf::Vector2f & position, unsigned int TimesToPatrol = glob::MaxUI);
void setPatrolPath(Object & me, std::vector<sf::Vector2f> & listPath, unsigned int TimesToPatrol = glob::MaxUI);
void AssignFollowTarget(Object & obj);
void SetFacingDirection(glob::Direction dir, Object & me);
class Unit : public UnitMovement, public UnitBattle ...
    LoopUnit();//Loops unit specific stuff like movement, following paths, and executes it on the unit effectively causing un
//it to reposition, and calls LoopUnitAI()
    LoopUnitAI();//Loops unit AI specific stuff if unit controller is AI
class Object
    std::unique_ptr<Unit> unit;
class ObjectHolder
    std::vector<Object> listObject;
    LoopObjects();//Handles objects logic, and calls LoopUnit()

I gave it a though with teammate, and the result is pretty poor, it will work but i don't like that:
How it would work is:
Have a function that would take action, and be able to tell unit what to do with the action.
For example:

int a = 0;//C++ syntax PLS!
enum Command
    none = 0,
    moveToTargetUntilInRadius = 1,
    getQuestFrom = 2
class Action
    Command commandType;
    //Whatever std::bind requires to be stored
    Action(Command CommandType, whatever_std::bind_requires);
//Will probably use std::list for the final product, but i haven't used list in ages so i'l use vector in this example
std::vector<Action> listActions;//This would be the list that unit has
//This is how it would add stuff to the list
listActions.push_back(Action(Command::moveToTargetUntilInRadius, std::bind(target_unit->objVectorID)));

And this should work, i need to prototype it first, but its idea we came up with.

Returning a nullptr refence, how bad is my teammate?

15 January 2015 - 04:17 PM

Does anyone find this code being very bad?

Can you rate this from 0 to 10. I am very interested what is your opinion on returning a reference that is nullptr.

const std::string &SoundHandler::getPlayingFromPlaylist(const std::string& playlistName)
    //Check to see if the playlist exists
    auto iter = playlists.find(playlistName);
    if(iter == playlists.end())
        return nullptr;

    return playlists[playlistName].currentlyPlaying;

cryptopp, issues. every first time i try to build it i get errors, but then it compiles

12 November 2014 - 07:37 AM


I am running win7 IDE:CodeLite Compiler:TDM-GCC-64

Selfbuild cryptopp, also tried pre compiled one.
My teammate is using cryptopp library, and he added it intro project. Now i am having issues. I built it many times, also tried using teammates ones since we run same OS and compiler, and i am getting same issue.

The issue is when i have change in a file that in any way includes cryptopp i will get this error log


When i press build again i get this log



My issue is that anytime i change a file i have to (Compile 2 times in order to actually get executable) press compile, wait, press compile and only then i am ready which takes on average 2+ minutes and its getting on my nerves...


Any ideas what may be causing it, i am ready to do anything!

Switching IDE, having issue with "code completion"?

20 October 2014 - 01:51 AM



I don't know a name of IDE window that pops up that shows members of a class you are writing can you help?

For example when i have

//This is declared
class C
    int m1;
    int m2;
std::vector<C> vec; 
//and i type

when my input is after "." character i should get a list of all members (At least in visual studio i did) But in code blocks i don't, Cannot figure out why. Whats the name of the window that pops up, or do you know why i am not getting the member list when using vector in given case above.

The windows shows up with all data on some stuff, but on some stuff i cannot get anything even when i press ctrl + space.