string variables are not working in my game?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Urgh... sockets are already implicitly threaded by the OS. Non blocking sockets do everything that threading would do, without having to muck around with synchronisation.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Jim121
Posts: 21
Joined: Sat Oct 11, 2008 2:23 am

Post by Jim121 »

String does not name a type when I use the function in a included file.

main.cpp

Code: Select all

#include <iostream>
using namespace std;
#include "Random.cpp"

int main(){
    cout<<q.health;
    system("PAUSE");
    }
Random.cpp

Code: Select all

class player{
     public:
            float health;
            string random;
};
player q;
int b(){
    q.health++;
    }
int a;
thanks in advance.
Open Conquest Developer
web site:
http://openconquest.webs.com/
aanderse
Posts: 155
Joined: Sun Aug 10, 2008 2:02 pm
Location: Canada

Post by aanderse »

you're looking for irr::core::stringc or irr::core::stringw

don't bother using std string unless you have a compelling reason
prchakal
Posts: 58
Joined: Thu Sep 24, 2009 12:31 am

Post by prchakal »

Hi,

How to concat a text like "/path/to/models" with the irrlicht stringc ?

For example:

stringc modelName;
modelName = "knight.md2";
mesh = smgr->getMesh("/path/to/models/" + modelName); <-error
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can't add two character pointers (well, you can, but it won't work as expected), so just use core::stringc and the operator+
prchakal
Posts: 58
Joined: Thu Sep 24, 2009 12:31 am

Post by prchakal »

Can i suggest one thing?

You can create a overload method to :

Code: Select all

smgr->getMesh
To accept stringc, because today i have to do:

Code: Select all

smgr->getMesh(model.c_str())
Im saying it because the method:

Code: Select all

driver->getTexture
accept stringc

So i think that this method that we have to pass a string parameter can accept stringc

Its only my suggestion :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

That already happened for Irrlicht 1.6
Post Reply