Search Results

Search found 3 results on 1 pages for 'jamesz'.

Page 1/1 | 1 

  • Problem with passing vector of pointers to objects to member function of another object

    - by Jamesz
    Hi, I have a vector of pointers to Mouse objects called 'mice'. I'm passing the mice to the cat by reference. vector <Mouse*> mice; Cat * c; c->lookForMouse(&mice); And here's my lookForMouse() member function void Cat::lookForMouse(vector <Mouse*> *mice) { ... } And now to the problem! Within the function above, I can't seem to access my mice. This below will not work mice[i]->isActive(); The error message I receive suggests to use mice[i].isActive(), but this throws an error saying isActive() is not a member of std::vector<_Ty ... This works though... vector <Mouse*> miceCopy = *mice; miceCopy[i]->isActive(); I understand that I shouldn't be creating another vector of mice here, it defeats the whole point of passing it by reference (let me know if I'm wrong)... Why can't I do mice[i]-isActive() What should I be doing? Thanks for your time and help :D James.

    Read the article

  • Cakephp cache only caching one file per action

    - by Jamesz
    Hi, I have a songs controller. Within the songs controller i have a 'view' action which get's passed an id, eg /songs/view/1 /songs/view/5 /songs/view/500 When a user visits /songs/view/1, the file is cached correctly and saved as 'songs_view_1.php' Now for the problem, when a user hit's a different song, eg /songs/view/2, the 'songs_view_1.php' is deleted and '/songs/view/2.php' is in it's place. The cahced files will stay there for a day if I don't visit a different url, and visiting a different action will not affect any other action's cached file. I've tried replacing my 'cake' folder (from 1.2 to 1.2.6), but that didn't do anything. I get no error messages at all and nothing in the logs. Here's my code, I've tried umpteen variations all ending up with the same problem. var $helpers = array('Cache'); var $cacheAction = array( 'view/' => '+1 day' ); Any ideas? EDIT: After some more testing, this code var $cacheAction = array( 'view/1' => "1 day", 'view/2' => "1 day" ); will cache 'view/1' or 'view/2', but delete the previous page as before. If I visit '/view/3' it will delete the cached page from before... sigh EDIT: Having the same issue on another server with same code...

    Read the article

  • glFog causing transparent png to lose transparency

    - by Jamesz
    Without glFog, my transparent png displays fine, but with it you can see the rectanglular background and strips of other colours (notice the other dirt material is working as intended, but not using a png or transparency). Here's my code for the fog: GLfloat colour[4]={0.8f,0.8f,1.0f, 1.0f}; glFogi(GL_FOG_MODE, GL_EXP); glFogfv(GL_FOG_COLOR, colour); glFogf(GL_FOG_DENSITY, 0.1); glHint(GL_FOG_HINT, GL_NICEST); glFogf(GL_FOG_START, 1.0); glFogf(GL_FOG_END, 5.0); glEnable(GL_FOG); glClearColor(0.8f,0.8f,1.0f,1.0f); And my code for the png: glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GLfloat myAmbient[] = {0.7,0.7,0.7,1.0}; glMaterialfv(GL_FRONT, GL_AMBIENT, myAmbient); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, plantTexture); glColor3f(0.5,0.5,0.2); glPushMatrix(); glTranslated(-1,-14,10); glScaled(10,10,10); glBegin(GL_QUADS); glNormal3f(0,0,1); glTexCoord2f(0,1); glVertex2i(1,0); glNormal3f(0,0,1); glTexCoord2f(0,0); glVertex2i(1,1); glNormal3f(0,0,1); glTexCoord2f(1,0); glVertex2i(0,1); glNormal3f(0,0,1); glTexCoord2f(1,1); glVertex2i(0,0); glEnd(); glPopMatrix(); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); I'm completely lost on this one. Any ideas?

    Read the article

1