About Store Forum Documentation Contact



Post Reply 
Error: Element out of range
Author Message
Babulesnik Offline
Member

Post: #1
Error: Element out of range
File "d:\vs2010ultimatum\vc\include\esenthelengine\memory\_memc.h"
Line 14.

What should I do?
04-18-2011 11:35 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #2
RE: Error: Element out of range
place a check before accessing an element.

if(items.elms())
// do something

There is always evil somewhere, you just have to look for it properly.
04-18-2011 12:20 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #3
RE: Error: Element out of range
I have to work with memory only this code:
Code:
Game::ObjMemx<Game::Static> Statics;
Game::ObjMemx<Game::Animatable>ObjAnimatable;
Game::ObjMemx<Game::ObjParticles> ObjParticles;
Game::ObjMemx<Game::ObjLightPoint> ObjLightPoint;
Forgot to say that the error occurred after the upgrade.
The code is small, the whole of the code:
Code:
#include "stdafx.h"
#include "C:/Documents and Settings/Дима/Рабочий стол/EsenthelEngineSDK/Data/enum/_enums.h"

Str Anim="";
void UpdateAnim(Game::Animatable *ObjAnimatable,Str PathAnimation,Flt Time)
{
ObjAnimatable->cskel.clear().animate(PathAnimation,Time).updateMatrix(ObjAnimatable->matrix()).updateVelocities(false);
}
Game::ObjMemx<Game::Static> Statics;
Game::ObjMemx<Game::Animatable>ObjAnimatable;
Game::ObjMemx<Game::ObjParticles> ObjParticles;
Game::ObjMemx<Game::ObjLightPoint> ObjLightPoint;


void InitPre()
{
   App.name("World Manager");
   App.flag=APP_MS_EXCLUSIVE|APP_FULL_TOGGLE;
   DataPath("../data");
   Paks.add("engine.pak");

   D.full(true).hpRt(true).hdr(true).volLight(true);//.superSample(4);

   Cam.dist =10;
   Cam.yaw  =-PI_4;
   Cam.pitch=-0.5f;
   Cam.at.set(16,0,16);
}
Bool Init()
{
    Anim="Anim/1.anim";
   Physics.create(CSS_NONE,true,"../Installation/PhysX");

   Game::World.init();

   Game::World.setObjType(Statics,OBJ_STATIC)
              .setObjType(ObjParticles,OBJ_PARTICLES)
              .setObjType(ObjLightPoint,OBJ_LIGHT_POINT)
              .setObjType(ObjAnimatable,OBJ_ANIMATABLE);


   Game::World.New("C:/Documents and Settings/Дима/Рабочий стол/EsenthelEngineSDK/Data/World/test.world");

   Game::World.update(Cam.at);

   return true;
}
/******************************************************************************/
void Shut()
{
}
/******************************************************************************/
Bool Update()
{
   if(Kb.bp(KB_ESC))return false;
   CamHandle(0.1f,100,CAMH_ZOOM|(Ms.b(1)?CAMH_MOVE:CAMH_ROT));

   Game::World.update(Cam.at);
  
   ObjAnimatable[0].update();
   if(Kb.b(KB_LEFT))
   {
       Anim="Anim/2.anim";
   }
   UpdateAnim(&ObjAnimatable[0],Anim,Time.time()/10);
   return true;
}
/******************************************************************************/
void Render()
{
Game::World.draw();
}
void Draw()
{
   Renderer(Render);
   D.text(0,0,S+Time.fps());
}
(This post was last modified: 04-18-2011 12:51 PM by Babulesnik.)
04-18-2011 12:49 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #4
RE: Error: Element out of range
you don't check if ObjAnimatable[0].update(); is actually there.

so:
if(ObjAnimatable.elms()) ObjAnimatable[0].update();

this should fix your problem.

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 04-18-2011 12:54 PM by Dynad.)
04-18-2011 12:54 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #5
RE: Error: Element out of range
(04-18-2011 12:54 PM)Dynad Wrote:  you don't check if ObjAnimatable[0].update(); is actually there.

so:
if(ObjAnimatable.elms()) ObjAnimatable[0].update();

this should fix your problem.

Thank you! This code was commented out, but after the upgrade, I removed the comments and began to appear remarks error. Because of this, I thought that is associated with

PS I should be more careful ...
04-18-2011 01:10 PM
Find all posts by this user Quote this message in a reply
Post Reply