Index: /branches/network/src/defs/class_id.h
===================================================================
--- /branches/network/src/defs/class_id.h	(revision 6692)
+++ /branches/network/src/defs/class_id.h	(revision 6693)
@@ -179,4 +179,5 @@
   CL_SPAWNING_POINT             =    0x0000020c,
   CL_MD2_CREATURE               =    0x0000020d,
+  CL_HOVER                      =    0x0000020e,
 
   CL_TURRET_POWER_UP            =    0x00000211,
@@ -209,4 +210,5 @@
 
   CL_WEAPON_MANAGER             =    0x00000503,
+  CL_AMMO_CONTAINER             =    0x00000504,
   CL_HUD                        =    0x00000520,
 
Index: /branches/network/src/lib/graphics/importer/material.cc
===================================================================
--- /branches/network/src/lib/graphics/importer/material.cc	(revision 6692)
+++ /branches/network/src/lib/graphics/importer/material.cc	(revision 6693)
@@ -81,5 +81,5 @@
     ResourceManager::getInstance()->unload(this->diffuseTexture);
   if (m.diffuseTexture != NULL)
-    this->diffuseTexture = m.diffuseTexture; /// HACK shoudl be:(Texture*)ResourceManager::getInstance()->load();
+    this->diffuseTexture = (Texture*)ResourceManager::getInstance()->copy(m.diffuseTexture);
   this->ambientTexture = NULL; /// FIXME
   this->specularTexture = NULL; /// FIXME
@@ -303,5 +303,5 @@
   //! @todo Textures from .mtl-file need special care.
   if (dMap != NULL)
-    this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (void*)&target);
+    this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE, RP_GAME, (int)target);
   else
     this->diffuseTexture = NULL;
Index: /branches/network/src/lib/graphics/importer/md2Model.cc
===================================================================
--- /branches/network/src/lib/graphics/importer/md2Model.cc	(revision 6692)
+++ /branches/network/src/lib/graphics/importer/md2Model.cc	(revision 6693)
@@ -78,5 +78,5 @@
 {
   /* this creates the data container via ressource manager */
-  this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, (void*)skinFileName);
+  this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName);
   if( unlikely(this->data == NULL))
     PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
Index: /branches/network/src/lib/graphics/shader.cc
===================================================================
--- /branches/network/src/lib/graphics/shader.cc	(revision 6692)
+++ /branches/network/src/lib/graphics/shader.cc	(revision 6693)
@@ -106,5 +106,5 @@
 Shader* Shader::getShader(const char* vertexShaderFile, const char* fragmentShaderFile)
 {
-  return (Shader*)ResourceManager::getInstance()->load(vertexShaderFile, SHADER,  RP_LEVEL, (void*)fragmentShaderFile);
+  return (Shader*)ResourceManager::getInstance()->load(vertexShaderFile, SHADER,  RP_LEVEL, fragmentShaderFile);
 }
 
Index: /branches/network/src/lib/graphics/text_engine/text.cc
===================================================================
--- /branches/network/src/lib/graphics/text_engine/text.cc	(revision 6692)
+++ /branches/network/src/lib/graphics/text_engine/text.cc	(revision 6693)
@@ -92,5 +92,5 @@
   if (fontFile != NULL)
   {
-    tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, &fontSize);
+    tmpFont = (Font*)ResourceManager::getInstance()->load(fontFile, TTF, RP_GAME, (int)fontSize);
     if (tmpFont != NULL)
       this->font = tmpFont;
Index: /branches/network/src/lib/lang/base_object.cc
===================================================================
--- /branches/network/src/lib/lang/base_object.cc	(revision 6692)
+++ /branches/network/src/lib/lang/base_object.cc	(revision 6693)
@@ -13,5 +13,5 @@
    ### File Specific:
    main-programmer: Patrick Boenzli
-   co-programmer: ...
+   co-programmer: Benjamin Grauer
 */
 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_BASE
Index: /branches/network/src/lib/particles/Makefile.am
===================================================================
--- /branches/network/src/lib/particles/Makefile.am	(revision 6692)
+++ /branches/network/src/lib/particles/Makefile.am	(revision 6693)
@@ -11,4 +11,5 @@
 			spark_particles.cc \
 			model_particles.cc \
+			dot_particles.cc \
 			\
 			quick_animation.cc
@@ -22,4 +23,5 @@
 			spark_particles.h \
 			model_particles.h \
+			dot_particles.h \
 			\
 			quick_animation.h
Index: /branches/network/src/lib/particles/dot_particles.cc
===================================================================
--- /branches/network/src/lib/particles/dot_particles.cc	(revision 6693)
+++ /branches/network/src/lib/particles/dot_particles.cc	(revision 6693)
@@ -0,0 +1,119 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "dot_particles.h"
+
+#include "load_param.h"
+#include "factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include "parser/tinyxml/tinyxml.h"
+#include <algorithm>
+
+
+CREATE_FACTORY(DotParticles, CL_DOT_PARTICLES);
+
+SHELL_COMMAND(texture, DotParticles, setMaterialTexture)
+    ->defaultValues(1, "maps/evil-flower.png");
+
+using namespace std;
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the DotParticles
+*/
+DotParticles::DotParticles (unsigned int maxCount)
+  : ParticleSystem(maxCount)
+{
+  this->init();
+}
+
+/**
+ * @brief creates a Particle System out of a XML-element
+ * @param root: the XML-element to load from
+ */
+DotParticles::DotParticles(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+DotParticles::~DotParticles()
+{ }
+
+/**
+ * @brief initializes the DotParticles with default values
+*/
+void DotParticles::init()
+{
+  this->setClassID(CL_DOT_PARTICLES, "DotParticles");
+
+  this->material.setDiffuseMap("maps/radial-trans-noise.png");
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void DotParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+
+  LoadParam(root, "texture", this, DotParticles, setMaterialTexture);
+}
+
+/**
+ * @brief draws all the Particles of this System
+ *
+ * The Cases in this Function all do the same:
+ * Drawing all the particles with the appropriate Type.
+ * This is just the fastest Way to do this, but will most likely be changed in the future.
+ */
+void DotParticles::draw() const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+
+  GLboolean checkLight = false;
+  glGetBooleanv(GL_LIGHTING, &checkLight);
+  if (checkLight == GL_TRUE)
+    glDisable(GL_LIGHTING);
+
+  glMatrixMode(GL_MODELVIEW);
+  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  Particle* drawPart = particles;
+  //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+  glBegin(GL_POINTS);
+  while (likely(drawPart != NULL))
+  {
+    glColor4fv(drawPart->color);
+    glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+
+    drawPart = drawPart->next;
+  }
+  glEnd();
+  glPopAttrib();
+}
Index: /branches/network/src/lib/particles/dot_particles.h
===================================================================
--- /branches/network/src/lib/particles/dot_particles.h	(revision 6693)
+++ /branches/network/src/lib/particles/dot_particles.h	(revision 6693)
@@ -0,0 +1,37 @@
+/*!
+ * @file dot_particles.h
+
+*/
+
+#ifndef _DOT_PARTICLE_SYSTEM_H
+#define _DOT_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class DotParticles : public ParticleSystem
+{
+
+public:
+  DotParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  DotParticles(const TiXmlElement* root);
+  virtual ~DotParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setMaterialTexture(const char* textureFile);
+
+  /** @returns the Material that lies on this particles */
+  inline const Material* getMaterial() const { return &this->material; };
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _DOT_PARTICLE_SYSTEM_H */
Index: /branches/network/src/lib/particles/model_particles.cc
===================================================================
--- /branches/network/src/lib/particles/model_particles.cc	(revision 6692)
+++ /branches/network/src/lib/particles/model_particles.cc	(revision 6693)
@@ -61,21 +61,5 @@
 */
 ModelParticles::~ModelParticles()
-{
-  // deleting all the living Particles
-  while (this->particles)
-  {
-    Particle* tmpDelPart = this->particles;
-    this->particles = this->particles->next;
-    delete tmpDelPart;
-  }
-
-  // deleting all the dead particles
-  while (this->deadList)
-  {
-    Particle* tmpDelPart = this->deadList;
-    this->deadList = this->deadList->next;
-    delete tmpDelPart;
-  }
-}
+{ }
 
 /**
Index: /branches/network/src/lib/particles/spark_particles.cc
===================================================================
--- /branches/network/src/lib/particles/spark_particles.cc	(revision 6692)
+++ /branches/network/src/lib/particles/spark_particles.cc	(revision 6693)
@@ -60,21 +60,5 @@
 */
 SparkParticles::~SparkParticles()
-{
-  // deleting all the living Particles
-  while (this->particles)
-  {
-    Particle* tmpDelPart = this->particles;
-    this->particles = this->particles->next;
-    delete tmpDelPart;
-  }
-
-  // deleting all the dead particles
-  while (this->deadList)
-  {
-    Particle* tmpDelPart = this->deadList;
-    this->deadList = this->deadList->next;
-    delete tmpDelPart;
-  }
-}
+{ }
 
 /**
Index: /branches/network/src/lib/particles/sprite_particles.cc
===================================================================
--- /branches/network/src/lib/particles/sprite_particles.cc	(revision 6692)
+++ /branches/network/src/lib/particles/sprite_particles.cc	(revision 6693)
@@ -61,21 +61,5 @@
 */
 SpriteParticles::~SpriteParticles()
-{
-  // deleting all the living Particles
-  while (this->particles)
-  {
-    Particle* tmpDelPart = this->particles;
-    this->particles = this->particles->next;
-    delete tmpDelPart;
-  }
-
-  // deleting all the dead particles
-  while (this->deadList)
-  {
-    Particle* tmpDelPart = this->deadList;
-    this->deadList = this->deadList->next;
-    delete tmpDelPart;
-  }
-}
+{ }
 
 /**
@@ -125,6 +109,6 @@
   GLboolean checkLight = false;
   glGetBooleanv(GL_LIGHTING, &checkLight);
-  if (checkLight == GL_TRUE)
-    glDisable(GL_LIGHTING);
+//  if (checkLight == GL_TRUE)
+//    glDisable(GL_LIGHTING);
   glMatrixMode(GL_MODELVIEW);
   glDepthMask(GL_FALSE);
Index: /branches/network/src/lib/util/count_pointer.h
===================================================================
--- /branches/network/src/lib/util/count_pointer.h	(revision 6693)
+++ /branches/network/src/lib/util/count_pointer.h	(revision 6693)
@@ -0,0 +1,56 @@
+/*!
+ * @file count_pointer.h Contains the Counted Pointer Class, that points to Member-Objects.
+ */
+
+#ifndef _COUNT_POINTER_H
+#define _COUNT_POINTER_H
+
+template <typename X> class CountPointer
+{
+public:
+    explicit CountPointer(X* p = 0) // allocate a new counter
+        : itsCounter(0) { if (p) itsCounter = new counter(p); }
+    ~CountPointer() { release(); }
+    CountPointer(const CountPointer& r) { acquire(r.itsCounter); }
+    CountPointer& operator=(const CountPointer& r)
+    {
+        if (this != &r) {
+            release();
+            acquire(r.itsCounter);
+        }
+        return *this;
+    }
+    X& operator*()  const { return *itsCounter->ptr; }
+    X* operator->() const { return itsCounter->ptr; }
+    X* get()        const { return itsCounter ? itsCounter->ptr : 0; }
+    bool unique()   const { return (itsCounter ? itsCounter->count == 1 : true); }
+    virtual unsigned int count() const { return (this->itsCounter ? itsCounter->count : 0); }
+private:
+
+    struct counter {
+        counter(X* p = 0, unsigned c = 1) : ptr(p), count(c) {}
+        X*          ptr;
+        unsigned    count;
+    }* itsCounter;
+
+    void acquire(counter* c)
+    {
+      // increment the count
+        itsCounter = c;
+        if (c) ++c->count;
+    }
+
+    void release()
+    {
+      // decrement the count, delete if it is 0
+        if (itsCounter) {
+            if (--itsCounter->count == 0) {
+                delete itsCounter->ptr;
+                delete itsCounter;
+            }
+            itsCounter = 0;
+        }
+    }
+};
+
+#endif /* _COUNT_POINTER_H */
Index: /branches/network/src/lib/util/executor/executor.cc
===================================================================
--- /branches/network/src/lib/util/executor/executor.cc	(revision 6692)
+++ /branches/network/src/lib/util/executor/executor.cc	(revision 6693)
@@ -60,5 +60,5 @@
   {
     int type = va_arg(parameterList, int);
-    this->defaultValue[i].setType(type);
+    this->defaultValue[i].setType((MT_Type)type);
   }
 }
Index: /branches/network/src/lib/util/multi_type.cc
===================================================================
--- /branches/network/src/lib/util/multi_type.cc	(revision 6692)
+++ /branches/network/src/lib/util/multi_type.cc	(revision 6693)
@@ -122,4 +122,55 @@
 
 /**
+ * @brief checks if the two Multitypes match
+ * @param mt MultiType to check against this one
+ * @returns true on match. false otherwise
+ *
+ * Two MultiType match if and only if
+ *  1. the internal Type is the same
+ *  2. the stored values match
+ */
+bool MultiType::operator==(const MultiType& mt) const
+{
+  if (this->type != mt.type)
+    return false;
+
+  switch (this->type)
+  {
+    case MT_NULL:
+      return true;
+    case MT_BOOL:
+      return (this->value.Bool == mt.value.Bool);
+    case MT_INT:
+      return (this->value.Int == mt.value.Int);
+    case MT_CHAR:
+      return (this->value.Char == mt.value.Char);
+    case MT_FLOAT:
+      return (this->value.Float == mt.value.Float);
+    case MT_STRING:
+      if (this->value.String != NULL && mt.value.String != NULL)
+        return (!strcmp(this->value.String, mt.value.String));
+      else
+        return (this->value.String == NULL && mt.value.String == NULL);
+  }
+}
+
+/**
+ * @brief checks if the internal value matches the boolean value.
+ * @param value to check against this one
+ * @returns true on match. false otherwise
+ *
+ * Two MultiType match if and only if
+ *  1. the stored values match the given Value
+ */
+bool MultiType::operator==(const char* value) const
+{
+  if (this->value.String != NULL && value != NULL)
+    return (!strcmp(this->value.String, value));
+  else
+    return (this->value.String == NULL && value == NULL);
+}
+
+
+/**
  * initializes the MultiType
  */
@@ -136,8 +187,8 @@
  * @param type the new Type
  */
-void MultiType::setType(int type)
+void MultiType::setType(MT_Type type)
 {
   if (this->type != type)
-    this->type = (MT_Type)type;
+    this->type = type;
 }
 
Index: /branches/network/src/lib/util/multi_type.h
===================================================================
--- /branches/network/src/lib/util/multi_type.h	(revision 6692)
+++ /branches/network/src/lib/util/multi_type.h	(revision 6693)
@@ -31,5 +31,4 @@
  */
 class MultiType {
-
   public:
     MultiType();
@@ -42,7 +41,21 @@
     virtual ~MultiType();
 
-    MultiType& operator= (const MultiType& mt);
+    MultiType& operator=(const MultiType& mt);
+    MultiType& operator=(bool value) { this->setBool(value); return *this; };
+    MultiType& operator=(int value) { this->setInt(value); return *this; };
+    MultiType& operator=(float value) { this->setFloat(value); return *this; };
+    MultiType& operator=(char value) { this->setChar(value); return *this; };
+    MultiType& operator=(const char* value) { this->setString(value); return *this; };
 
-    void setType(int type);
+    bool operator==(const MultiType& mt) const;
+    bool operator==(bool value) const { return (this->getBool() == value); };
+    bool operator==(int value) const { return (this->getInt() == value); };
+    bool operator==(float value) const { return (this->getFloat() ==  value); };
+    bool operator==(char value) const { return (this->getChar() == value); };
+    bool operator==(const char* value) const;
+    bool operator==(MT_Type type) const { return (this->type == type); }
+    bool operator!=(MT_Type type) const { return (this->type != type); }
+
+    void setType(MT_Type type);
 
     void setBool(bool value);
@@ -52,4 +65,5 @@
     void setString(const char* value);
 
+    // for your convenience.
     inline void setValue(bool value) { this->setBool(value); };
     inline void setValue(int value) { this->setInt(value); };
@@ -81,5 +95,4 @@
 
   private:
-
     union MultiTypeValue
     {
Index: /branches/network/src/lib/util/substring.h
===================================================================
--- /branches/network/src/lib/util/substring.h	(revision 6692)
+++ /branches/network/src/lib/util/substring.h	(revision 6693)
@@ -16,4 +16,6 @@
   ~SubString();
 
+  const char* operator[](unsigned int i) { return this->getString(i); };
+
   inline unsigned int getCount() { return this->splittersCount; };
   const char* getString(unsigned int i);
Index: /branches/network/src/subprojects/importer/Makefile.am
===================================================================
--- /branches/network/src/subprojects/importer/Makefile.am	(revision 6692)
+++ /branches/network/src/subprojects/importer/Makefile.am	(revision 6693)
@@ -6,7 +6,8 @@
 importer_LDFLAGS = $(MWINDOWS)
 
-bin_PROGRAMS = importer \
-               multitex \
-							 movie_player_test
+bin_PROGRAMS =  \
+		importer \
+		multitex \
+		movie_player_test
 
 importer_LDADD = \
@@ -17,82 +18,87 @@
                 $(MAINSRCDIR)/lib/shell/libORXshell.a \
 		$(MAINSRCDIR)/lib/sound/libORXsound.a \
-		$(MAINSRCDIR)/lib/graphics/importer/libORXimporter.a
+		$(MAINSRCDIR)/lib/graphics/importer/libORXimporter.a \
+		$(MAINSRCDIR)/lib/graphics/importer/libtc.a
 
-importer_SOURCES= ../framework.cc \
-                  importer.cc \
-		  tc.cc \
-                  $(MAINSRCDIR)/util/state.cc \
-                  $(MAINSRCDIR)/world_entities/camera.cc \
-                  $(MAINSRCDIR)/lib/lang/base_object.cc \
-                  $(MAINSRCDIR)/lib/lang/class_list.cc \
-                  $(MAINSRCDIR)/lib/math/vector.cc \
-                  $(MAINSRCDIR)/lib/math/quaternion.cc \
-                  $(MAINSRCDIR)/util/loading/resource_manager.cc \
-                  $(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \
-                  $(MAINSRCDIR)/lib/coord/p_node.cc \
-                  $(MAINSRCDIR)/util/loading/load_param.cc \
-                  $(MAINSRCDIR)/util/loading/load_param_description.cc \
-                  $(MAINSRCDIR)/lib/util/helper_functions.cc \
-                  $(MAINSRCDIR)/lib/util/substring.cc \
-                  $(MAINSRCDIR)/lib/util/color.cc \
-                  $(MAINSRCDIR)/lib/util/multi_type.cc \
-                  $(MAINSRCDIR)/lib/util/executor/executor.cc \
-                  $(MAINSRCDIR)/util/loading/factory.cc
+importer_SOURCES= \
+		../framework.cc \
+                importer.cc \
+                $(MAINSRCDIR)/util/state.cc \
+                $(MAINSRCDIR)/world_entities/camera.cc \
+                $(MAINSRCDIR)/lib/lang/base_object.cc \
+                $(MAINSRCDIR)/lib/lang/class_list.cc \
+                $(MAINSRCDIR)/lib/math/vector.cc \
+                $(MAINSRCDIR)/lib/math/quaternion.cc \
+                $(MAINSRCDIR)/util/loading/resource_manager.cc \
+                $(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \
+                $(MAINSRCDIR)/lib/coord/p_node.cc \
+                $(MAINSRCDIR)/util/loading/load_param.cc \
+                $(MAINSRCDIR)/util/loading/load_param_description.cc \
+                $(MAINSRCDIR)/lib/util/helper_functions.cc \
+                $(MAINSRCDIR)/lib/util/substring.cc \
+                $(MAINSRCDIR)/lib/util/color.cc \
+                $(MAINSRCDIR)/lib/util/multi_type.cc \
+                $(MAINSRCDIR)/lib/util/executor/executor.cc \
+                $(MAINSRCDIR)/util/loading/factory.cc
 
 
 
-multitex_LDADD = $(MAINSRCDIR)/lib/event/libORXevent.a \
-		 $(MAINSRCDIR)/lib/network/libORXnet.a \
-                 $(MAINSRCDIR)/lib/parser/tinyxml/libtinyxml.a \
-                 $(MAINSRCDIR)/lib/graphics/libORXgraphics.a \
-                 $(MAINSRCDIR)/lib/shell/libORXshell.a \
-                 $(MAINSRCDIR)/lib/sound/libORXsound.a \
-                 $(MAINSRCDIR)/lib/graphics/importer/libORXimporter.a
+multitex_LDADD = \
+		$(MAINSRCDIR)/lib/event/libORXevent.a \
+		$(MAINSRCDIR)/lib/network/libORXnet.a \
+                $(MAINSRCDIR)/lib/parser/tinyxml/libtinyxml.a \
+                $(MAINSRCDIR)/lib/graphics/libORXgraphics.a \
+                $(MAINSRCDIR)/lib/shell/libORXshell.a \
+                $(MAINSRCDIR)/lib/sound/libORXsound.a \
+                $(MAINSRCDIR)/lib/graphics/importer/libORXimporter.a
 
-multitex_SOURCES= ../framework.cc \
-                  multitex.cc \
-                  $(MAINSRCDIR)/util/state.cc \
-                  $(MAINSRCDIR)/world_entities/camera.cc \
-                  $(MAINSRCDIR)/lib/lang/base_object.cc \
-                  $(MAINSRCDIR)/lib/lang/class_list.cc \
-                  $(MAINSRCDIR)/lib/math/vector.cc \
-                  $(MAINSRCDIR)/lib/math/quaternion.cc \
-                  $(MAINSRCDIR)/util/loading/resource_manager.cc \
-                  $(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \
-                  $(MAINSRCDIR)/lib/coord/p_node.cc \
-                  $(MAINSRCDIR)/util/loading/load_param.cc \
-                  $(MAINSRCDIR)/util/loading/load_param_description.cc \
-                  $(MAINSRCDIR)/lib/util/helper_functions.cc \
-                  $(MAINSRCDIR)/lib/util/substring.cc \
-                  $(MAINSRCDIR)/lib/util/color.cc \
-                  $(MAINSRCDIR)/lib/util/multi_type.cc \
-                  $(MAINSRCDIR)/lib/util/executor/executor.cc \
-                  $(MAINSRCDIR)/util/loading/factory.cc
+multitex_SOURCES= \
+		../framework.cc \
+                multitex.cc \
+                $(MAINSRCDIR)/util/state.cc \
+                $(MAINSRCDIR)/world_entities/camera.cc \
+                $(MAINSRCDIR)/lib/lang/base_object.cc \
+                $(MAINSRCDIR)/lib/lang/class_list.cc \
+                $(MAINSRCDIR)/lib/math/vector.cc \
+                $(MAINSRCDIR)/lib/math/quaternion.cc \
+                $(MAINSRCDIR)/util/loading/resource_manager.cc \
+                $(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \
+                $(MAINSRCDIR)/lib/coord/p_node.cc \
+                $(MAINSRCDIR)/util/loading/load_param.cc \
+                $(MAINSRCDIR)/util/loading/load_param_description.cc \
+                $(MAINSRCDIR)/lib/util/helper_functions.cc \
+                $(MAINSRCDIR)/lib/util/substring.cc \
+                $(MAINSRCDIR)/lib/util/color.cc \
+                $(MAINSRCDIR)/lib/util/multi_type.cc \
+                $(MAINSRCDIR)/lib/util/executor/executor.cc \
+                $(MAINSRCDIR)/util/loading/factory.cc
 
-movie_player_test_LDADD = $(MAINSRCDIR)/lib/event/libORXevent.a \
+movie_player_test_LDADD = \
+		$(MAINSRCDIR)/lib/event/libORXevent.a \
 		$(MAINSRCDIR)/lib/network/libORXnet.a \
-			$(MAINSRCDIR)/lib/parser/tinyxml/libtinyxml.a \
-                 					$(MAINSRCDIR)/lib/graphics/libORXgraphics.a \
-                 					$(MAINSRCDIR)/lib/shell/libORXshell.a \
-                 					$(MAINSRCDIR)/lib/sound/libORXsound.a \
-                 					$(MAINSRCDIR)/lib/graphics/importer/libORXimporter.a
+		$(MAINSRCDIR)/lib/parser/tinyxml/libtinyxml.a \
+		$(MAINSRCDIR)/lib/graphics/libORXgraphics.a \
+                $(MAINSRCDIR)/lib/shell/libORXshell.a \
+		$(MAINSRCDIR)/lib/sound/libORXsound.a \
+		$(MAINSRCDIR)/lib/graphics/importer/libORXimporter.a
 
-movie_player_test_SOURCES= ../framework.cc \
-                  				 movie_player_test.cc \
-                  				 $(MAINSRCDIR)/util/state.cc \
-                  				 $(MAINSRCDIR)/world_entities/camera.cc \
-                  				 $(MAINSRCDIR)/lib/lang/base_object.cc \
-													 $(MAINSRCDIR)/lib/lang/class_list.cc \
-													 $(MAINSRCDIR)/lib/math/vector.cc \
-													 $(MAINSRCDIR)/util/loading/resource_manager.cc \
-													 $(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \
-													 $(MAINSRCDIR)/lib/coord/p_node.cc \
-													 $(MAINSRCDIR)/lib/coord/null_parent.cc \
-													 $(MAINSRCDIR)/util/loading/load_param.cc \
-													 $(MAINSRCDIR)/util/loading/load_param_description.cc \
-													 $(MAINSRCDIR)/lib/util/helper_functions.cc \
-													 $(MAINSRCDIR)/lib/util/substring.cc \
-													 $(MAINSRCDIR)/lib/util/color.cc \
-													 $(MAINSRCDIR)/lib/util/multi_type.cc \
-													 $(MAINSRCDIR)/lib/util/executor/executor.cc \
-													 $(MAINSRCDIR)/util/loading/factory.cc
+movie_player_test_SOURCES= \
+		../framework.cc \
+		movie_player_test.cc \
+		$(MAINSRCDIR)/util/state.cc \
+		$(MAINSRCDIR)/world_entities/camera.cc \
+		$(MAINSRCDIR)/lib/lang/base_object.cc \
+		$(MAINSRCDIR)/lib/lang/class_list.cc \
+		$(MAINSRCDIR)/lib/math/vector.cc \
+		$(MAINSRCDIR)/util/loading/resource_manager.cc \
+		$(MAINSRCDIR)/lib/parser/ini_parser/ini_parser.cc \
+		$(MAINSRCDIR)/lib/coord/p_node.cc \
+		$(MAINSRCDIR)/lib/coord/null_parent.cc \
+		$(MAINSRCDIR)/util/loading/load_param.cc \
+		$(MAINSRCDIR)/util/loading/load_param_description.cc \
+		$(MAINSRCDIR)/lib/util/helper_functions.cc \
+		$(MAINSRCDIR)/lib/util/substring.cc \
+		$(MAINSRCDIR)/lib/util/color.cc \
+		$(MAINSRCDIR)/lib/util/multi_type.cc \
+		$(MAINSRCDIR)/lib/util/executor/executor.cc \
+		$(MAINSRCDIR)/util/loading/factory.cc
Index: anches/network/src/subprojects/importer/tc.cc
===================================================================
--- /branches/network/src/subprojects/importer/tc.cc	(revision 6692)
+++ 	(revision )
@@ -1,1448 +1,0 @@
-/*
- * $Header: /home/grantham/cvsroot/projects/modules/tc/tc.c,v 1.27 2000/10/10 16:09:23 grantham Exp $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include "tc.h"
-
-/* SNIPPET "table.c" Inducted Wed Nov 22 09:36:55 2000 */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if !defined(MEM_CHART)
-#define chartedSetLabel(a)
-#endif
-
-#define LEVEL1COUNT 16384
-#define LEVEL2COUNT 1024
-#define LEVEL3COUNT 256
-
-typedef struct TableLevel3
-{
-    int EntryCount;
-    void *Table[LEVEL3COUNT];
-    char IsSet[LEVEL3COUNT];
-} TableLevel3;
-
-typedef struct TableLevel2
-{
-    int EntryCount;
-    TableLevel3 *Table[LEVEL2COUNT];
-} TableLevel2;
-
-typedef struct TableRoot
-{
-    size_t EntryCount;
-    size_t TotalEntryCount;
-    size_t TotalAllocatedBytes;
-    int EmptyEntryCount;
-    TableLevel2 *Table[LEVEL1COUNT];
-} TableRoot;
-
-typedef struct TableIterator {
-    int i1, i2, i3;
-    unsigned int i;
-    TableLevel3 *CurLevel3;
-    int CheckLevel1, CheckLevel2;
-} TableIterator;
-
-TableRoot *tableNew(void)
-{
-    TableRoot *tr;
-
-    chartedSetLabel("table root");
-    tr = (TableRoot *)calloc(sizeof(TableRoot), 1);
-    return tr;
-}
-
-TableIterator *tableNewIterator(void)
-{
-    TableIterator *ti;
-
-    chartedSetLabel("table iterator");
-    ti = (TableIterator *)malloc(sizeof(TableIterator));
-    return ti;
-}
-
-int tableRetrieve(unsigned int a, TableRoot *table, void **ref)
-{
-    int i1 = a / (LEVEL2COUNT * LEVEL3COUNT);
-    int i2 = (a / LEVEL3COUNT) % LEVEL2COUNT;
-    int i3 = a % LEVEL3COUNT;
-
-    if(table->Table[i1] == NULL)
-        return 0;
-    if(table->Table[i1]->Table[i2] == NULL)
-        return 0;
-    if(!table->Table[i1]->Table[i2]->IsSet[i3])
-        return 0;
-    if(ref != NULL)
-        *ref = table->Table[i1]->Table[i2]->Table[i3];
-    return 1;
-}
-
-int tableInsert(unsigned int a, TableRoot *table, void *ref)
-{
-    int i1 = a / (LEVEL2COUNT * LEVEL3COUNT);
-    int i2 = (a / LEVEL3COUNT) % LEVEL2COUNT;
-    int i3 = a % LEVEL3COUNT;
-
-    if(table->Table[i1] == NULL) {
-        chartedSetLabel("table level 2");
-        table->Table[i1] = (TableLevel2 *)calloc(1, sizeof(TableLevel2));
-        table->TotalAllocatedBytes += sizeof(TableLevel2);
-        if(table->Table[i1] == NULL)
-            return 0;
-    }
-    if(table->Table[i1]->Table[i2] == NULL) {
-        chartedSetLabel("table level 3");
-        table->Table[i1]->Table[i2] =
-            (TableLevel3 *)calloc(1, sizeof(TableLevel3));
-        table->TotalAllocatedBytes += sizeof(TableLevel3);
-        if(table->Table[i1]->Table[i2] == NULL)
-            return 0;
-        table->Table[i1]->EntryCount++;
-        table->TotalEntryCount += LEVEL3COUNT;
-        table->EmptyEntryCount += LEVEL3COUNT;
-    }
-    if(!table->Table[i1]->Table[i2]->IsSet[i3]) {
-        table->Table[i1]->Table[i2]->EntryCount++;
-        table->EmptyEntryCount --;
-        table->Table[i1]->Table[i2]->IsSet[i3] = 1;
-    }
-    table->Table[i1]->Table[i2]->Table[i3] = ref;
-    return 1;
-}
-
-int tableRemove(unsigned int a, TableRoot *table, void **wasref)
-{
-    int i1 = a / (LEVEL2COUNT * LEVEL3COUNT);
-    int i2 = (a / LEVEL3COUNT) % LEVEL2COUNT;
-    int i3 = a % LEVEL3COUNT;
-
-    if(table->Table[i1] == NULL)
-        return 0;
-    if(table->Table[i1]->Table[i2] == NULL)
-        return 0;
-    if(!table->Table[i1]->Table[i2]->IsSet[i3])
-        return 0;
-    if(wasref != NULL)
-        *wasref = table->Table[i1]->Table[i2]->Table[i3];
-    table->Table[i1]->Table[i2]->IsSet[i3] = 0;
-    table->EmptyEntryCount ++;
-    if(--table->Table[i1]->Table[i2]->EntryCount == 0) {
-        table->EmptyEntryCount -= LEVEL3COUNT;
-        table->TotalEntryCount -= LEVEL3COUNT;
-        free(table->Table[i1]->Table[i2]);
-        table->TotalAllocatedBytes -= sizeof(TableLevel3);
-        table->Table[i1]->Table[i2] = NULL;
-        if(--table->Table[i1]->EntryCount == 0) {
-            table->TotalAllocatedBytes -= sizeof(TableLevel2);
-            free(table->Table[i1]);
-            table->Table[i1] = NULL;
-        }
-    }
-    return 1;
-}
-
-void tableResetIterator(TableIterator *ti)
-{
-    ti->i1 = 0;
-    ti->i2 = 0;
-    ti->i3 = 0;
-    ti->i = 0;
-    ti->CheckLevel1 = 1;
-    ti->CheckLevel2 = 1;
-}
-
-int tableIterate(TableRoot *table, TableIterator *ti, unsigned int *i, void **ref)
-{
-    int done;
-
-    done = 0;
-    while(ti->i1 < LEVEL1COUNT) {
-        if(ti->CheckLevel1 && table->Table[ti->i1] == NULL) {
-            ti->i += LEVEL2COUNT * LEVEL3COUNT;
-            ti->i1++;
-            continue;
-        } else
-            ti->CheckLevel1 = 0;
-        if(ti->CheckLevel2 && table->Table[ti->i1]->Table[ti->i2] == NULL) {
-            ti->i += LEVEL3COUNT;
-            if(++ti->i2 >= LEVEL2COUNT) {
-                ti->i2 = 0;
-                ti->i1++;
-                ti->CheckLevel1 = 1;
-            }
-            continue;
-        } else
-            ti->CheckLevel2 = 0;
-        if(ti->i3 == 0)
-            ti->CurLevel3 = table->Table[ti->i1]->Table[ti->i2];
-        if(ti->CurLevel3->IsSet[ti->i3]) {
-            if(ref != NULL)
-                *ref = ti->CurLevel3->Table[ti->i3];
-            if(i != NULL)
-                *i = ti->i;
-            done = 1;
-        }
-        ti->i++;
-        if(++ti->i3 >= LEVEL3COUNT) {
-            ti->i3 = 0;
-            ti->CheckLevel2 = 1;
-            if(++ti->i2 >= LEVEL2COUNT) {
-                ti->i2 = 0;
-                ti->i1++;
-                ti->CheckLevel1 = 1;
-            }
-        }
-        if(done)
-            return 1;
-    }
-    return 0;
-}
-
-void tableDelete(TableRoot *table, void (*datumDelete)(void *datum))
-{
-    int i1, i2, i3;
-
-    for(i1 = 0; i1 < LEVEL1COUNT; i1++) {
-        if(table->Table[i1] != NULL) {
-            for(i2 = 0; i2 < LEVEL2COUNT; i2++) {
-                if(table->Table[i1]->Table[i2] != NULL) {
-                    for(i3 = 0; i3 < LEVEL3COUNT; i3++) {
-                        if(table->Table[i1]->Table[i2]->IsSet[i3])
-                            datumDelete(table->Table[i1]->Table[i2]->Table[i3]);
-                    }
-                    free(table->Table[i1]->Table[i2]);
-                }
-            }
-            free(table->Table[i1]);
-            table->Table[i1] = NULL;
-        }
-    }
-    table->TotalEntryCount = 0;
-    table->EmptyEntryCount = 0;
-    table->TotalAllocatedBytes = 0;
-}
-
-void tableGetStats(TableRoot *table, size_t *totalBytes, size_t *emptyCount,
-    size_t *totalCount)
-{
-    if(emptyCount != NULL)
-        *emptyCount = table->EmptyEntryCount;
-    if(totalCount != NULL)
-        *totalCount = table->TotalEntryCount;
-    if(totalBytes != NULL)
-        *totalBytes = table->TotalAllocatedBytes;
-}
-
-size_t tableGetIteratorSize(void)
-{
-    return sizeof(TableIterator);
-}
-
-/* "table.c" ENDSNIPPET */
-
-#if !defined(MEM_CHART)
-#define chartedSetLabel(a)
-#endif
-
-#if defined(DEBUG)
-#define ACTC_DEBUG(a) a
-#else
-#define ACTC_DEBUG(a)
-#endif
-
-#if defined(INFO)
-#define ACTC_INFO(a) a
-#else
-#define ACTC_INFO(a)
-#endif
-
-
-#define ACTC_CHECK(a) \
-    { \
-        int theErrorNow; \
-        theErrorNow = (a); \
-        if(theErrorNow < 0) \
-            return theErrorNow; \
-    }
-
-typedef struct {
-    struct ACTCVertex *FinalVert;
-} ACTCTriangle;
-
-typedef struct {
-    struct ACTCVertex *V2;
-    int Count;
-    int TriangleCount;
-    ACTCTriangle *Triangles;
-} ACTCEdge;
-
-typedef struct ACTCVertex {
-    unsigned int V;
-    int Count;
-    struct ACTCVertex **PointsToMe;
-    struct ACTCVertex *Next;
-    int EdgeCount;
-    ACTCEdge *Edges;
-} ACTCVertex;
-
-/* private tokens */
-#define ACTC_NO_MATCHING_VERT           -0x3000
-#define ACTC_FWD_ORDER                  0
-#define ACTC_REV_ORDER                  1
-
-#define MAX_STATIC_VERTS                10000000 /* buh? */
-
-struct _ACTCData {
-
-    /* vertex and edge database */
-    int VertexCount;
-    TableRoot *Vertices;
-    TableIterator *VertexIterator;
-    int CurMaxVertValence;
-    int CurMinVertValence;
-    ACTCVertex **VertexBins;
-
-    /* alternate vertex array if range small enough */
-    ACTCVertex *StaticVerts;
-    int UsingStaticVerts;
-    unsigned int VertRange;
-
-    /* During consolidation */
-    int CurWindOrder;
-    int PrimType;
-    ACTCVertex *V1;
-    ACTCVertex *V2;
-    int VerticesSoFar;
-
-    /* Error and state handling */
-    int IsInputting;
-    int IsOutputting;
-    int Error;
-
-    /* actcParam-settable parameters */
-    unsigned int MinInputVert;
-    unsigned int MaxInputVert;
-    int MaxVertShare;
-    int MaxEdgeShare;
-    int MinFanVerts;
-    int MaxPrimVerts;
-    int HonorWinding;
-};
-
-#if defined(DEBUG) || defined(INFO)
-
-static void dumpTriangles(ACTCEdge *e, FILE *fp)
-{
-    int i;
-    int c;
-    char v[12];
-
-    c = fprintf(fp, "      %d triangles: ");
-    for(i = 0; i < e->TriangleCount; i++) {
-        if(c + 1 + sprintf(v, "%u", e->Triangles[i].FinalVert) > 78) {
-            fputs("\n", fp);
-            c = fprintf(fp, "        ");
-        }
-        c += fprintf(fp, " %s", v);
-    }
-    fputs("\n", fp);
-}
-
-static void dumpEdges(ACTCVertex *vert, FILE *fp)
-{
-    int i;
-    int c;
-    char v[26]; /* two signed ints plus x plus NUL */
-
-    for(i = 0; i < vert->EdgeCount; i++) {
-        fprintf(fp, "    %u->%u (%d times)\n", vert->V, vert->Edges[i].V2->V,
-            vert->Edges[i].Count);
-        dumpTriangles(&vert->Edges[i], fp);
-    }
-    fputs("\n", fp);
-}
-
-static void dumpVertices(ACTCData *tc, FILE *fp)
-{
-    int i;
-    ACTCVertex *v;
-
-    if(!tc->UsingStaticVerts)
-        tableResetIterator(tc->VertexIterator);
-
-    fprintf(fp, "%d vertices in valences list\n", tc->VertexCount);
-    if(tc->UsingStaticVerts) {
-        for(i = 0; i < tc->VertRange; i++) {
-            v = &tc->StaticVerts[i];
-            if(v->Count > 0) {
-                fprintf(fp, "  vertex %u, valence %d, %d edges\n", v->V,
-                    v->Count, v->EdgeCount);
-                dumpEdges(v, fp);
-            }
-        }
-    } else {
-        for(i = 0; i < tc->VertexCount; i++) {
-            if(tableIterate(tc->Vertices, tc->VertexIterator, NULL,
-                (void **)&v) == 0) {
-                fprintf(fp, "ACTC::dumpVertices : fewer vertices in the table "
-                    "than we expected!\n");
-                fprintf(stderr, "ACTC::dumpVertices : fewer vertices in the table "
-                    "than we expected!\n");
-            }
-            if(v == NULL) {
-                fprintf(fp, "ACTC::dumpVertices : did not expect to get a NULL"
-                    "Vertex from the table iterator!\n");
-                fprintf(stderr, "ACTC::dumpVertices : did not expect to get a NULL"
-                    "Vertex from the table iterator!\n");
-            }
-            fprintf(fp, "  vertex %u, valence %d, %d edges\n", v->V, v->Count,
-                v->EdgeCount);
-            dumpEdges(v, fp);
-        }
-    }
-}
-
-static void dumpVertexBins(ACTCData *tc, FILE *fp)
-{
-    ACTCVertex *cur;
-    int i;
-    int c;
-    char v[26]; /* two signed ints plus x plus NUL */
-
-    fprintf(fp, "vertex bins:\n");
-    if(tc->VertexBins == NULL) {
-        fprintf(fp, "        empty.\n");
-        return;
-    }
-    for(i = 1; i <= tc->CurMaxVertValence; i++) {
-        cur = tc->VertexBins[i];
-        c = fprintf(fp, "        bin %d -> ", i);
-        while(cur != NULL) {
-            if(c + 1 + sprintf(v, "%ux%d", cur->V, cur->Count) > 78) {
-                fputs("\n", fp);
-                c = fprintf(fp, "          ");
-            }
-            c += fprintf(fp, " %s", v);
-            cur = cur->Next;
-        }
-        fputs("\n", fp);
-    }
-}
-
-void actcDumpState(ACTCData *tc, FILE *fp)
-{
-    dumpVertices(tc, fp);
-    dumpVertexBins(tc, fp);
-}
-
-#endif /* DEBUG || INFO */
-
-#if defined(DEBUG)
-
-static int abortWithOptionalDump(ACTCData *tc)
-{
-    ACTC_INFO(actcDumpState(tc, stderr));
-    abort();
-}
-
-#endif /* defined(DEBUG) */
-
-int actcGetError(ACTCData *tc)
-{
-    int error = tc->Error;
-    tc->Error = ACTC_NO_ERROR;
-    return error;
-}
-
-static void *reallocAndAppend(void **ptr, unsigned int *itemCount, size_t itemBytes,
-    void *append)
-{
-    void *t;
-
-    t = realloc(*ptr, itemBytes * (*itemCount + 1));
-    if(t == NULL)
-        return NULL;
-    *ptr = t;
-
-    memcpy((unsigned char *)*ptr + *itemCount * itemBytes, append, itemBytes);
-    (*itemCount) += 1;
-
-    return *ptr;
-}
-
-/*
- * Call only during input; changes vertices' valences and does not
- * fix the bins that are ordered by vertex valence.  (It's usually cheaper
- * to traverse the vertex list once after all are added, since that's
- * linear in the NUMBER OF UNIQUE VERTEX INDICES, which is almost always
- * going to be less than the number of vertices.)
- */
-static int incVertexValence(ACTCData *tc, unsigned int v, ACTCVertex **found)
-{
-    ACTCVertex *vertex;
-
-    if(tc->UsingStaticVerts) {
-        vertex = &tc->StaticVerts[v];
-        vertex->Count++;
-        if(vertex->Count == 1) {
-            vertex->V = v;
-            tc->VertexCount++;
-        }
-    } else {
-        if(tableRetrieve(v, tc->Vertices, (void **)&vertex) == 1) {
-            if(vertex->V != v) {
-                ACTC_DEBUG(
-                    fprintf(stderr, "ACTC::incVertexValence : Got vertex %d when "
-                        "looking for vertex %d?!?\n", vertex->V, v);
-                    abortWithOptionalDump(tc);
-                )
-                return tc->Error = ACTC_DATABASE_CORRUPT;
-            }
-            vertex->Count++;
-        } else {
-            chartedSetLabel("new Vertex");
-            vertex = (ACTCVertex *)malloc(sizeof(ACTCVertex));
-            vertex->V = v;
-            vertex->Count = 1;
-            vertex->Edges = NULL;
-            vertex->EdgeCount = 0;
-            if(tableInsert(v, tc->Vertices, vertex) == 0) {
-                ACTC_DEBUG(fprintf(stderr, "ACTC::incVertexValence : Failed "
-                    "to insert vertex into table\n");)
-                return tc->Error = ACTC_ALLOC_FAILED;
-            }
-            tc->VertexCount++;
-        }
-    }
-    if(vertex->Count > tc->CurMaxVertValence)
-        tc->CurMaxVertValence = vertex->Count;
-
-    *found = vertex;
-
-    return ACTC_NO_ERROR;
-}
-
-static int decVertexValence(ACTCData *tc, ACTCVertex **vptr)
-{
-    ACTCVertex *v = *vptr;
-
-    v->Count--;
-    if(v->Count < 0) {
-        ACTC_DEBUG(
-            fprintf(stderr, "ACTC::decVertexValence : Valence went "
-                "negative?!?\n");
-            abortWithOptionalDump(tc);
-        )
-        return tc->Error = ACTC_DATABASE_CORRUPT;
-    }
-
-    if(v->PointsToMe != NULL) {
-        *v->PointsToMe = v->Next;
-        if(v->Next != NULL)
-            v->Next->PointsToMe = v->PointsToMe;
-        v->Next = NULL;
-    }
-
-    if(v->Count == 0) {
-        tc->VertexCount--;
-        if(v->Edges != NULL)
-            free(v->Edges);
-        if(!tc->UsingStaticVerts) {
-            tableRemove(v->V, tc->Vertices, NULL);
-            free(v);
-        }
-        *vptr = NULL;
-    } else {
-        if(tc->VertexBins != NULL) {
-            v->Next = tc->VertexBins[v->Count];
-            v->PointsToMe = &tc->VertexBins[v->Count];
-            if(v->Next != NULL)
-                v->Next->PointsToMe = &v->Next;
-            tc->VertexBins[v->Count] = v;
-            if(v->Count < tc->CurMinVertValence)
-                tc->CurMinVertValence = v->Count;
-        }
-    }
-
-    return ACTC_NO_ERROR;
-}
-
-static int findNextFanVertex(ACTCData *tc, ACTCVertex **vert)
-{
-    if(tc->CurMaxVertValence < tc->MinFanVerts) {
-        return ACTC_NO_MATCHING_VERT;
-    }
-    while(tc->VertexBins[tc->CurMaxVertValence] == NULL) {
-        tc->CurMaxVertValence--;
-        if(tc->CurMaxVertValence < tc->CurMinVertValence) {
-            if(tc->VertexCount > 0) {
-                ACTC_DEBUG(fprintf(stderr, "tc::findNextFanVertex : no more "
-                    "vertices in bins but VertexCount > 0\n");)
-                return tc->Error = ACTC_DATABASE_CORRUPT;
-            }
-            return ACTC_NO_MATCHING_VERT;
-        }
-    }
-    *vert = tc->VertexBins[tc->CurMaxVertValence];
-    return ACTC_NO_ERROR;
-}
-
-static int findNextStripVertex(ACTCData *tc, ACTCVertex **vert)
-{
-    while(tc->VertexBins[tc->CurMinVertValence] == NULL) {
-        tc->CurMinVertValence++;
-        if(tc->CurMinVertValence > tc->CurMaxVertValence) {
-            if(tc->VertexCount > 0) {
-                ACTC_DEBUG(fprintf(stderr, "tc::findNextStripVertex : no more "
-                    "vertices in bins but VertexCount > 0\n");)
-                return tc->Error = ACTC_DATABASE_CORRUPT;
-            }
-            return ACTC_NO_MATCHING_VERT;
-        }
-    }
-    *vert = tc->VertexBins[tc->CurMinVertValence];
-    return ACTC_NO_ERROR;
-}
-
-int actcGetIsDuringInput(ACTCData *tc) {
-    return tc->IsInputting;
-}
-
-int actcBeginInput(ACTCData *tc)
-{
-    if(tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcBeginInput : called within "
-            "BeginOutput/EndOutput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-
-    if(tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcBeginInput : called within "
-            "BeginInput/EndInput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-
-    tc->IsInputting = 1;
-    tc->CurMaxVertValence = 0;
-
-    if(tc->MaxInputVert < MAX_STATIC_VERTS - 1) {
-        size_t byteCount;
-        tc->UsingStaticVerts = 1;
-        tc->VertRange = tc->MaxInputVert + 1;
-        byteCount = sizeof(ACTCVertex) * tc->VertRange;
-        chartedSetLabel("static verts");
-        tc->StaticVerts = (ACTCVertex *)calloc(sizeof(ACTCVertex), tc->VertRange);
-        if(tc->StaticVerts == NULL) {
-            ACTC_INFO(printf("Couldn't allocate static %d vert block of %u "
-                "bytes\n", tc->VertRange, byteCount);)
-            tc->UsingStaticVerts = 0;
-        }
-    } else
-        tc->UsingStaticVerts = 0;
-
-    return ACTC_NO_ERROR;
-}
-
-int actcEndInput(ACTCData *tc)
-{
-    if(tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcEndInput : called within "
-            "BeginOutput/EndOutput\n");)
-        return tc->Error = ACTC_DURING_OUTPUT;
-    }
-
-    if(!tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcEndInput : called outside "
-            "BeginInput/EndInput\n");)
-        return tc->Error = ACTC_IDLE;
-    }
-
-    tc->IsInputting = 0;
-
-    return ACTC_NO_ERROR;
-}
-
-int actcGetIsDuringOutput(ACTCData *tc) {
-    return tc->IsOutputting;
-}
-
-int actcBeginOutput(ACTCData *tc)
-{
-    ACTCVertex *v;
-    int i;
-
-    if(tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcBeginOutput : called within "
-            "BeginInput/EndInput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-
-    if(tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcBeginOutput : called within "
-            "BeginOutput/EndOutput\n");)
-        return tc->Error = ACTC_DURING_OUTPUT;
-    }
-
-    tc->IsOutputting = 1;
-
-    tc->CurMinVertValence = INT_MAX;
-    chartedSetLabel("vertex bins");
-    tc->VertexBins = (ACTCVertex **)calloc(sizeof(ACTCVertex *), tc->CurMaxVertValence + 1);
-    if(tc->VertexBins == NULL) {
-        ACTC_DEBUG(fprintf(stderr, "actcBeginOutput : couldn't allocate %d bytes "
-            "for Vertex Bins\n",
-            sizeof(ACTCVertex *) * tc->CurMaxVertValence);)
-        return tc->Error = ACTC_ALLOC_FAILED;
-    }
-
-    if(tc->UsingStaticVerts) {
-        double edgeTotal;
-        for(i = 0; i < tc->VertRange; i++) {
-            v = &tc->StaticVerts[i];
-            if(v->Count > 0) {
-                v->Next = tc->VertexBins[v->Count];
-                v->PointsToMe = &tc->VertexBins[v->Count];
-                tc->VertexBins[v->Count] = v;
-                if(v->Next != NULL)
-                    v->Next->PointsToMe = &v->Next;
-                if(v->Count < tc->CurMinVertValence)
-                    tc->CurMinVertValence = v->Count;
-                edgeTotal += v->EdgeCount;
-            }
-        }
-    } else {
-        tableResetIterator(tc->VertexIterator);
-        for(i = 0; i < tc->VertexCount; i++) {
-            if(tableIterate(tc->Vertices, tc->VertexIterator, NULL, (void **)&v)
-                == 0) {
-                ACTC_DEBUG(fprintf(stderr, "actcBeginOutput : fewer vertices in "
-                    "the table than we expected!\n");)
-                return tc->Error = ACTC_DATABASE_CORRUPT;
-            }
-            v->Next = tc->VertexBins[v->Count];
-            v->PointsToMe = &tc->VertexBins[v->Count];
-            tc->VertexBins[v->Count] = v;
-            if(v->Next != NULL)
-                v->Next->PointsToMe = &v->Next;
-            if(v->Count < tc->CurMinVertValence)
-                tc->CurMinVertValence = v->Count;
-        }
-    }
-
-    return ACTC_NO_ERROR;
-}
-
-int actcEndOutput(ACTCData *tc)
-{
-    if(tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcEndOutput : called within "
-            "BeginInput/EndInput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-
-    if(!tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcEndOutput : called outside "
-            "BeginOutput/EndOutput\n");)
-        return tc->Error = ACTC_IDLE;
-    }
-
-    tc->IsOutputting = 0;
-
-    if(tc->UsingStaticVerts) {
-        free(tc->StaticVerts);
-        tc->StaticVerts = NULL;
-        tc->UsingStaticVerts = 0;
-    }
-
-    free(tc->VertexBins);
-    tc->VertexBins = NULL;
-
-    return ACTC_NO_ERROR;
-}
-
-ACTCData *actcNew(void)
-{
-    ACTCData *tc;
-#if defined(DEBUG) || defined(INFO)
-    static int didPrintVersion = 0;
-
-    if(!didPrintVersion) {
-        int verMinor, verMajor;
-        didPrintVersion = 1;
-
-        actcGetParami(tc, ACTC_MAJOR_VERSION, &verMajor);
-        actcGetParami(tc, ACTC_MINOR_VERSION, &verMinor);
-        fprintf(stderr, "TC Version %d.%d\n", verMajor, verMinor);
-    }
-#endif /* defined(DEBUG) || defined(INFO) */
-
-    chartedSetLabel("the tc struct");
-    tc = (ACTCData *)calloc(sizeof(*tc), 1);
-
-    if(tc == NULL) {
-        ACTC_DEBUG(fprintf(stderr, "actcNew : couldn't allocate %d bytes "
-            "for new ACTCData\n", sizeof(*tc));)
-        return NULL;
-    }
-
-    tc->Vertices = tableNew();
-    tc->VertexIterator = tableNewIterator();
-
-    tc->MinFanVerts = INT_MAX;
-    tc->MaxPrimVerts = INT_MAX;
-    tc->MaxInputVert = INT_MAX;
-    tc->MaxEdgeShare = INT_MAX;
-    tc->MaxVertShare = INT_MAX;
-    tc->HonorWinding = 1;
-    /* seed = 0 handled by calloc */
-    /* XXX grantham 20000615 - seed ignored for now */
-
-    return tc;
-}
-
-static size_t allocatedForTriangles(ACTCEdge *e)
-{
-    return sizeof(ACTCTriangle) * e->TriangleCount;
-}
-
-static size_t allocatedForEdges(ACTCVertex *vert)
-{
-    int i;
-    size_t size;
-
-    size = sizeof(ACTCEdge) * vert->EdgeCount;
-    for(i = 0; i < vert->EdgeCount; i++) {
-        size += allocatedForTriangles(&vert->Edges[i]);
-    }
-    return size;
-}
-
-static size_t allocatedForVertices(ACTCData *tc)
-{
-    int i;
-    int size;
-    ACTCVertex *v;
-
-    if(!tc->UsingStaticVerts)
-        tableResetIterator(tc->VertexIterator);
-
-    if(tc->UsingStaticVerts) {
-        size = tc->VertRange * sizeof(ACTCVertex);
-        for(i = 0; i < tc->VertRange; i++) {
-            v = &tc->StaticVerts[i];
-            if(v->Count > 0)
-                size += allocatedForEdges(v);
-        }
-    } else {
-        for(i = 0; i < tc->VertexCount; i++) {
-            tableIterate(tc->Vertices, tc->VertexIterator, NULL, (void **)&v);
-            size += allocatedForEdges(v);
-        }
-    }
-    return size;
-}
-
-int actcGetMemoryAllocation(ACTCData *tc, size_t *bytesAllocated)
-{
-    size_t tableBytes;
-
-    tableGetStats(tc->Vertices, NULL, NULL, &tableBytes);
-    *bytesAllocated = sizeof(ACTCData);
-    *bytesAllocated += tableBytes;
-    *bytesAllocated += allocatedForVertices(tc); /* recurses */
-
-    return ACTC_NO_ERROR;
-}
-
-static void freeVertex(void *p)
-{
-    ACTCVertex *v = (ACTCVertex *)p;
-    int i;
-
-    for(i = 0; i < v->EdgeCount; i++)
-        free(v->Edges[i].Triangles);
-    free(v->Edges);
-    free(v);
-}
-
-int actcMakeEmpty(ACTCData *tc)
-{
-    tc->VertexCount = 0;
-    if(!tc->UsingStaticVerts)
-        tableDelete(tc->Vertices, freeVertex);
-    if(tc->VertexBins != NULL) {
-        free(tc->VertexBins);
-        tc->VertexBins = NULL;
-    }
-    tc->IsOutputting = 0;
-    tc->IsInputting = 0;
-    return ACTC_NO_ERROR;
-}
-
-void actcDelete(ACTCData *tc)
-{
-    actcMakeEmpty(tc);
-    free(tc->VertexIterator);
-    free(tc->Vertices);
-    free(tc);
-}
-
-int actcParami(ACTCData *tc, int param, int value)
-{
-    if(tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcParami : within BeginInput/"
-            "EndInput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-    if(tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcParami : within BeginOutput/"
-            "EndOutput\n");)
-        return tc->Error = ACTC_DURING_OUTPUT;
-    }
-    switch(param) {
-        case ACTC_OUT_MIN_FAN_VERTS:
-            tc->MinFanVerts = value;
-            break;
-
-        case ACTC_IN_MAX_VERT:
-            if(value < tc->MinInputVert) {
-                ACTC_DEBUG(fprintf(stderr, "actcParami : tried to set "
-                    "MAX_INPUT_VERT to %d, less than MIN_INPUT_VERT (%d)\n",
-                    value, tc->MinInputVert);)
-                return tc->Error = ACTC_INVALID_VALUE;
-            }
-            tc->MaxInputVert = value;
-            break;
-
-        case ACTC_IN_MIN_VERT:
-            if(value > tc->MaxInputVert) {
-                ACTC_DEBUG(fprintf(stderr, "actcParami : tried to set "
-                    "MIN_INPUT_VERT to %d, greater than MAX_INPUT_VERT (%d)\n",
-                    value, tc->MaxInputVert);)
-                return tc->Error = ACTC_INVALID_VALUE;
-            }
-            tc->MinInputVert = value;
-            break;
-
-        case ACTC_IN_MAX_EDGE_SHARING:
-            tc->MaxEdgeShare = value;
-            break;
-
-        case ACTC_IN_MAX_VERT_SHARING:
-            tc->MaxVertShare = value;
-            break;
-
-        case ACTC_OUT_HONOR_WINDING:
-            tc->HonorWinding = value;
-            break;
-
-        case ACTC_OUT_MAX_PRIM_VERTS:
-            if(value < 3) {
-                ACTC_DEBUG(fprintf(stderr, "actcParami : tried to set "
-                    "MAX_PRIM_VERTS to %d (needed to be 3 or more)\n", value);)
-                return tc->Error = ACTC_INVALID_VALUE;
-            }
-            tc->MaxPrimVerts = value;
-            break;
-
-    }
-    return ACTC_NO_ERROR;
-}
-
-int actcParamu(ACTCData *tc, int param, unsigned int value)
-{
-    /*
-     * XXX - yes, this is questionable, but I consulted industry
-     * experts and we agreed that most common behavior is to copy the
-     * bits directly, which is what I want.
-     */
-    return actcParami(tc, param, (int)value);
-}
-
-int actcGetParami(ACTCData *tc, int param, int *value)
-{
-    switch(param) {
-        case ACTC_MAJOR_VERSION:
-            *value = 1;
-            break;
-
-        case ACTC_MINOR_VERSION:
-            *value = 1;
-            break;
-
-        case ACTC_IN_MAX_VERT:
-            *value = tc->MaxInputVert;
-            break;
-
-        case ACTC_IN_MIN_VERT:
-            *value = tc->MinInputVert;
-            break;
-
-        case ACTC_IN_MAX_EDGE_SHARING:
-            *value = tc->MaxEdgeShare;
-            break;
-
-        case ACTC_IN_MAX_VERT_SHARING:
-            *value = tc->MaxVertShare;
-            break;
-
-        case ACTC_OUT_MIN_FAN_VERTS:
-            *value = tc->MinFanVerts;
-            break;
-
-        case ACTC_OUT_HONOR_WINDING:
-            *value = tc->HonorWinding;
-            break;
-
-        case ACTC_OUT_MAX_PRIM_VERTS:
-            *value = tc->MaxPrimVerts;
-            break;
-
-        default:
-            *value = 0;
-            return tc->Error = ACTC_INVALID_VALUE;
-            /* break; */
-    }
-    return ACTC_NO_ERROR;
-}
-
-int actcGetParamu(ACTCData *tc, int param, unsigned int *value)
-{
-    return actcGetParami(tc, param, (int *)value);
-}
-
-static int mapEdgeTriangle(ACTCData *tc, ACTCEdge *edge, ACTCVertex *v3)
-{
-    ACTCTriangle tmp;
-    void *r;
-
-    tmp.FinalVert = v3;
-    chartedSetLabel("triangle list");
-    r = reallocAndAppend((void **)&edge->Triangles, (unsigned int*)&edge->TriangleCount,
-        sizeof(tmp), &tmp);
-    if(r == NULL) {
-        ACTC_DEBUG(fprintf(stderr, "ACTC::mapEdgeTriangle : Couldn't allocate "
-            "%d bytes for triangles\n", sizeof(tmp) *
-            (edge->TriangleCount + 1));)
-        return tc->Error = ACTC_ALLOC_FAILED;
-    }
-
-    return ACTC_NO_ERROR;
-}
-
-static int unmapEdgeTriangle(ACTCData *tc, ACTCEdge *edge, ACTCVertex *v3)
-{
-    int i;
-
-    for(i = 0; i < edge->TriangleCount; i++)
-        if(edge->Triangles[i].FinalVert == v3)
-            break;
-
-    if(i == edge->TriangleCount) {
-        ACTC_DEBUG(
-            fprintf(stderr, "ACTC::unmapEdgeTriangle : Couldn't find third vertex"
-                " from edge in order to delete it?!?\n");
-            abortWithOptionalDump(tc);
-        )
-        return tc->Error = ACTC_DATABASE_CORRUPT;
-    }
-
-    edge->Triangles[i] = edge->Triangles[edge->TriangleCount - 1];
-    edge->TriangleCount --;
-
-    return ACTC_NO_ERROR;
-}
-
-static int mapVertexEdge(ACTCData *tc, ACTCVertex *v1, ACTCVertex *v2, ACTCEdge **edge)
-{
-    unsigned int i;
-    ACTCEdge tmp;
-    void *r;
-
-    for(i = 0; i < v1->EdgeCount; i++)
-        if(v1->Edges[i].V2 == v2) {
-            v1->Edges[i].Count++;
-            break;
-        }
-
-    if(i == v1->EdgeCount) {
-
-        tmp.V2 = v2;
-        tmp.Count = 1;
-        tmp.Triangles = NULL;
-        tmp.TriangleCount = 0;
-
-        chartedSetLabel("vert-to-edge mapping");
-        r = reallocAndAppend((void **)&v1->Edges, (unsigned int*)&v1->EdgeCount,
-            sizeof(tmp), &tmp);
-        if(r == NULL) {
-            ACTC_DEBUG(fprintf(stderr, "ACTC::mapVertexEdge : Couldn't reallocate "
-                "to %d bytes for vertex's edge list\n", sizeof(tmp) *
-                v1->EdgeCount);)
-            return tc->Error = ACTC_ALLOC_FAILED;
-        }
-    }
-    *edge = &v1->Edges[i];
-
-    return ACTC_NO_ERROR;
-}
-
-static int unmapVertexEdge(ACTCData *tc, ACTCVertex *v1, ACTCVertex *v2)
-{
-    int i;
-
-    for(i = 0; i < v1->EdgeCount; i++)
-        if(v1->Edges[i].V2 == v2)
-            break;
-
-    if(i == v1->EdgeCount) {
-        ACTC_DEBUG(
-            fprintf(stderr, "ACTC::unmapVertexEdge : Couldn't find edge %d,%d"
-                " from vertex in order to unmap it?!?\n", v1->V, v2->V);
-            abortWithOptionalDump(tc);
-        )
-        return tc->Error = ACTC_DATABASE_CORRUPT;
-    }
-
-    v1->Edges[i].Count --;
-    if(v1->Edges[i].Count == 0) {
-        if(v1->Edges[i].Triangles != NULL)
-            free(v1->Edges[i].Triangles);
-        v1->Edges[i] = v1->Edges[v1->EdgeCount - 1];
-        v1->EdgeCount --;
-    }
-
-    return ACTC_NO_ERROR;
-}
-
-int actcAddTriangle(ACTCData *tc, unsigned int v1, unsigned int v2, unsigned int v3)
-{
-    ACTCVertex *vertexRec1;
-    ACTCVertex *vertexRec2;
-    ACTCVertex *vertexRec3;
-
-    ACTCEdge *edge12;
-    ACTCEdge *edge23;
-    ACTCEdge *edge31;
-
-    if(tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcAddTriangle : inside "
-            "BeginOutput/EndOutput\n");)
-        return tc->Error = ACTC_IDLE;
-    }
-    if(!tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcAddTriangle : outside "
-            "BeginInput/EndInput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-
-    if(incVertexValence(tc, v1, &vertexRec1) != ACTC_NO_ERROR) goto returnError1;
-    if(incVertexValence(tc, v2, &vertexRec2) != ACTC_NO_ERROR) goto free1;
-    if(incVertexValence(tc, v3, &vertexRec3) != ACTC_NO_ERROR) goto free2;
-
-    if(mapVertexEdge(tc, vertexRec1, vertexRec2, &edge12) != ACTC_NO_ERROR)
-        goto free3;
-    if(mapVertexEdge(tc, vertexRec2, vertexRec3, &edge23) != ACTC_NO_ERROR)
-        goto free4;
-    if(mapVertexEdge(tc, vertexRec3, vertexRec1, &edge31) != ACTC_NO_ERROR)
-        goto free5;
-
-    if(mapEdgeTriangle(tc, edge12, vertexRec3) != ACTC_NO_ERROR) goto free6;
-    if(mapEdgeTriangle(tc, edge23, vertexRec1) != ACTC_NO_ERROR) goto free7;
-    if(mapEdgeTriangle(tc, edge31, vertexRec2) != ACTC_NO_ERROR) goto free8;
-
-    return ACTC_NO_ERROR;
-
-    /*
-     * XXX Unfortunately, while backing out during the following
-     * statements, we might encounter errors in the database which
-     * will not get returned properly to the caller; I take heart in
-     * the fact that if such an error occurs, TC is just a moment from
-     * core dumping anyway. XXX grantham 20000615
-     */
-
-free8:
-    unmapEdgeTriangle(tc, edge23, vertexRec1);
-free7:
-    unmapEdgeTriangle(tc, edge12, vertexRec3);
-free6:
-    unmapVertexEdge(tc, vertexRec3, vertexRec1);
-free5:
-    unmapVertexEdge(tc, vertexRec2, vertexRec3);
-free4:
-    unmapVertexEdge(tc, vertexRec1, vertexRec2);
-free3:
-    decVertexValence(tc, &vertexRec3);
-free2:
-    decVertexValence(tc, &vertexRec2);
-free1:
-    decVertexValence(tc, &vertexRec1);
-returnError1:
-    return tc->Error;
-}
-
-int actcStartNextPrim(ACTCData *tc, unsigned int *v1Return, unsigned int *v2Return)
-{
-    ACTCVertex *v1 = NULL;
-    ACTCVertex *v2 = NULL;
-    int findResult;
-
-    if(tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcStartNextPrim : within "
-            "BeginInput/EndInput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-    if(!tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcStartNextPrim : outside "
-            "BeginOutput/EndOutput\n");)
-        return tc->Error = ACTC_IDLE;
-    }
-
-    findResult = findNextFanVertex(tc, &v1);
-    if(findResult == ACTC_NO_ERROR)
-        tc->PrimType = ACTC_PRIM_FAN;
-    else if(findResult != ACTC_NO_MATCHING_VERT) {
-        ACTC_DEBUG(fprintf(stderr, "actcStartNextPrim : internal "
-            "error finding next appropriate vertex\n");)
-        return tc->Error = findResult;
-    } else {
-        findResult = findNextStripVertex(tc, &v1);
-        if(findResult != ACTC_NO_ERROR && findResult != ACTC_NO_MATCHING_VERT) {
-            ACTC_DEBUG(fprintf(stderr, "actcStartNextPrim : internal "
-                "error finding next appropriate vertex\n");)
-            return tc->Error = findResult;
-        }
-        tc->PrimType = ACTC_PRIM_STRIP;
-    }
-
-    if(findResult == ACTC_NO_MATCHING_VERT) {
-        *v1Return = -1;
-        *v2Return = -1;
-        return tc->Error = ACTC_DATABASE_EMPTY;
-    }
-
-    v2 = v1->Edges[0].V2;
-
-    tc->CurWindOrder = ACTC_FWD_ORDER;
-    tc->VerticesSoFar = 2;
-
-    tc->V1 = v1;
-    tc->V2 = v2;
-
-    *v1Return = v1->V;
-    *v2Return = v2->V;
-
-    ACTC_INFO(printf("starting with edge %u, %u\n", tc->V1->V, tc->V2->V);)
-
-    return tc->PrimType;
-}
-
-static int findEdge(ACTCVertex *v1, ACTCVertex *v2, ACTCEdge **edge)
-{
-    int i;
-
-    for(i = 0; i < v1->EdgeCount; i++)
-        if(v1->Edges[i].V2 == v2) {
-            *edge = &v1->Edges[i];
-            return 1;
-        }
-    return 0;
-}
-
-int unmapEdgeTriangleByVerts(ACTCData *tc, ACTCVertex *v1, ACTCVertex *v2,
-    ACTCVertex *v3)
-{
-    ACTCEdge *e;
-
-    ACTC_CHECK(findEdge(v1, v2, &e));
-    unmapEdgeTriangle(tc, e, v3);
-    return ACTC_NO_ERROR;
-}
-
-int actcGetNextVert(ACTCData *tc, unsigned int *vertReturn)
-{
-    ACTCEdge *edge;
-    int wasEdgeFound = 0;
-    ACTCVertex *thirdVertex;
-    int wasFoundReversed;
-
-    if(tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcGetNextVert : within BeginInput/"
-            "EndInput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-    if(!tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcGetNextVert : outside BeginOutput/"
-            "EndOutput\n");)
-        return tc->Error = ACTC_IDLE;
-    }
-    if(tc->PrimType == -1) {
-        ACTC_DEBUG(fprintf(stderr, "actcGetNextVert : Asked for next vertex "
-            "without a primitive (got last\n    vertex already?)\n");)
-        return tc->Error = ACTC_INVALID_VALUE;
-    }
-
-    if(tc->VerticesSoFar >= tc->MaxPrimVerts) {
-        tc->PrimType = -1;
-        return tc->Error = ACTC_PRIM_COMPLETE;
-    }
-
-    if(tc->V1 == NULL || tc->V2 == NULL) {
-        tc->PrimType = -1;
-        return tc->Error = ACTC_PRIM_COMPLETE;
-    }
-
-    ACTC_INFO(printf("looking for edge %u, %u\n", tc->V1->V, tc->V2->V);)
-
-    wasFoundReversed = 0;
-
-    if(findEdge(tc->V1, tc->V2, &edge) != 0) {
-        wasEdgeFound = 1;
-    } else if(!tc->HonorWinding) {
-        wasFoundReversed = 1;
-        if(findEdge(tc->V2, tc->V1, &edge) != 0) {
-            wasEdgeFound = 1;
-        }
-    }
-
-    if(!wasEdgeFound) {
-        tc->PrimType = -1;
-        return tc->Error = ACTC_PRIM_COMPLETE;
-    }
-
-    thirdVertex = edge->Triangles[edge->TriangleCount - 1].FinalVert;
-
-    ACTC_INFO(printf("third vertex = %u\n", thirdVertex->V);)
-    *vertReturn = thirdVertex->V;
-
-    if(wasFoundReversed) {
-        ACTC_CHECK(unmapEdgeTriangle(tc, edge, thirdVertex));
-        ACTC_CHECK(unmapEdgeTriangleByVerts(tc, tc->V1, thirdVertex, tc->V2));
-        ACTC_CHECK(unmapEdgeTriangleByVerts(tc, thirdVertex, tc->V2, tc->V1));
-        ACTC_CHECK(unmapVertexEdge(tc, tc->V2, tc->V1));
-        ACTC_CHECK(unmapVertexEdge(tc, tc->V1, thirdVertex));
-        ACTC_CHECK(unmapVertexEdge(tc, thirdVertex, tc->V2));
-    } else {
-        ACTC_CHECK(unmapEdgeTriangle(tc, edge, thirdVertex));
-        ACTC_CHECK(unmapEdgeTriangleByVerts(tc, tc->V2, thirdVertex, tc->V1));
-        ACTC_CHECK(unmapEdgeTriangleByVerts(tc, thirdVertex, tc->V1, tc->V2));
-        ACTC_CHECK(unmapVertexEdge(tc, tc->V1, tc->V2));
-        ACTC_CHECK(unmapVertexEdge(tc, tc->V2, thirdVertex));
-        ACTC_CHECK(unmapVertexEdge(tc, thirdVertex, tc->V1));
-    }
-    ACTC_CHECK(decVertexValence(tc, &tc->V1));
-    ACTC_CHECK(decVertexValence(tc, &tc->V2));
-    ACTC_CHECK(decVertexValence(tc, &thirdVertex));
-
-    if(tc->PrimType == ACTC_PRIM_FAN) {
-        tc->V2 = thirdVertex;
-    } else /* PRIM_STRIP */ {
-        if(tc->CurWindOrder == ACTC_FWD_ORDER)
-            tc->V1 = thirdVertex;
-        else
-            tc->V2 = thirdVertex;
-        tc->CurWindOrder = !tc->CurWindOrder;
-    }
-
-    tc->VerticesSoFar++;
-    return ACTC_NO_ERROR;
-}
-
-int actcTrianglesToPrimitives(ACTCData *tc, int triangleCount,
-    unsigned int (*triangles)[3], int primTypes[], int primLengths[], unsigned int vertices[],
-    int maxBatchSize)
-{
-    int r;
-    int curTriangle;
-    int curPrimitive;
-    unsigned int curVertex;
-    int prim;
-    unsigned int v1, v2, v3;
-    int lastPrim;
-    int passesWithoutPrims;
-    int trisSoFar;
-
-    if(tc->IsInputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcTrianglesToPrimitives : within BeginInput/"
-            "EndInput\n");)
-        return tc->Error = ACTC_DURING_INPUT;
-    }
-    if(tc->IsOutputting) {
-        ACTC_DEBUG(fprintf(stderr, "actcTrianglesToPrimitives : within"
-            "BeginOutput/EndOutput\n");)
-        return tc->Error = ACTC_DURING_OUTPUT;
-    }
-    curTriangle = 0;
-    curPrimitive = 0;
-    curVertex = 0;
-    passesWithoutPrims = 0;
-
-    actcMakeEmpty(tc);
-
-    ACTC_CHECK(actcBeginInput(tc));
-    trisSoFar = 0;
-    while(curTriangle < triangleCount) {
-        r = actcAddTriangle(tc, triangles[curTriangle][0],
-            triangles[curTriangle][1], triangles[curTriangle][2]);
-        trisSoFar++;
-        curTriangle++;
-        if((trisSoFar >= maxBatchSize) ||
-            (r == ACTC_ALLOC_FAILED && curTriangle != triangleCount) ||
-            (r == ACTC_NO_ERROR && curTriangle == triangleCount)) {
-
-            /* drain what we got */
-            trisSoFar = 0;
-            ACTC_CHECK(actcEndInput(tc));
-            ACTC_CHECK(actcBeginOutput(tc));
-            lastPrim = curPrimitive;
-            while((prim = actcStartNextPrim(tc, &v1, &v2)) != ACTC_DATABASE_EMPTY) {
-                ACTC_CHECK(prim);
-                primTypes[curPrimitive] = prim;
-                primLengths[curPrimitive] = 2;
-                vertices[curVertex++] = v1;
-                vertices[curVertex++] = v2;
-                while((r = actcGetNextVert(tc, &v3)) != ACTC_PRIM_COMPLETE) {
-                    ACTC_CHECK(r);
-                    vertices[curVertex++] = v3;
-                    primLengths[curPrimitive]++;
-                }
-                curPrimitive++;
-            }
-            ACTC_CHECK(actcEndOutput(tc));
-            if(r == ACTC_ALLOC_FAILED && curPrimitive == lastPrim) {
-                if(passesWithoutPrims == 0) {
-                    /* not enough memory to add a triangle and */
-                    /* nothing in the database, better free everything */
-                    /* and try again */
-                    actcMakeEmpty(tc);
-                } else {
-                    /* cleaned up and STILL couldn't get a triangle in; */
-                    /* give up */
-                    return tc->Error = ACTC_ALLOC_FAILED;
-                }
-                passesWithoutPrims++;
-            }
-            ACTC_CHECK(actcBeginInput(tc));
-        } else
-            ACTC_CHECK(r);
-        if(r == ACTC_ALLOC_FAILED)
-            curTriangle--;
-    }
-    ACTC_CHECK(actcEndInput(tc));
-
-    actcMakeEmpty(tc);
-
-    return curPrimitive;
-}
-
-/* vi:tabstop=8
- */
Index: /branches/network/src/util/hud.cc
===================================================================
--- /branches/network/src/util/hud.cc	(revision 6692)
+++ /branches/network/src/util/hud.cc	(revision 6693)
@@ -126,7 +126,5 @@
     {
       weapon->getEnergyWidget()->show();
-      weapon->getLoadedEnergyWidget()->show();
       this->weaponsWidgets.push_back(weapon->getEnergyWidget());
-      this->weaponsWidgets.push_back(weapon->getLoadedEnergyWidget());
     }
   }
Index: /branches/network/src/util/loading/resource_manager.cc
===================================================================
--- /branches/network/src/util/loading/resource_manager.cc	(revision 6692)
+++ /branches/network/src/util/loading/resource_manager.cc	(revision 6693)
@@ -18,7 +18,9 @@
 #include "resource_manager.h"
 
+#include "substring.h"
 #include "debug.h"
 
 #include <algorithm>
+#include <assert.h>
 
 // different resource Types
@@ -50,5 +52,5 @@
 
 /**
- *  standard constructor
+ * @brief standard constructor
 */
 ResourceManager::ResourceManager ()
@@ -66,5 +68,5 @@
 
 /**
- *  standard destructor
+ * @brief standard destructor
 */
 ResourceManager::~ResourceManager ()
@@ -78,8 +80,8 @@
   // deleting the Directorie Lists
   while (!this->imageDirs.empty())
-    {
-      delete[] this->imageDirs.front();
-      this->imageDirs.pop_front();
-    }
+  {
+    delete[] this->imageDirs.back();
+    this->imageDirs.pop_back();
+  }
 
   delete[] this->dataDir;
@@ -89,5 +91,5 @@
 
 /**
- *  sets the data main directory
+ * @brief sets the data main directory
  * @param dataDir the DataDirectory.
  */
@@ -122,5 +124,5 @@
 
 /**
- * sets the data main directory
+ * @brief sets the data main directory
  * @param dataDir the DataDirectory.
  *
@@ -153,7 +155,6 @@
 
 
-
-/**
- * checks for the DataDirectory, by looking if
+/**
+ * @brief checks for the DataDirectory, by looking if
  * @param fileInside is iniside of the given directory.
 */
@@ -162,8 +163,8 @@
   bool retVal;
   if (!isDir(this->dataDir))
-    {
-      PRINTF(1)("%s is not a directory\n", this->dataDir);
-      return false;
-    }
+  {
+    PRINTF(1)("%s is not a directory\n", this->dataDir);
+    return false;
+  }
 
   char* testFile = new char[strlen(this->dataDir)+strlen(fileInside)+1];
@@ -176,5 +177,5 @@
 #ifndef NO_TEXTURES
 /**
- *  adds a new Path for Images
+ * @brief adds a new Path for Images
  * @param imageDir The path to insert
  * @returns true, if the Path was well and injected (or already existent within the list)
@@ -201,39 +202,40 @@
   // check if the param is a Directory
   if (isDir(newDir))
-    {
-      // check if the Directory has been added before
-      std::list<char*>::const_iterator imageDir;
-      for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
+  {
+    // check if the Directory has been added before
+    std::vector<char*>::const_iterator imageDir;
+    for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
+    {
+      if (!strcmp(*imageDir, newDir))
       {
-         if (!strcmp(*imageDir, newDir))
-         {
-           PRINTF(3)("Path %s already loaded\n", newDir);
-           delete[] newDir;
-           return true;
-         }
+        PRINTF(3)("Path %s already loaded\n", newDir);
+        delete[] newDir;
+        return true;
       }
-      // adding the directory to the List
-      this->imageDirs.push_back(newDir);
-      return true;
-    }
-  else
-    {
-      PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", newDir);
-      delete[] newDir;
-      return false;
-    }
+    }
+    // adding the directory to the List
+    this->imageDirs.push_back(newDir);
+    return true;
+  }
+  else
+  {
+    PRINTF(1)("%s is not a Directory, and can not be added to the Paths of Images\n", newDir);
+    delete[] newDir;
+    return false;
+  }
 }
 #endif /* NO_TEXTURES */
 
 /**
- *  loads resources
+ * @brief loads resources
  * @param fileName: The fileName of the resource to load
  * @param prio: The ResourcePriority of this resource (will only be increased)
+ * @param param0: an additional option to parse (see the constuctors for more help)
  * @param param1: an additional option to parse (see the constuctors for more help)
  * @param param2: an additional option to parse (see the constuctors for more help)
- * @param param3: an additional option to parse (see the constuctors for more help)
  * @returns a pointer to a desired Resource.
 */
-BaseObject* ResourceManager::load(const char* fileName, ResourcePriority prio, void* param1, void* param2, void* param3)
+BaseObject* ResourceManager::load(const char* fileName, ResourcePriority prio,
+                                  const MultiType& param0, const MultiType& param1, const MultiType& param2)
 {
   if (fileName == NULL)
@@ -258,233 +260,306 @@
 #endif
 #define __IF_OK
-  if (!strncasecmp(fileName+(strlen(fileName)-4), ".wav", 4))
-    tmpType = WAV;
-  else if (!strncasecmp(fileName+(strlen(fileName)-4), ".mp3", 4))
-    tmpType = MP3;
-  else if (!strncasecmp(fileName+(strlen(fileName)-4), ".ogg", 4))
-    tmpType = OGG;
+    if (!strncasecmp(fileName+(strlen(fileName)-4), ".wav", 4))
+      tmpType = WAV;
+    else if (!strncasecmp(fileName+(strlen(fileName)-4), ".mp3", 4))
+      tmpType = MP3;
+    else if (!strncasecmp(fileName+(strlen(fileName)-4), ".ogg", 4))
+      tmpType = OGG;
 #endif /* NO_AUDIO */
 #ifndef NO_TEXT
 #ifdef __IF_OK
-  else
+    else
 #endif
 #define __IF_OK
- if (!strncasecmp(fileName+(strlen(fileName)-4), ".ttf", 4))
-    tmpType = TTF;
+      if (!strncasecmp(fileName+(strlen(fileName)-4), ".ttf", 4))
+        tmpType = TTF;
 #endif /* NO_TEXT */
 #ifndef NO_SHADERS
 #ifdef __IF_OK
-  else
+      else
 #endif
 #define __IF_OK
- if (!strncasecmp(fileName+(strlen(fileName)-5), ".vert", 5))
-    tmpType = SHADER;
+        if (!strncasecmp(fileName+(strlen(fileName)-5), ".vert", 5))
+          tmpType = SHADER;
 #endif /* NO_SHADERS */
 #ifndef NO_TEXTURES
 #ifdef __IF_OK
-  else
+        else
 #else
   if
 #endif
-   tmpType = IMAGE;
+          tmpType = IMAGE;
 #endif /* NO_TEXTURES */
 #undef __IF_OK
-  return this->load(fileName, tmpType, prio, param1, param2, param3);
-}
-
-/**
- * loads resources
+  return this->load(fileName, tmpType, prio, param0, param1, param2);
+}
+
+/**
+ * @brief caches a Resource
+ *
+ * @see load;
+ *
+ * @brief returns true if ok, false otherwise.
+ * This function loads a Resource without applying it to an Object.
+ * This is for loading purposes, e.g, when the user is loading a Resource
+ * during the initialisation instead of at Runtime.
+ */
+bool ResourceManager::cache(const char* fileName, ResourceType type, ResourcePriority prio,
+                            const MultiType& param0, const MultiType& param1, const MultiType& param2)
+{
+  assert(fileName != NULL);
+
+  // searching if the resource was loaded before.
+  Resource* tmpResource;
+  // check if we already loaded this Resource
+  tmpResource = this->locateResourceByInfo(fileName, type, param0, param1, param2);
+  // otherwise load it
+  if (tmpResource == NULL)
+    tmpResource = this->loadResource(fileName, type, prio, param0, param1, param2);
+  // return cached pointer.
+  if (tmpResource != NULL) // if the resource was loaded before.
+  {
+    if(tmpResource->prio < prio)
+      tmpResource->prio = prio;
+    return true;
+  }
+  else
+    return false;
+}
+
+/**
+ * tells the ResourceManager to generate a Copy of the Resource.
+ * @brief resourcePointer: The Pointer to the resource to copy
+ * @returns the Resource pointed to resourcePointer.
+ */
+BaseObject* ResourceManager::copy(BaseObject* resourcePointer)
+{
+  Resource* tmp = locateResourceByPointer(resourcePointer);
+  if (tmp!=NULL)
+  {
+    tmp->count++;
+    return tmp->pointer;
+  }
+  else
+    return NULL;
+}
+
+
+/**
+ * @brief loads resources
  * @param fileName: The fileName of the resource to load
  * @param type: The Type of Resource to load.
  * @param prio: The ResourcePriority of this resource (will only be increased)
+ * @param param0: an additional option to parse (see the constuctors for more help)
  * @param param1: an additional option to parse (see the constuctors for more help)
  * @param param2: an additional option to parse (see the constuctors for more help)
- * @param param3: an additional option to parse (see the constuctors for more help)
  * @returns a pointer to a desired Resource.
 */
 BaseObject* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio,
-                            void* param1, void* param2, void* param3)
-{
-  if (fileName == NULL)
+                                  const MultiType& param0, const MultiType& param1, const MultiType& param2)
+{
+  assert(fileName != NULL);
+
+  // searching if the resource was loaded before.
+  Resource* tmpResource;
+  // check if we already loaded this Resource
+  tmpResource = this->locateResourceByInfo(fileName, type, param0, param1, param2);
+  // otherwise load it
+  if (tmpResource == NULL)
+  {
+    tmpResource = this->loadResource(fileName, type, prio, param0, param1, param2);
+  }
+  // return cached pointer.
+  if (tmpResource != NULL) // if the resource was loaded before.
+  {
+    tmpResource->count++;
+    if(tmpResource->prio < prio)
+      tmpResource->prio = prio;
+
+    return tmpResource->pointer;
+  }
+  else
     return NULL;
-
-  // searching if the resource was loaded before.
-  Resource* tmpResource = this->locateResourceByInfo(fileName, type, param1, param2, param3);
-  if (tmpResource != NULL) // if the resource was loaded before.
-    {
-      PRINTF(4)("not loading cached resource %s\n", tmpResource->name);
-      tmpResource->count++;
-      if(tmpResource->prio < prio)
-        tmpResource->prio = prio;
-    }
-  else
-    {
-      // Setting up the new Resource
-      tmpResource = new Resource;
-      tmpResource->count = 1;
-      tmpResource->type = type;
-      tmpResource->prio = prio;
-      tmpResource->pointer = NULL;
-      tmpResource->name = new char[strlen(fileName)+1];
-      strcpy(tmpResource->name, fileName);
-
-      // creating the full name. (directoryName + FileName)
-      char* fullName = ResourceManager::getFullName(fileName);
-      // Checking for the type of resource \see ResourceType
-      switch(type)
-        {
+}
+
+
+/**
+ * @brief loads resources for internal purposes
+ * @param fileName: The fileName of the resource to load
+ * @param type: The Type of Resource to load.
+ * @param prio: The ResourcePriority of this resource (will only be increased)
+ * @param param0: an additional option to parse (see the constuctors for more help)
+ * @param param1: an additional option to parse (see the constuctors for more help)
+ * @param param2: an additional option to parse (see the constuctors for more help)
+ * @returns a pointer to a desired Resource.
+ */
+Resource* ResourceManager::loadResource(const char* fileName, ResourceType type, ResourcePriority prio,
+                                        const MultiType& param0, const MultiType& param1, const MultiType& param2)
+{
+  // Setting up the new Resource
+  Resource* tmpResource = new Resource;
+  tmpResource->count = 0;
+  tmpResource->type = type;
+  tmpResource->prio = prio;
+  tmpResource->pointer = NULL;
+  tmpResource->name = new char[strlen(fileName)+1];
+  strcpy(tmpResource->name, fileName);
+
+  // creating the full name. (directoryName + FileName)
+  char* fullName = ResourceManager::getFullName(fileName);
+  // Checking for the type of resource \see ResourceType
+  switch(type)
+  {
 #ifndef NO_MODEL
-        case OBJ:
-          if (param1)
-            tmpResource->modelSize = *(float*)param1;
-          else
-            tmpResource->modelSize = 1.0;
-
-          if(ResourceManager::isFile(fullName))
-            tmpResource->pointer = new OBJModel(fullName, tmpResource->modelSize);
-          else
-            {
-              PRINTF(2)("File %s in %s does not exist. Loading a cube-Model instead\n", fileName, dataDir);
-              tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, &tmpResource->modelSize);
-            }
-          break;
-        case PRIM:
-          if (param1)
-            tmpResource->modelSize = *(float*)param1;
-          else
-            tmpResource->modelSize = 1.0;
-
-          if (!strcmp(tmpResource->name, "cube"))
-            tmpResource->pointer = new PrimitiveModel(PRIM_CUBE, tmpResource->modelSize);
-          else if (!strcmp(tmpResource->name, "sphere"))
-            tmpResource->pointer = new PrimitiveModel(PRIM_SPHERE, tmpResource->modelSize);
-          else if (!strcmp(tmpResource->name, "plane"))
-            tmpResource->pointer = new PrimitiveModel(PRIM_PLANE, tmpResource->modelSize);
-          else if (!strcmp(tmpResource->name, "cylinder"))
-            tmpResource->pointer = new PrimitiveModel(PRIM_CYLINDER, tmpResource->modelSize);
-          else if (!strcmp(tmpResource->name, "cone"))
-            tmpResource->pointer = new PrimitiveModel(PRIM_CONE, tmpResource->modelSize);
-          break;
-        case MD2:
-          if(ResourceManager::isFile(fullName))
-            {
-              if (param1 != NULL)
-                {
-                  tmpResource->secFileName = new char[strlen((const char*)param1)+1];
-                  strcpy(tmpResource->secFileName, (const char*) param1);
-                }
-              else
-                tmpResource->secFileName = NULL;
-                tmpResource->pointer = new MD2Data(fullName, tmpResource->secFileName);
-//               tmpResource->pointer = new MD2Model(fullName, tmpResource->secFileName);
-
-            }
-              break;
+    case OBJ:
+      if (param0.getType() != MT_NULL)
+        tmpResource->param[0] = param0;
+      else
+        tmpResource->param[0] = 1.0f;
+
+      if(ResourceManager::isFile(fullName))
+        tmpResource->pointer = new OBJModel(fullName, tmpResource->param[0].getFloat());
+      else
+      {
+        PRINTF(2)("File %s in %s does not exist. Loading a cube-Model instead\n", fileName, dataDir);
+        tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, tmpResource->param[0].getFloat());
+      }
+      break;
+    case PRIM:
+      if (param0 != MT_NULL)
+        tmpResource->param[0] = param0;
+      else
+        tmpResource->param[0] = 1.0f;
+
+      if (!strcmp(tmpResource->name, "cube"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_CUBE, tmpResource->param[0].getFloat());
+      else if (!strcmp(tmpResource->name, "sphere"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_SPHERE, tmpResource->param[0].getFloat());
+      else if (!strcmp(tmpResource->name, "plane"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_PLANE, tmpResource->param[0].getFloat());
+      else if (!strcmp(tmpResource->name, "cylinder"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_CYLINDER, tmpResource->param[0].getFloat());
+      else if (!strcmp(tmpResource->name, "cone"))
+        tmpResource->pointer = new PrimitiveModel(PRIM_CONE, tmpResource->param[0].getFloat());
+      break;
+    case MD2:
+      if(ResourceManager::isFile(fullName))
+      {
+        tmpResource->param[0] = param0;
+        tmpResource->pointer = new MD2Data(fullName, tmpResource->param[0].getString());
+        //               tmpResource->pointer = new MD2Model(fullName, tmpResource->secFileName);
+
+      }
+      break;
 #endif /* NO_MODEL */
 #ifndef NO_TEXT
-        case TTF:
-            if (param1 != NULL)
-              tmpResource->ttfSize = *(unsigned int*)param1;
-            else
-              tmpResource->ttfSize = FONT_DEFAULT_RENDER_SIZE;
-
-          if(isFile(fullName))
-            tmpResource->pointer = new Font(fullName, tmpResource->ttfSize);
-          else
-            PRINTF(2)("%s does not exist in %s. Not loading Font\n", fileName, this->dataDir);
-          break;
+    case TTF:
+      if (param0 != MT_NULL)
+      {
+        assert(param0.getInt() >= 0);
+        tmpResource->param[0] = param0;
+      }
+      else
+        tmpResource->param[0] = FONT_DEFAULT_RENDER_SIZE;
+
+      if(isFile(fullName))
+        tmpResource->pointer = new Font(fullName, (unsigned int) tmpResource->param[0].getInt());
+      else
+        PRINTF(2)("%s does not exist in %s. Not loading Font\n", fileName, this->dataDir);
+      break;
 #endif /* NO_TEXT */
 #ifndef NO_AUDIO
-        case WAV:
-          if(isFile(fullName))
-            tmpResource->pointer = new SoundBuffer(fullName);
-          break;
-        case OGG:
-          if (isFile(fullName))
-            tmpResource->pointer = new OggPlayer(fullName);
-          break;
+    case WAV:
+      if(isFile(fullName))
+        tmpResource->pointer = new SoundBuffer(fullName);
+      break;
+    case OGG:
+      if (isFile(fullName))
+        tmpResource->pointer = new OggPlayer(fullName);
+      break;
 #endif /* NO_AUDIO */
 #ifndef NO_TEXTURES
-        case IMAGE:
-          if (param1 != NULL)
-            tmpResource->texTarget = *(GLenum*)param1;
-          else
-            tmpResource->texTarget = GL_TEXTURE_2D;
-          if(isFile(fullName))
-            {
-              PRINTF(4)("Image %s resides to %s\n", fileName, fullName);
-              tmpResource->pointer = new Texture(fullName);
-            }
-          else
-            {
-              std::list<char*>::iterator imageDir;
-              for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
-                {
-                  char* imgName = new char[strlen(*imageDir)+strlen(fileName)+1];
-                  sprintf(imgName, "%s%s", *imageDir, fileName);
-                  if(isFile(imgName))
-                    {
-                      PRINTF(4)("Image %s resides to %s\n", fileName, imgName);
-                      tmpResource->pointer = new Texture(imgName, tmpResource->texTarget);
-                      delete[] imgName;
-                      break;
-                    }
-                  delete[] imgName;
-                }
-            }
-          if(!tmpResource)
-             PRINTF(2)("!!Image %s not Found!!\n", fileName);
-          break;
+    case IMAGE:
+      if (param0 != MT_NULL)
+        tmpResource->param[0] = param0;
+      else
+        tmpResource->param[0] = GL_TEXTURE_2D;
+      if(isFile(fullName))
+      {
+        PRINTF(4)("Image %s resides to %s\n", fileName, fullName);
+        tmpResource->pointer = new Texture(fullName);
+      }
+      else
+      {
+        std::vector<char*>::iterator imageDir;
+        for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
+        {
+          char* imgName = new char[strlen(*imageDir)+strlen(fileName)+1];
+          sprintf(imgName, "%s%s", *imageDir, fileName);
+          if(isFile(imgName))
+          {
+            PRINTF(4)("Image %s resides to %s\n", fileName, imgName);
+            tmpResource->pointer = new Texture(imgName, tmpResource->param[0].getInt());
+            delete[] imgName;
+            break;
+          }
+          delete[] imgName;
+        }
+      }
+      if(!tmpResource)
+        PRINTF(2)("!!Image %s not Found!!\n", fileName);
+      break;
 #endif /* NO_TEXTURES */
 #ifndef NO_SHADERS
-          case SHADER:
-            if(ResourceManager::isFile(fullName))
-            {
-              if (param1 != NULL)
-              {
-                char* secFullName = ResourceManager::getFullName((const char*)param1);
-                if (ResourceManager::isFile(secFullName))
-                {
-                  tmpResource->secFileName = new char[strlen((const char*)param1)+1];
-                  strcpy(tmpResource->secFileName, (const char*) param1);
-                  tmpResource->pointer = new Shader(fullName, secFullName);
-                }
-                delete[] secFullName;
-              }
-              else
-              {
-                tmpResource->secFileName = NULL;
-                tmpResource->pointer = new Shader(fullName, NULL);
-              }
-            }
-            break;
+    case SHADER:
+      if(ResourceManager::isFile(fullName))
+      {
+        if (param0 != MT_NULL)
+        {
+          MultiType param = param0; /// HACK
+          char* secFullName = ResourceManager::getFullName(param.getString());
+          if (ResourceManager::isFile(secFullName))
+          {
+            tmpResource->param[0] = secFullName;
+            tmpResource->pointer = new Shader(fullName, secFullName);
+          }
+          delete[] secFullName;
+        }
+        else
+        {
+          tmpResource->param[0] = param0;
+          tmpResource->pointer = new Shader(fullName, NULL);
+        }
+      }
+      break;
 #endif /* NO_SHADERS */
-        default:
-          tmpResource->pointer = NULL;
-          PRINTF(1)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet. JUST DO IT!!\n", tmpResource->name);
-          break;
-        }
-      if (tmpResource->pointer != NULL)
-        this->resourceList.push_back(tmpResource);
-      delete[] fullName;
-    }
+    default:
+      tmpResource->pointer = NULL;
+      PRINTF(1)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet. JUST DO IT!!\n", tmpResource->name);
+      break;
+  }
   if (tmpResource->pointer != NULL)
-    return tmpResource->pointer;
-  else
-    {
-      PRINTF(2)("Resource %s could not be loaded\n", fileName);
-      delete[] tmpResource->name;
-      delete tmpResource;
-      return NULL;
-    }
-}
-
-/**
- * unloads a Resource
+    this->resourceList.push_back(tmpResource);
+  delete[] fullName;
+
+
+  if (tmpResource->pointer != NULL)
+    return tmpResource;
+  else
+  {
+    PRINTF(2)("Resource %s could not be loaded\n", fileName);
+    delete[] tmpResource->name;
+    delete tmpResource;
+    return NULL;
+  }
+}
+
+/**
+ * @brief unloads a Resource
  * @param pointer: The pointer to free
  * @param prio: the PriorityLevel to unload this resource
  * @returns true if successful (pointer found, and deleted), false otherwise
 */
-bool ResourceManager::unload(void* pointer, ResourcePriority prio)
+bool ResourceManager::unload(BaseObject* pointer, ResourcePriority prio)
 {
   if (pointer == NULL)
@@ -502,5 +577,5 @@
 
 /**
- * unloads a Resource
+ * @brief unloads a Resource
  * @param resource: The resource to unloade
  * @param prio the PriorityLevel to unload this resource
@@ -515,57 +590,57 @@
 
   if (resource->prio <= prio)
-    {
-      if (resource->count == 0)
-        {
-          // deleting the Resource
-          switch(resource->type)
-            {
+  {
+    if (resource->count == 0)
+    {
+      // deleting the Resource
+      switch(resource->type)
+      {
 #ifndef NO_MODEL
-            case OBJ:
-            case PRIM:
-              delete (Model*)resource->pointer;
-              break;
-            case MD2:
-              delete (MD2Data*)resource->pointer;
-              break;
+        case OBJ:
+        case PRIM:
+          delete (Model*)resource->pointer;
+          break;
+        case MD2:
+          delete (MD2Data*)resource->pointer;
+          break;
 #endif /* NO_MODEL */
 #ifndef NO_AUDIO
-            case WAV:
-              delete (SoundBuffer*)resource->pointer;
-              break;
-            case OGG:
-              delete (OggPlayer*)resource->pointer;
-              break;
+        case WAV:
+          delete (SoundBuffer*)resource->pointer;
+          break;
+        case OGG:
+          delete (OggPlayer*)resource->pointer;
+          break;
 #endif /* NO_AUDIO */
 #ifndef NO_TEXT
-            case TTF:
-              delete (Font*)resource->pointer;
-              break;
+        case TTF:
+          delete (Font*)resource->pointer;
+          break;
 #endif /* NO_TEXT */
 #ifndef NO_TEXTURES
-            case IMAGE:
-              delete (Texture*)resource->pointer;
-              break;
+        case IMAGE:
+          delete (Texture*)resource->pointer;
+          break;
 #endif /* NO_TEXTURES */
 #ifndef NO_SHADERS
-            case SHADER:
-              delete (Shader*)resource->pointer;
-              break;
+        case SHADER:
+          delete (Shader*)resource->pointer;
+          break;
 #endif /* NO_SHADERS */
-            default:
-              PRINTF(2)("NOT YET IMPLEMENTED !!FIX FIX!!\n");
-              return false;
-              break;
-            }
-          // deleting the List Entry:
-          PRINTF(4)("Resource %s safely removed.\n", resource->name);
-          delete[] resource->name;
-          std::list<Resource*>::iterator resourceIT = std::find(this->resourceList.begin(), this->resourceList.end(), resource);
-          this->resourceList.erase(resourceIT);
-          delete resource;
-        }
-      else
-        PRINTF(4)("Resource %s not removed, because there are still %d References to it.\n", resource->name, resource->count);
-    }
+        default:
+          PRINTF(2)("NOT YET IMPLEMENTED !!FIX FIX!!\n");
+          return false;
+          break;
+      }
+      // deleting the List Entry:
+      PRINTF(4)("Resource %s safely removed.\n", resource->name);
+      delete[] resource->name;
+      std::vector<Resource*>::iterator resourceIT = std::find(this->resourceList.begin(), this->resourceList.end(), resource);
+      this->resourceList.erase(resourceIT);
+      delete resource;
+    }
+    else
+      PRINTF(4)("Resource %s not removed, because there are still %d References to it.\n", resource->name, resource->count);
+  }
   else
     PRINTF(4)("not deleting resource %s because DeleteLevel to high\n", resource->name);
@@ -575,139 +650,191 @@
 
 /**
- * unloads all alocated Memory of Resources with a pririty lower than prio
+ * @brief unloads all alocated Memory of Resources with a pririty lower than prio
  * @param prio The priority to delete
 */
 bool ResourceManager::unloadAllByPriority(ResourcePriority prio)
 {
-  std::list<Resource*>::iterator resource, pre;
-  pre = --this->resourceList.end();
   unsigned int removeCount;
   for (unsigned int round = 0; round < 3; round++)
   {
+    int index = this->resourceList.size() - 1;
     removeCount = 0;
-    while (pre != resourceList.end())
-    {
-      resource = pre;
-      pre--;
-        if ((*resource)->prio <= prio)
+    while (index >= 0)
+    {
+      if (this->resourceList[index]->prio <= prio)
+      {
+        if (this->resourceList[index]->count == 0)
+          unload(this->resourceList[index], prio);
+        else
         {
-          if ((*resource)->count == 0)
-            unload((*resource), prio);
-          else
-          {
+          if (round == 3)
             PRINTF(2)("unable to unload %s because there are still %d references to it\n",
-                     (*resource)->name, (*resource)->count);
-            removeCount++;
-          }
+                      this->resourceList[index]->name, this->resourceList[index]->count);
+          removeCount++;
         }
-     }
-     if (removeCount == 0) break;
-  }
-}
-
-
-/**
- * Searches for a Resource by some information
+      }
+      index--;
+    }
+    if (removeCount == 0) break;
+  }
+}
+
+
+/**
+ * @brief Searches for a Resource by some information
  * @param fileName: The name to look for
  * @param type the Type of resource to locate.
+ * @param param0: an additional option to parse (see the constuctors for more help)
  * @param param1: an additional option to parse (see the constuctors for more help)
  * @param param2: an additional option to parse (see the constuctors for more help)
- * @param param3: an additional option to parse (see the constuctors for more help)
  * @returns a Pointer to the Resource if found, NULL otherwise.
 */
 Resource* ResourceManager::locateResourceByInfo(const char* fileName, ResourceType type,
-                                                void* param1, void* param2, void* param3) const
-{
-  std::list<Resource*>::const_iterator resource;
+    const MultiType& param0, const MultiType& param1, const MultiType& param2) const
+{
+  std::vector<Resource*>::const_iterator resource;
   for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
   {
     if ((*resource)->type == type && !strcmp(fileName, (*resource)->name))
-        {
-          bool match = false;
-
-          switch (type)
-            {
+    {
+      bool match = false;
+      switch (type)
+      {
 #ifndef NO_MODEL
-            case PRIM:
-            case OBJ:
-              if (!param1)
-                {
-                  if ((*resource)->modelSize == 1.0)
-                    match = true;
-                }
-              else if ((*resource)->modelSize == *(float*)param1)
-                match = true;
-              break;
-            case MD2:
-              if (!param1)
-                {
-                  if ((*resource)->secFileName == NULL)
-                    match = true;
-                }
-              else if (!strcmp((*resource)->secFileName, (const char*)param1))
-                match = true;
-              break;
+        case PRIM:
+        case OBJ:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == 1.0f)
+              match = true;
+          }
+          else if ((*resource)->param[0] == param0.getFloat())
+            match = true;
+          break;
+        case MD2:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == "")
+              match = true;
+          }
+          else if ((*resource)->param[0] == ((MultiType)param0).getString())
+            match = true;
+          break;
 #endif /* NO_MODEL */
 #ifndef NO_TEXT
-            case TTF:
-              if (param1 == NULL)
-                {
-                  if ((*resource)->ttfSize == FONT_DEFAULT_RENDER_SIZE)
-                    match = true;
-                }
-              else if ((*resource)->ttfSize == *(unsigned int*)param1)
-                match = true;
-              break;
+        case TTF:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == FONT_DEFAULT_RENDER_SIZE)
+              match = true;
+          }
+          else if ((*resource)->param[0] == param0.getInt())
+            match = true;
+          break;
 #endif /* NO_TEXT */
 #ifndef NO_SHADERS
-              case SHADER:
-                if (!param1)
-                {
-                  if ((*resource)->secFileName == NULL)
-                    match = true;
-                }
-                else if (!strcmp((*resource)->secFileName, (const char*)param1))
-                  match = true;
+        case SHADER:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == "")
+              match = true;
+          }
+          else if ((*resource)->param[0] == ((MultiType)param0).getString())
+            match = true;
 #endif /* NO_SHADERS */
 #ifndef NO_TEXTURES
-              case IMAGE:
-                if (!param1)
-                {
-                  if ((*resource)->texTarget == GL_TEXTURE_2D)
-                    match = true;
-                }
-                else if ((*resource)->texTarget ==  *(GLenum*)param1)
-                  match = true;
+        case IMAGE:
+          if (param0 == MT_NULL)
+          {
+            if ((*resource)->param[0] == GL_TEXTURE_2D)
+              match = true;
+          }
+          else if ((*resource)->param[0] ==  param0.getInt())
+            match = true;
 #endif /* NO_TEXTURES */
-            default:
-              match = true;
-              break;
-            }
-          if (match)
-            {
-              return (*resource);
-            }
-        }
-    }
+        default:
+          match = true;
+          break;
+      }
+      if (match)
+      {
+        return (*resource);
+      }
+    }
+  }
   return NULL;
 }
 
 /**
- * Searches for a Resource by Pointer
+ * @brief Searches for a Resource by Pointer
  * @param pointer the Pointer to search for
  * @returns a Pointer to the Resource if found, NULL otherwise.
-*/
+ */
 Resource* ResourceManager::locateResourceByPointer(const void* pointer) const
 {
   //  Resource* enumRes = resourceList->enumerate();
-  std::list<Resource*>::const_iterator resource;
+  std::vector<Resource*>::const_iterator resource;
   for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
     if (pointer == (*resource)->pointer)
-        return (*resource);
+      return (*resource);
   return NULL;
 }
 
-/**
- * Checks if it is a Directory
+char* ResourceManager::toResourcableString(unsigned int i)
+{
+  int len = strlen(ResourceManager::ResourceTypeToChar(this->resourceList[i]->type));
+  len += strlen(this->resourceList[i]->name);
+  if (this->resourceList[i]->param[0].getString()) len += strlen(this->resourceList[i]->param[0].getString()) +1;
+  if (this->resourceList[i]->param[1].getString()) len += strlen(this->resourceList[i]->param[1].getString()) +1;
+  if (this->resourceList[i]->param[2].getString()) len += strlen(this->resourceList[i]->param[2].getString()) +1;
+  len += 10;
+  char* tmp = new char[len];
+  tmp[0] = '\0';
+  strcat( tmp, ResourceManager::ResourceTypeToChar(this->resourceList[i]->type));
+  strcat(tmp,",");
+  strcat (tmp, this->resourceList[i]->name);
+  if (this->resourceList[i]->param[0].getString() && this->resourceList[i]->param[0].getString() != '\0')
+  {
+    strcat(tmp,",");
+    strcat( tmp, this->resourceList[i]->param[0].getString());
+  }
+  if (this->resourceList[i]->param[1].getString() && this->resourceList[i]->param[1].getString() != '\0')
+  {
+    strcat(tmp,",");
+    strcat( tmp, this->resourceList[i]->param[1].getString());
+  }
+  if (this->resourceList[i]->param[2].getString() && this->resourceList[i]->param[2].getString() != '\0')
+  {
+    strcat(tmp,",");
+    strcat( tmp, this->resourceList[i]->param[2].getString());
+  }
+  return tmp;
+}
+
+/**
+ * @brief caches a Resource from a ResourceableString created with the toResourcableString-function
+ * @param resourceableString the String to cache the resource from.
+ */
+bool ResourceManager::fromResourceableString(const char* resourceableString)
+{
+  SubString splits(resourceableString, ',');
+  splits.debug();
+  if (splits.getCount() == 2)
+    this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
+                RP_LEVEL);
+  else if (splits.getCount() == 3)
+    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
+                RP_LEVEL, splits[2]);
+  else if (splits.getCount() == 4)
+    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
+                RP_LEVEL, splits[2], splits[3]);
+  else if (splits.getCount() == 5)
+    return this->cache(splits[1], ResourceManager::stringToResourceType(splits[0]),
+                RP_LEVEL, splits[2], splits[3], splits[4]);
+}
+
+
+/**
+ * @brief Checks if it is a Directory
  * @param directoryName the Directory to check for
  * @returns true if it is a directory/symlink false otherwise
@@ -724,32 +851,32 @@
   if (directoryName[strlen(directoryName)-1] == '/' ||
       directoryName[strlen(directoryName)-1] == '\\')
-    {
-      tmpDirName = new char[strlen(directoryName)];
-      strncpy(tmpDirName, directoryName, strlen(directoryName)-1);
-      tmpDirName[strlen(directoryName)-1] = '\0';
-    }
-  else
-    {
-      tmpDirName = new char[strlen(directoryName)+1];
-      strcpy(tmpDirName, directoryName);
-    }
+  {
+    tmpDirName = new char[strlen(directoryName)];
+    strncpy(tmpDirName, directoryName, strlen(directoryName)-1);
+    tmpDirName[strlen(directoryName)-1] = '\0';
+  }
+  else
+  {
+    tmpDirName = new char[strlen(directoryName)+1];
+    strcpy(tmpDirName, directoryName);
+  }
 
   if(!stat(tmpDirName, &status))
-    {
-      if (status.st_mode & (S_IFDIR
+  {
+    if (status.st_mode & (S_IFDIR
 #ifndef __WIN32__
-                            | S_IFLNK
+                          | S_IFLNK
 #endif
-                            ))
-        {
-          delete[] tmpDirName;
-          return true;
-        }
-      else
-        {
-          delete[] tmpDirName;
-          return false;
-        }
-    }
+                         ))
+    {
+      delete[] tmpDirName;
+      return true;
+    }
+    else
+    {
+      delete[] tmpDirName;
+      return false;
+    }
+  }
   else
   {
@@ -760,5 +887,5 @@
 
 /**
- * Checks if the file is either a Regular file or a Symlink
+ * @brief Checks if the file is either a Regular file or a Symlink
  * @param fileName the File to check for
  * @returns true if it is a regular file/symlink, false otherwise
@@ -772,29 +899,29 @@
   struct stat status;
   if (!stat(tmpFileName, &status))
-    {
-      if (status.st_mode & (S_IFREG
+  {
+    if (status.st_mode & (S_IFREG
 #ifndef __WIN32__
-                            | S_IFLNK
+                          | S_IFLNK
 #endif
-                            ))
-        {
-          delete[] tmpFileName;
-          return true;
-        }
-      else
-        {
-          delete[] tmpFileName;
-          return false;
-        }
-    }
-  else
+                         ))
+    {
+      delete[] tmpFileName;
+      return true;
+    }
+    else
     {
       delete[] tmpFileName;
       return false;
     }
-}
-
-/**
- * touches a File on the disk (thereby creating it)
+  }
+  else
+  {
+    delete[] tmpFileName;
+    return false;
+  }
+}
+
+/**
+ * @brief touches a File on the disk (thereby creating it)
  * @param fileName The file to touch
 */
@@ -806,9 +933,9 @@
   FILE* stream;
   if( (stream = fopen (tmpName, "w")) == NULL)
-    {
-      PRINTF(1)("could not open %s fro writing\n", fileName);
-      delete[] tmpName;
-      return false;
-    }
+  {
+    PRINTF(1)("could not open %s fro writing\n", fileName);
+    delete[] tmpName;
+    return false;
+  }
   fclose(stream);
 
@@ -817,5 +944,5 @@
 
 /**
- * deletes a File from disk
+ * @brief deletes a File from disk
  * @param fileName the File to delete
 */
@@ -840,19 +967,19 @@
   char* retName;
   if (!strncmp(name, "~/", 2))
-    {
-      char tmpFileName[500];
+  {
+    char tmpFileName[500];
 #ifdef __WIN32__
-      strcpy(tmpFileName, getenv("USERPROFILE"));
+    strcpy(tmpFileName, getenv("USERPROFILE"));
 #else
-      strcpy(tmpFileName, getenv("HOME"));
+    strcpy(tmpFileName, getenv("HOME"));
 #endif
-      retName = new char[strlen(tmpFileName)+strlen(name)];
-      sprintf(retName, "%s%s", tmpFileName, name+1);
-    }
-  else
-    {
-      retName = new char[strlen(name)+1];
-      strcpy(retName, name);
-    }
+    retName = new char[strlen(tmpFileName)+strlen(name)];
+    sprintf(retName, "%s%s", tmpFileName, name+1);
+  }
+  else
+  {
+    retName = new char[strlen(name)+1];
+    strcpy(retName, name);
+  }
   return retName;
 }
@@ -874,13 +1001,13 @@
     return retName;
   else
-    {
-      delete[] retName;
-      return NULL;
-    }
-}
-
-
-/**
- * checks wether a file is in the DataDir.
+  {
+    delete[] retName;
+    return NULL;
+  }
+}
+
+
+/**
+ * @brief checks wether a file is in the DataDir.
  * @param fileName the File to check if it is in the Data-Dir structure.
  * @returns true if the file exists, false otherwise
@@ -893,5 +1020,5 @@
   bool retVal = false;
   char* checkFile = new char[strlen(ResourceManager::getInstance()->getDataDir())
-      + strlen(fileName) + 1];
+                             + strlen(fileName) + 1];
   sprintf(checkFile, "%s%s", ResourceManager::getInstance()->getDataDir(), fileName);
 
@@ -906,6 +1033,6 @@
 
 /**
- * outputs debug information about the ResourceManager
-*/
+ * @brief outputs debug information about the ResourceManager
+ */
 void ResourceManager::debug() const
 {
@@ -917,35 +1044,35 @@
   PRINT(0)(" Data-Directory is: %s\n", this->dataDir);
   PRINT(0)(" List of Image-Directories: ");
-  std::list<char*>::const_iterator imageDir;
+  std::vector<char*>::const_iterator imageDir;
   for (imageDir = this->imageDirs.begin(); imageDir != this->imageDirs.end(); imageDir++)
-      PRINT(0)("%s ", (*imageDir));
+    PRINT(0)("%s ", (*imageDir));
   PRINT(0)("\n");
 
   PRINT(0)("List of all stored Resources:\n");
-  std::list<Resource*>::const_iterator resource;
+  std::vector<Resource*>::const_iterator resource;
   for (resource = this->resourceList.begin(); resource != this->resourceList.end(); resource++)
 
-    {
-      PRINT(0)("-----------------------------------------\n");
-      PRINT(0)("Name: %s; References: %d; Type: %s ", (*resource)->name, (*resource)->count, ResourceManager::ResourceTypeToChar((*resource)->type));
-
-      PRINT(0)("gets deleted at ");
-      switch((*resource)->prio)
-        {
-        default:
-        case RP_NO:
-          PRINT(0)("first posibility (0)\n");
-          break;
-        case RP_LEVEL:
-          PRINT(0)("the end of the Level (1)\n");
-          break;
-        case RP_CAMPAIGN:
-          PRINT(0)("the end of the campaign (2)\n");
-          break;
-        case RP_GAME:
-          PRINT(0)("when leaving the game (3)\n");
-          break;
-        }
-    }
+  {
+    PRINT(0)("-----------------------------------------\n");
+    PRINT(0)("Name: %s; References: %d; Type: %s ", (*resource)->name, (*resource)->count, ResourceManager::ResourceTypeToChar((*resource)->type));
+
+    PRINT(0)("gets deleted at ");
+    switch((*resource)->prio)
+    {
+      default:
+      case RP_NO:
+        PRINT(0)("first posibility (0)\n");
+        break;
+      case RP_LEVEL:
+        PRINT(0)("the end of the Level (1)\n");
+        break;
+      case RP_CAMPAIGN:
+        PRINT(0)("the end of the campaign (2)\n");
+        break;
+      case RP_GAME:
+        PRINT(0)("when leaving the game (3)\n");
+        break;
+    }
+  }
 
 
@@ -956,5 +1083,5 @@
 
 /**
- * converts a ResourceType into the corresponding String
+ * @brief converts a ResourceType into the corresponding String
  * @param type the ResourceType to translate
  * @returns the converted String.
@@ -962,43 +1089,45 @@
 const char* ResourceManager::ResourceTypeToChar(ResourceType type)
 {
-  switch (type)
+  return ResourceManager::resourceNames[type];
+}
+
+/**
+ * @brief converts a String into a ResourceType (good for loading)
+ * @param resourceType the name of the Type
+ * @returns the Number of the Type, or 0 (defautl) if not found.
+ */
+ResourceType ResourceManager::stringToResourceType(const char* resourceType)
+{
+  assert(resourceType != NULL);
+  for (unsigned int i = 0; i < RESOURCE_TYPE_SIZE; i++)
+    if (!strcmp(resourceType, ResourceManager::resourceNames[i]))
+      return (ResourceType)i;
+  return (ResourceType)0;
+}
+
+/**
+ * The Names of the ResourceTypes
+ */
+const char* ResourceManager::resourceNames[] =
   {
 #ifndef NO_MODEL
-    case OBJ:
-      return "ObjectModel";
-      break;
-    case PRIM:
-      return "PrimitiveModel";
-      break;
-    case MD2:
-      return "MD2-Data";
-      break;
+    "ObjectModel",
+    "PrimitiveModel",
+    "MD2-Data",
+#endif
+#ifndef NO_TEXT
+    "Font",
+#endif
+#ifndef NO_AUDIO
+    "Wav",
+    "mp3",
+    "ogg",
 #endif
 #ifndef NO_TEXTURES
-    case IMAGE:
-      return "ImageFile (Texture)";
-      break;
-#endif
-#ifndef NO_AUDIO
-    case WAV:
-      return "SoundFile";
-      break;
-    case OGG:
-      return "MusicFile";
-      break;
-#endif
-#ifndef NO_TEXT
-    case TTF:
-      return "Font (TTF)";
-      break;
+    "Texture",
 #endif
 #ifndef NO_SHADERS
-    case SHADER:
-      return "Shader";
-      break;
+    "Shader",
 #endif
-    default:
-      return "unknown Format";
-      break;
-  }
-}
+
+  };
Index: /branches/network/src/util/loading/resource_manager.h
===================================================================
--- /branches/network/src/util/loading/resource_manager.h	(revision 6692)
+++ /branches/network/src/util/loading/resource_manager.h	(revision 6693)
@@ -14,4 +14,5 @@
     (NO_TEXT)
     (NO_TEXTURES)
+    (NO_SHADERS)
 */
 
@@ -20,7 +21,7 @@
 
 #include "base_object.h"
+#include "multi_type.h"
 
-
-#include <list>
+#include <vector>
 
 //! An eumerator for different fileTypes the resourceManager supports
@@ -46,4 +47,5 @@
   SHADER,               //!< openGL-shader program
 #endif /* NO_SHADERS */
+  RESOURCE_TYPE_SIZE
 };
 
@@ -73,17 +75,5 @@
   ResourcePriority  prio;              //!< The Priority of this resource. (This will only be increased)
 
-  // more specific
-  union {
-#ifndef NO_MODEL
-  float             modelSize;         //!< the size of the model (OBJ/PRIM)
-  char*             secFileName;       //!< a seconf fileName
-#endif /* NO_MODEL */
-#ifndef NO_TEXT
-  unsigned int      ttfSize;           //!< the size of the ttf-font (TTF)
-#endif /* NO_TEXT */
-#ifndef NO_TEXTURES
-  GLenum            texTarget;
-#endif /* NO_TEXTURES */
-  };
+  MultiType         param[3];          //!< The Parameters given to this Resource.
 };
 
@@ -114,14 +104,25 @@
   bool verifyDataDir(const char* fileInside);
   bool addImageDir(const char* imageDir);
+
+  bool cache(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO,
+             const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
+  BaseObject* copy(BaseObject* resourcePointer);
+
   BaseObject* load(const char* fileName, ResourcePriority prio = RP_NO,
-               void* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
+                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
   BaseObject* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO,
-               void* param1 = NULL, void* param2 = NULL, void* param3 = NULL);
-  bool unload(void* pointer, ResourcePriority prio = RP_NO);
+                   const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType());
+  bool unload(BaseObject* pointer, ResourcePriority prio = RP_NO);
   bool unload(Resource* resource, ResourcePriority = RP_NO);
   bool unloadAllByPriority(ResourcePriority prio);
 
-  Resource* locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3) const;
+  Resource* locateResourceByInfo(const char* fileName, ResourceType type,
+                                 const MultiType& param0 = MultiType(), const MultiType& param1 = MultiType(), const MultiType& param2 = MultiType()) const;
   Resource* locateResourceByPointer(const void* pointer) const;
+
+  char* toResourcableString(unsigned int i);
+  bool fromResourceableString(const char* resourceableString);
+  /** @returns the Count of Resources the ResourceManager handles */
+  unsigned int resourceCount() const { return this->resourceList.size(); }
 
   void debug() const;
@@ -138,8 +139,10 @@
 
   static const char* ResourceTypeToChar(ResourceType type);
-
+  static ResourceType stringToResourceType(const char* resourceType);
 
  private:
   ResourceManager();
+  Resource* loadResource(const char* fileName, ResourceType type, ResourcePriority prio,
+                         const MultiType& param0, const MultiType& param1, const MultiType& param2);
 
  private:
@@ -147,7 +150,9 @@
 
   char*                    dataDir;            //!< The Data Directory, where all relevant Data is stored.
-  std::list<Resource*>     resourceList;       //!< The List of Resources, that has already been loaded.
-  std::list<char*>         imageDirs;          //!< A list of directories in which images are stored.
+  std::vector<char*>       imageDirs;          //!< A list of directories in which images are stored.
 
+  std::vector<Resource*>   resourceList;       //!< The List of Resources, that has already been loaded.
+
+  static const char*       resourceNames[RESOURCE_TYPE_SIZE];
 };
 
Index: /branches/network/src/world_entities/Makefile.am
===================================================================
--- /branches/network/src/world_entities/Makefile.am	(revision 6692)
+++ /branches/network/src/world_entities/Makefile.am	(revision 6693)
@@ -27,4 +27,5 @@
                   \
                   world_entities/weapons/weapon_manager.cc \
+                  world_entities/weapons/ammo_container.cc \
                   world_entities/weapons/weapon.cc \
                   world_entities/weapons/test_gun.cc \
@@ -51,4 +52,5 @@
                   world_entities/space_ships/space_ship.cc \
                   world_entities/space_ships/helicopter.cc \
+                  world_entities/space_ships/hover.cc \
                   world_entities/creatures/md2_creature.cc \
                   \
@@ -78,4 +80,5 @@
                  \
                  world_entities/weapons/weapon_manager.h \
+                 world_entities/weapons/ammo_container.h \
                  world_entities/weapons/weapon.h \
                  world_entities/weapons/test_gun.h \
@@ -102,4 +105,5 @@
                  world_entities/space_ships/space_ship.h \
                  world_entities/space_ships/helicopter.h \
+                 world_entities/space_ships/hover.h \
                  world_entities/creatures/md2_creature.h \
                  \
Index: /branches/network/src/world_entities/environments/water.cc
===================================================================
--- /branches/network/src/world_entities/environments/water.cc	(revision 6692)
+++ /branches/network/src/world_entities/environments/water.cc	(revision 6693)
@@ -54,5 +54,5 @@
   this->rebuildGrid();
   this->waterMaterial = new Material();
-  this->waterShader = (Shader*)ResourceManager::getInstance()->load("shaders/water.vert", SHADER, RP_GAME, (void*)"shaders/water.frag");
+  this->waterShader = (Shader*)ResourceManager::getInstance()->load("shaders/water.vert", SHADER, RP_GAME, "shaders/water.frag");
 
   this->grid->height(this->grid->columns()/2,this->grid->rows()/2) = 100;
@@ -70,14 +70,14 @@
 
   LoadParam(root, "size", this, Water, setSize)
-      .describe("the size of the WaterSurface")
-      .defaultValues(2, 1.0f, 1.0f);
+  .describe("the size of the WaterSurface")
+  .defaultValues(2, 1.0f, 1.0f);
 
   LoadParam(root, "resolution", this, Water, setResolution)
-      .describe("sets the resolution of the water surface")
-      .defaultValues(2, 10, 10);
+  .describe("sets the resolution of the water surface")
+  .defaultValues(2, 10, 10);
 
   LoadParam(root, "height", this, Water, setHeight)
-      .describe("the height of the Waves")
-      .defaultValues(1, 0.5f);
+  .describe("the height of the Waves")
+  .defaultValues(1, 0.5f);
 }
 
@@ -92,7 +92,7 @@
   }
 
-//   WE DO NOT NEED THIS AS IT IS DONE IN WORLDENTITY->setModel();
-//   if (this->grid != NULL)
-//     this->grid = NULL;
+  //   WE DO NOT NEED THIS AS IT IS DONE IN WORLDENTITY->setModel();
+  //   if (this->grid != NULL)
+  //     this->grid = NULL;
 
   this->grid = new Grid(this->sizeX, this->sizeY, this->resX, this->resY);
@@ -127,38 +127,42 @@
 void Water::draw() const
 {
-  //SkyBox::enableCubeMap();
-
-  glBindTexture(GL_TEXTURE_2D, 15);
-  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
-  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
-  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
-  glEnable(GL_TEXTURE_GEN_S);
-  glEnable(GL_TEXTURE_GEN_T);
-
-  glEnable(GL_BLEND);
-  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-  // this->waterShader->activateShader();
-//  this->waterMaterial->select();
-  WorldEntity::draw();
-  //Shader::deactivateShader();
-
-  SkyBox::disableCubeMap();
+  if (this->grid != NULL)
+  {
+    //SkyBox::enableCubeMap();
+    WorldEntity::draw();
+    glBindTexture(GL_TEXTURE_2D, 15);
+    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
+    glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
+    glEnable(GL_TEXTURE_GEN_S);
+    glEnable(GL_TEXTURE_GEN_T);
+
+    glEnable(GL_BLEND);
+    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    // this->waterShader->activateShader();
+    //  this->waterMaterial->select();
+    //Shader::deactivateShader();
+
+    SkyBox::disableCubeMap();
+  }
 }
 
 void Water::tick(float dt)
 {
-/*
-    THE OLD USELESS ALGORITHM
-  phase += dt *.1;
-  for (unsigned int i = 0; i < this->grid->rows(); i++)
-  {
-    for (unsigned int j = 0; j < this->grid->columns(); j++)
+  if (unlikely(this->velocities == NULL))
+    return;
+  /*
+      THE OLD USELESS ALGORITHM
+    phase += dt *.1;
+    for (unsigned int i = 0; i < this->grid->rows(); i++)
     {
-      this->grid->height(i,j) = this->height*sin(((float)i/(float)this->grid->rows() *phase)+
-          this->height*cos((float)j/(float)this->grid->columns()) * phase * 2.0);
+      for (unsigned int j = 0; j < this->grid->columns(); j++)
+      {
+        this->grid->height(i,j) = this->height*sin(((float)i/(float)this->grid->rows() *phase)+
+            this->height*cos((float)j/(float)this->grid->columns()) * phase * 2.0);
+      }
     }
-  }
-  this->grid->rebuildNormals(this->height);*/
+    this->grid->rebuildNormals(this->height);*/
 
 
@@ -168,31 +172,46 @@
   // wave/advection
   // calc movement
-  for(j = 1; j < this->grid->rows() - 1; j++) {
-    for(i = 1; i < this->grid->columns() - 1; i++) {
+  for(j = 1; j < this->grid->rows() - 1; j++)
+  {
+    for(i = 1; i < this->grid->columns() - 1; i++)
+    {
       u =  this->grid->height(i+1,j)+ this->grid->height(i-1, j) +
-          this->grid->height(i, j+1) + this->grid->height(i, j-1) -
-          4 * this->grid->height(i, j);
+           this->grid->height(i, j+1) + this->grid->height(i, j-1) -
+           4 * this->grid->height(i, j);
       this->velocities[i][j] += dt * this->viscosity * this->viscosity * u / this->height;
       this->grid->height(i, j) += dt * this->velocities[i][j];
     }
   }
-/*  // advect
-  for(j = 1; j < this->grid->rows() - 1; j++) {
-    for(i = 1; i < this->grid->columns() - 1; i++) {
-      this->grid->height(i, j) += dt * this->velocities[i][j];
-    }
-  }*/
+  // boundraries
+  for (j = 0; j < this->grid->rows(); j++)
+  {
+    this->grid->height(0,j) = this->grid->height(1,j);
+    this->grid->height(this->grid->rows()-1,j) = this->grid->height(this->grid->rows()-2, j);
+  }
+  for (i = 0; i < this->grid->rows(); i++)
+  {
+    this->grid->height(i,0) = this->grid->height(i,1);
+    this->grid->height(i,this->grid->columns()-1) = this->grid->height(i, this->grid->columns()-2);
+  }
+  /*  // advect
+    for(j = 1; j < this->grid->rows() - 1; j++) {
+      for(i = 1; i < this->grid->columns() - 1; i++) {
+        this->grid->height(i, j) += dt * this->velocities[i][j];
+      }
+    }*/
   // bound
-//   unsigned int w = this->grid->columns - 1;
-//   for(i = 0; i < this->grid->columns; i++) {
-//     _map[i][0].u[1] = _map[i][1  ].u[1];
-//     _map[i][w].u[1] = _map[i][w-1].u[1];
-//     _map[0][i].u[1] = _map[1  ][i].u[1];
-//     _map[w][i].u[1] = _map[w-1][i].u[1];
-//   }
+  //   unsigned int w = this->grid->columns - 1;
+  //   for(i = 0; i < this->grid->columns; i++) {
+  //     _map[i][0].u[1] = _map[i][1  ].u[1];
+  //     _map[i][w].u[1] = _map[i][w-1].u[1];
+  //     _map[0][i].u[1] = _map[1  ][i].u[1];
+  //     _map[w][i].u[1] = _map[w-1][i].u[1];
+  //   }
 
   // diffusion
-  for(j = 1; j < this->grid->rows() - 1; j++) {
-    for(i = 1; i < this->grid->columns() - 1 ; i++) {
+  for(j = 1; j < this->grid->rows() - 1; j++)
+  {
+    for(i = 1; i < this->grid->columns() - 1 ; i++)
+    {
       u = this->grid->height(i+1, j) + this->grid->height(i-1, j) +
           this->grid->height(i, j+1) + this->grid->height(i, j-1) -
@@ -203,19 +222,19 @@
 
   // calc normals
-//   float l[3];
-//   float m[3];
-//   for(j = 1; j < this->grid->rows() -1; j++) {
-//     for(i = 1; i < this->grid->columns() - 1; i++) {
-//       l[0] = this->grid->vertexG(i, j-1).x - this->grid->vertexG(i, j+1).x;
-//       l[1] = this->grid->vertexG(i, j-1).y - this->grid->vertexG(i, j+1).y;
-//       l[2] = this->grid->vertexG(i, j-1).z - this->grid->vertexG(i, j+1).z;
-//       m[0] = this->grid->vertexG(i-1,j).x - this->grid->vertexG(i+1, j).x;
-//       m[1] = this->grid->vertexG(i-1,j).y - this->grid->vertexG(i+1, j).y;
-//       m[2] = this->grid->vertexG(i-1,j).z - this->grid->vertexG(i+1, j).z;
-//       this->grid->normalG(i, j).x = l[1] * m[2] - l[2] * m[1];
-//       this->grid->normalG(i, j).y = l[2] * m[0] - l[0] * m[2];
-//       this->grid->normalG(i, j).z = l[0] * m[1] - l[1] * m[0];
-//     }
-//   }
+  //   float l[3];
+  //   float m[3];
+  //   for(j = 1; j < this->grid->rows() -1; j++) {
+  //     for(i = 1; i < this->grid->columns() - 1; i++) {
+  //       l[0] = this->grid->vertexG(i, j-1).x - this->grid->vertexG(i, j+1).x;
+  //       l[1] = this->grid->vertexG(i, j-1).y - this->grid->vertexG(i, j+1).y;
+  //       l[2] = this->grid->vertexG(i, j-1).z - this->grid->vertexG(i, j+1).z;
+  //       m[0] = this->grid->vertexG(i-1,j).x - this->grid->vertexG(i+1, j).x;
+  //       m[1] = this->grid->vertexG(i-1,j).y - this->grid->vertexG(i+1, j).y;
+  //       m[2] = this->grid->vertexG(i-1,j).z - this->grid->vertexG(i+1, j).z;
+  //       this->grid->normalG(i, j).x = l[1] * m[2] - l[2] * m[1];
+  //       this->grid->normalG(i, j).y = l[2] * m[0] - l[0] * m[2];
+  //       this->grid->normalG(i, j).z = l[0] * m[1] - l[1] * m[0];
+  //     }
+  //   }
   this->grid->rebuildNormals(this->height);
 }
Index: /branches/network/src/world_entities/items/item_container.cc
===================================================================
--- /branches/network/src/world_entities/items/item_container.cc	(revision 6693)
+++ /branches/network/src/world_entities/items/item_container.cc	(revision 6693)
@@ -0,0 +1,50 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
+
+#include "item_container.h"
+
+using namespace std;
+
+
+/**
+ * standard constructor
+ * @todo this constructor is not jet implemented - do it
+*/
+ItemContainer::ItemContainer ()
+{
+   this->setClassID(CL_ITEM_CONTAINER, "ItemContainer");
+
+   /* If you make a new class, what is most probably the case when you write this file
+      don't forget to:
+       1. Add the new file new_class.cc to the ./src/Makefile.am
+       2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS
+
+      Advanced Topics:
+      - if you want to let your object be managed via the ObjectManager make sure to read
+        the object_manager.h header comments. You will use this most certanly only if you
+        make many objects of your class, like a weapon bullet.
+   */
+}
+
+
+/**
+ * standard deconstructor
+*/
+ItemContainer::~ItemContainer ()
+{
+  // delete what has to be deleted here
+}
Index: /branches/network/src/world_entities/items/item_container.h
===================================================================
--- /branches/network/src/world_entities/items/item_container.h	(revision 6693)
+++ /branches/network/src/world_entities/items/item_container.h	(revision 6693)
@@ -0,0 +1,27 @@
+/*!
+ * @file item_container.h
+ * @brief Definition of a Container for Items one can pick up
+ */
+
+#ifndef _ITEM_CONTAINER_H
+#define _ITEM_CONTAINER_H
+
+#include "base_object.h"
+
+// FORWARD DECLARATION
+
+
+
+//! A class for storing collected Items.
+class ItemContainer : public BaseObject {
+
+ public:
+  ItemContainer();
+  virtual ~ItemContainer();
+
+
+ private:
+
+};
+
+#endif /* _ITEM_CONTAINER_H */
Index: /branches/network/src/world_entities/movie_entity.cc
===================================================================
--- /branches/network/src/world_entities/movie_entity.cc	(revision 6692)
+++ /branches/network/src/world_entities/movie_entity.cc	(revision 6693)
@@ -19,7 +19,4 @@
 #include "load_param.h"
 #include "factory.h"
-
-#include "network_game_manager.h"
-#include "converter.h"
 
 using namespace std;
Index: /branches/network/src/world_entities/projectiles/guided_missile.cc
===================================================================
--- /branches/network/src/world_entities/projectiles/guided_missile.cc	(revision 6692)
+++ /branches/network/src/world_entities/projectiles/guided_missile.cc	(revision 6693)
@@ -43,5 +43,5 @@
   this->setMaxEnergy(10);
   this->lifeSpan = 10.0;
-  this->agility = 500;
+  this->agility = 5;
   this->maxVelocity = 75;
 
Index: /branches/network/src/world_entities/projectiles/laser.cc
===================================================================
--- /branches/network/src/world_entities/projectiles/laser.cc	(revision 6692)
+++ /branches/network/src/world_entities/projectiles/laser.cc	(revision 6693)
@@ -17,4 +17,6 @@
 
 #include "laser.h"
+#include <assert.h>
+
 
 #include "fast_factory.h"
@@ -26,4 +28,5 @@
 #include "particle_emitter.h"
 #include "sprite_particles.h"
+#include <cassert>
 
 #include "assert.h"
Index: /branches/network/src/world_entities/space_ships/helicopter.cc
===================================================================
--- /branches/network/src/world_entities/space_ships/helicopter.cc	(revision 6692)
+++ /branches/network/src/world_entities/space_ships/helicopter.cc	(revision 6693)
@@ -117,12 +117,12 @@
   bFire = false;
   xMouse = yMouse = 0;
-  mouseSensitivity = 0.001;
-  rotorspeed = 1;
-  tailrotorspeed = 0;
-
-  cycle = 0.0;
-
-
-  travelSpeed = 15.0;
+  mouseSensitivity = 0.05;
+  //rotorspeed = 1;
+  //tailrotorspeed = 0;
+
+  //cycle = 0.0;
+
+
+  //travelSpeed = 15.0;
   this->velocity = Vector(0.0,0.0,0.0);
   this->velocityDir = Vector(1.0,0.0,0.0);
@@ -134,9 +134,9 @@
 
   //add events to the eventlist
-  registerEvent(SDLK_w);
-  registerEvent(SDLK_s);
-  registerEvent(SDLK_a);
-  registerEvent(SDLK_d);
-  registerEvent(SDLK_q);
+  registerEvent(KeyMapper::PEV_UP);
+  registerEvent(KeyMapper::PEV_DOWN);
+  registerEvent(KeyMapper::PEV_LEFT);
+  registerEvent(KeyMapper::PEV_RIGHT);
+  //registerEvent(SDLK_q);
   registerEvent(SDLK_e);
   registerEvent(SDLK_c);
@@ -144,6 +144,6 @@
   registerEvent(KeyMapper::PEV_NEXT_WEAPON);
   registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
-  registerEvent(SDLK_PAGEUP);
-  registerEvent(SDLK_PAGEDOWN);
+  //registerEvent(SDLK_PAGEUP);
+  //registerEvent(SDLK_PAGEDOWN);
   registerEvent(EV_MOUSE_MOTION);
 
@@ -249,4 +249,5 @@
 void Helicopter::tick (float time)
 {
+  /*
   tailrotorspeed += xMouse/20;
   if (tailrotorspeed >= 0.07) tailrotorspeed = 0.07;
@@ -256,21 +257,27 @@
   else if (tailrotorspeed < -0.0008) tailrotorspeed += 0.001;
   if (tailrotorspeed <= 0.001 && tailrotorspeed >= -0.001) tailrotorspeed = 0;
-
+  */
+  
   // spaceship controlled movement
   this->calculateVelocity(time);
 
-  Vector move = (velocity);
+  Vector move = (velocity)*time;
 
   // this is the air friction (necessary for a smooth control)
   if(velocity.len() != 0) velocity -= velocity*0.1;
+  
+  //travelSpeed = velocity.len();
 
   //physics: Gravity
-  this->shiftCoor(Vector(0,-1,0));
+  /*this->shiftCoor(Vector(0,-1,0));
 
   this->shiftCoor(getAbsDirY()*rotorspeed);
-
+  */
+  
+  /*
   //hoover effect
   cycle += time;
   this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);
+  */
 
   //readjust
@@ -281,5 +288,5 @@
 
   this->shiftCoor (move);
-  this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
+  //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
 
   this->getWeaponManager()->tick(time);
@@ -295,6 +302,6 @@
 {
   Vector accel(0.0, 0.0, 0.0);
-  Vector rot(0.0, 0.0, 0.0);
-  float rotVal = 0.0;
+  float rotValX = 0.0;
+  float rotValZ = 0.0;
   /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
   /* calculate the direction in which the craft is heading  */
@@ -304,10 +311,11 @@
      //this->shiftCoor(this->getAbsDirX());
      //accel -= this->getAbsDirY();
-     rot += Vector (0,0,1);
-     rotVal -= time/5;
+     
+     accel += Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
+     if((this->getAbsDirX()).y >= -0.1) rotValZ -= time;
    }
    else
    {
-       if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time/8, Vector(0,0,1)));
+       if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time, Vector(0,0,1)));
    }
 
@@ -316,10 +324,11 @@
      //this->shiftCoor((this->getAbsDirX())*-1);
      //accel -= this->getAbsDirY();
-     rot += Vector (0,0,1);
-     rotVal += time/5;
+     
+     accel -= Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
+     rotValZ += time;
    }
    else
    {
-         if(this->getAbsDirX().y > 0.02) this->shiftDir(Quaternion(-time/8, Vector(0,0,1)));
+         if(this->getAbsDirX().y > 0.02) this->shiftDir(Quaternion(-time, Vector(0,0,1)));
    }
 
@@ -329,10 +338,11 @@
     //accel -= this->getAbsDirY();
     //velocityDir.normalize();
-    rot += Vector(1,0,0);
-    rotVal -= time/5;
+    
+    accel -= Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
+    rotValX -= time;
   }
   else
    {
-         if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(time/5, Vector(1,0,0)));
+         if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(time, Vector(1,0,0)));
    }
 
@@ -340,12 +350,13 @@
   {
     //this->shiftDir(Quaternion(-time, Vector(0,1,0)));
-    accel += this->getAbsDirY();
+    //accel += this->getAbsDirY();
     //velocityDir.normalize();
-    rot += Vector(1,0,0);
-    rotVal += time/5;
+    
+    accel += Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
+    rotValX += time;
   }
   else
    {
-         if(this->getAbsDirZ().y < -0.02) this->shiftDir(Quaternion(-time/5, Vector(1,0,0)));
+         if(this->getAbsDirZ().y < -0.02) this->shiftDir(Quaternion(-time, Vector(1,0,0)));
    }
 
@@ -371,6 +382,7 @@
     //this->shiftDir(Quaternion(time, Vector(0,0,1)));
 
-    rotorspeed += 0.05;
-    if (rotorspeed >= 2) rotorspeed = 2;
+    accel += this->getAbsDirY();
+    //rotorspeed += 0.05;
+    //if (rotorspeed >= 2) rotorspeed = 2;
     //velocityDir.normalize();
     //rot += Vector(0,0,1);
@@ -379,5 +391,5 @@
   else
   {
-    if(rotorspeed >= 1.05) rotorspeed -= 0.05;
+    //if(rotorspeed >= 1.05) rotorspeed -= 0.05;
   }
 
@@ -386,6 +398,7 @@
     //this->shiftDir(Quaternion(-time, Vector(0,0,1)));
 
-    rotorspeed -= 0.05;
-    if (rotorspeed <= 0) rotorspeed = 0;
+    accel -= this->getAbsDirY();
+    //rotorspeed -= 0.05;
+    //if (rotorspeed <= 0) rotorspeed = 0;
     //velocityDir.normalize();
     //rot += Vector(0,0,1);
@@ -394,10 +407,10 @@
   else
   {
-    if(rotorspeed <= 0.05) rotorspeed += 0.05;
-  }
-
-  //velocity += accel;
-  rot.normalize();
-  this->shiftDir(Quaternion(rotVal, rot));
+    //if(rotorspeed <= 0.05) rotorspeed += 0.05;
+  }
+
+  velocity += accel*3;
+  if((this->getAbsDirX()).y <= 0.3 && (this->getAbsDirX()).y >= -0.3) this->shiftDir(Quaternion(rotValZ, Vector(0,0,1)));
+  if((this->getAbsDirZ()).y <= 0.3 && (this->getAbsDirZ()).y >= -0.3) this->shiftDir(Quaternion(rotValX, Vector(1,0,0)));
 }
 
@@ -429,7 +442,7 @@
 
 
-  if( event.type == SDLK_a)
+  if( event.type == KeyMapper::PEV_LEFT)
       this->bLeft = event.bPressed;
-  else if( event.type == SDLK_d)
+  else if( event.type == KeyMapper::PEV_RIGHT)
       this->bRight = event.bPressed;
   else if( event.type == KeyMapper::PEV_FIRE1)
@@ -443,7 +456,7 @@
   else if( event.type == SDLK_c)
     this->bDescend = event.bPressed; //this->shiftCoor(0,-.1,0);
-  else if( event.type == SDLK_w)
+  else if( event.type == KeyMapper::PEV_UP)
     this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
-  else if( event.type == SDLK_s)
+  else if( event.type == KeyMapper::PEV_DOWN)
     this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0);
   else if( event.type == EV_MOUSE_MOTION)
@@ -452,5 +465,5 @@
     this->yMouse = event.yRel*mouseSensitivity;
 
-    //this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
+    this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))/*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))*/);
   }
 }
Index: /branches/network/src/world_entities/space_ships/helicopter.h
===================================================================
--- /branches/network/src/world_entities/space_ships/helicopter.h	(revision 6692)
+++ /branches/network/src/world_entities/space_ships/helicopter.h	(revision 6693)
@@ -57,6 +57,7 @@
     float                 xMouse;             //!< mouse moved in x-Direction
     float                 yMouse;             //!< mouse moved in y-Direction
+    int                   yInvert;
     float                 mouseSensitivity;   //!< the mouse sensitivity
-    float                 cycle;              //!< hovercycle
+    //float                 cycle;              //!< hovercycle
 
     Vector                velocity;           //!< the velocity of the player.
@@ -64,6 +65,6 @@
     float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
     float                 acceleration;       //!< the acceleration of the player.
-    float                 rotorspeed;         //!< the speed of the rotor.
-    float                 tailrotorspeed;     //!< the relativ speed ot the tail rotor
+    //float                 rotorspeed;         //!< the speed of the rotor.
+    //float                 tailrotorspeed;     //!< the relativ speed ot the tail rotor
 
     float                 airViscosity;
Index: /branches/network/src/world_entities/space_ships/hover.cc
===================================================================
--- /branches/network/src/world_entities/space_ships/hover.cc	(revision 6693)
+++ /branches/network/src/world_entities/space_ships/hover.cc	(revision 6693)
@@ -0,0 +1,476 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Benjamin Knecht
+   co-programmer: ...
+
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
+
+#include "hover.h"
+
+#include "weapons/weapon_manager.h"
+#include "weapons/test_gun.h"
+#include "weapons/turret.h"
+#include "weapons/cannon.h"
+
+#include "factory.h"
+#include "key_mapper.h"
+#include "event_handler.h"
+#include "state.h"
+
+#include "graphics_engine.h"
+
+using namespace std;
+
+CREATE_FACTORY(Hover, CL_HOVER);
+
+/**
+ *  creates the controlable Spaceship
+ */
+Hover::Hover()
+{
+  this->init();
+}
+
+/**
+ *  destructs the spaceship, deletes alocated memory
+ */
+Hover::~Hover ()
+{
+}
+
+/**
+ * loads a Spaceships information from a specified file.
+ * @param fileName the name of the File to load the spaceship from (absolute path)
+ */
+Hover::Hover(const char* fileName)
+{
+  this->init();
+  TiXmlDocument doc(fileName);
+
+  if(!doc.LoadFile())
+  {
+    PRINTF(2)("Loading file %s failed for Hover.\n", fileName);
+    return;
+  }
+
+  this->loadParams(doc.RootElement());
+}
+
+/**
+ *  creates a new Spaceship from Xml Data
+ * @param root the xml element containing spaceship data
+
+   @todo add more parameters to load
+*/
+Hover::Hover(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+
+  //weapons:
+  Weapon* wpRight = new TestGun(0);
+  wpRight->setName("testGun Right");
+  Weapon* wpLeft = new TestGun(1);
+  wpLeft->setName("testGun Left");
+  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
+
+  cannon->setName("BFG");
+
+  this->addWeapon(wpLeft, 1, 0);
+  this->addWeapon(wpRight,1 ,1);
+  this->addWeapon(cannon, 0, 6);
+
+  //this->addWeapon(turret, 3, 0);
+
+  this->getWeaponManager()->changeWeaponConfig(1);
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+}
+
+
+/**
+ * initializes a Hover
+ */
+void Hover::init()
+{
+//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
+  this->setClassID(CL_HOVER, "Hover");
+
+  PRINTF(4)("HOVER INIT\n");
+
+  this->loadModel("models/ships/fighter.obj", 1.0);
+
+  EventHandler::getInstance()->grabEvents(true);
+
+  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
+  bFire = false;
+  xMouse = yMouse = 0;
+  mouseSensitivity = 0.05;
+
+
+  this->velocity = Vector(0.0,0.0,0.0);
+  this->velocityDir = Vector(1.0,0.0,0.0);
+
+//   GLGuiButton* button = new GLGuiPushButton();
+//   button->show();
+//   button->setLabel("orxonox");
+//   button->setBindNode(this);
+
+  //add events to the eventlist
+  registerEvent(KeyMapper::PEV_UP);
+  registerEvent(KeyMapper::PEV_DOWN);
+  registerEvent(KeyMapper::PEV_LEFT);
+  registerEvent(KeyMapper::PEV_RIGHT);
+  registerEvent(SDLK_e);
+  registerEvent(SDLK_c);
+  registerEvent(KeyMapper::PEV_FIRE1);
+  registerEvent(KeyMapper::PEV_NEXT_WEAPON);
+  registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
+  registerEvent(EV_MOUSE_MOTION);
+
+  this->getWeaponManager()->setSlotCount(7);
+
+  this->getWeaponManager()->setSlotPosition(0, Vector(-2.6, .1, -3.0));
+  this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(1, Vector(-2.6, .1, 3.0));
+  this->getWeaponManager()->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+
+  this->getWeaponManager()->setSlotPosition(2, Vector(-1.5, .5, -.5));
+  this->getWeaponManager()->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(3, Vector(-1.5, .5, .5));
+  this->getWeaponManager()->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(4, Vector(-1.5, -.5, .5));
+  this->getWeaponManager()->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
+
+  this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5));
+  this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
+//
+   this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0));
+   this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
+   //
+//   this->getWeaponManager()->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
+//   this->getWeaponManager()->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
+//
+//   this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
+//   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
+
+  this->getWeaponManager()->getFixedTarget()->setParent(this);
+  this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
+
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+
+}
+
+/**
+ * loads the Settings of a Helicopter from an XML-element.
+ * @param root the XML-element to load the Spaceship's properties from
+ */
+void Hover::loadParams(const TiXmlElement* root)
+{
+  static_cast<WorldEntity*>(this)->loadParams(root);
+}
+
+
+
+
+void Hover::enter()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
+  this->attachCamera();
+
+
+}
+
+void Hover::leave()
+{
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
+  this->detachCamera();
+
+}
+
+
+/**
+ *  effect that occurs after the Helicopter is spawned
+*/
+void Hover::postSpawn ()
+{
+  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
+}
+
+/**
+ *  the action occuring if the spaceship left the game
+*/
+void Hover::leftWorld ()
+{}
+
+/**
+ *  this function is called, when two entities collide
+ * @param entity: the world entity with whom it collides
+ *
+ * Implement behaviour like damage application or other miscellaneous collision stuff in this function
+ */
+void Hover::collidesWith(WorldEntity* entity, const Vector& location)
+{
+  if (entity->isA(CL_TURRET_POWER_UP))
+  {
+    this->ADDWEAPON();
+    }
+//  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
+}
+
+
+
+/**
+ *  the function called for each passing timeSnap
+ * @param time The timespan passed since last update
+*/
+void Hover::tick (float time)
+{
+  
+  
+  Quaternion xDir = Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0));
+  Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1));
+    
+  if ((this->getAbsDirY()).y < 0.8)
+  {
+     if((this->getAbsDirX()).y > 0)
+     {
+        if(yMouse > 0)  this->shiftDir(xDir*yDir);
+        else this->shiftDir(xDir);
+     }
+     else
+     {
+         if(yMouse < 0) this->shiftDir(xDir*yDir);
+         else this->shiftDir(xDir);
+     }
+  }
+  else this->shiftDir(xDir*yDir);
+  
+  if((this->getAbsDirZ()).y > 0.1) this->shiftDir(Quaternion(0.01,Vector(1,0,0)));
+  else if((this->getAbsDirZ()).y < -0.1) this->shiftDir(Quaternion(-0.01,Vector(1,0,0)));
+
+  
+  // spaceship controlled movement
+  this->calculateVelocity(time);
+
+  Vector move = (velocity)*time;
+
+  // this is the air friction (necessary for a smooth control)
+  if(velocity.len() != 0) velocity -= velocity*0.1;
+
+  //readjust
+ // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
+  //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
+
+  //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
+
+  this->shiftCoor (move);
+  //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
+
+  this->getWeaponManager()->tick(time);
+  // weapon system manipulation
+  this->weaponAction();
+}
+
+/**
+ *  calculate the velocity
+ * @param time the timeslice since the last frame
+*/
+void Hover::calculateVelocity (float time)
+{
+  Vector accel(0.0, 0.0, 0.0);
+  float rotValX = 0.0;
+  float rotValZ = 0.0;
+  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
+  /* calculate the direction in which the craft is heading  */
+
+  if( this->bUp )
+   {
+     //this->shiftCoor(this->getAbsDirX());
+     //accel -= this->getAbsDirY();
+     
+     accel += Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
+     //if((this->getAbsDirX()).y >= -0.1) rotValZ -= time;
+   }
+
+  if( this->bDown )
+   {
+     //this->shiftCoor((this->getAbsDirX())*-1);
+     //accel -= this->getAbsDirY();
+     
+     accel -= Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
+     //rotValZ += time;
+   }
+
+  if( this->bLeft /* > -this->getRelCoor().z*2*/)
+  {
+    //this->shiftDir(Quaternion(time, Vector(0,1,0)));
+    //accel -= this->getAbsDirY();
+    //velocityDir.normalize();
+    
+    accel -= Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
+    //rotValX -= time;
+  }
+
+  if( this->bRight /* > this->getRelCoor().z*2*/)
+  {
+    //this->shiftDir(Quaternion(-time, Vector(0,1,0)));
+    //accel += this->getAbsDirY();
+    //velocityDir.normalize();
+    
+    accel += Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
+    //rotValX += time;
+  }
+
+  if( this->bRollL /* > -this->getRelCoor().z*2*/)
+  {
+    this->shiftDir(Quaternion(-time, Vector(1,0,0)));
+    //accel -= rightDirection;
+    //velocityDir.normalize();
+    //rot +=Vector(1,0,0);
+    //rotVal -= .4;
+  }
+  if( this->bRollR /* > this->getRelCoor().z*2*/)
+  {
+    this->shiftDir(Quaternion(time, Vector(1,0,0)));
+
+    //accel += rightDirection;
+    //velocityDir.normalize();
+    //rot += Vector(1,0,0);
+    //rotVal += .4;
+  }
+  if (this->bAscend )
+  {
+    //this->shiftDir(Quaternion(time, Vector(0,0,1)));
+
+    accel += this->getAbsDirY();
+    //rotorspeed += 0.05;
+    //if (rotorspeed >= 2) rotorspeed = 2;
+    //velocityDir.normalize();
+    //rot += Vector(0,0,1);
+    //rotVal += .4;
+  }
+  else
+  {
+    //if(rotorspeed >= 1.05) rotorspeed -= 0.05;
+  }
+
+  if (this->bDescend )
+  {
+    //this->shiftDir(Quaternion(-time, Vector(0,0,1)));
+
+    accel -= this->getAbsDirY();
+    //rotorspeed -= 0.05;
+    //if (rotorspeed <= 0) rotorspeed = 0;
+    //velocityDir.normalize();
+    //rot += Vector(0,0,1);
+    //rotVal -= .4;
+  }
+  else
+  {
+    //if(rotorspeed <= 0.05) rotorspeed += 0.05;
+  }
+
+  velocity += accel*4;
+  //if((this->getAbsDirX()).y <= 0.3 && (this->getAbsDirX()).y >= -0.3) this->shiftDir(Quaternion(rotValZ, Vector(0,0,1)));
+  //if((this->getAbsDirZ()).y <= 0.3 && (this->getAbsDirZ()).y >= -0.3) this->shiftDir(Quaternion(rotValX, Vector(1,0,0)));
+}
+
+
+void Hover::draw() const
+{
+  WorldEntity::draw();
+
+  this->getWeaponManager()->draw();
+}
+
+
+/**
+ * weapon manipulation by the player
+*/
+void Hover::weaponAction()
+{
+  if( this->bFire)
+    {
+      this->getWeaponManager()->fire();
+    }
+}
+
+/**
+ * @todo switch statement ??
+ */
+void Hover::process(const Event &event)
+{
+
+
+  if( event.type == KeyMapper::PEV_LEFT)
+      this->bLeft = event.bPressed;
+  else if( event.type == KeyMapper::PEV_RIGHT)
+      this->bRight = event.bPressed;
+  else if( event.type == KeyMapper::PEV_FIRE1)
+      this->bFire = event.bPressed;
+  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
+    this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
+  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
+    this->getWeaponManager()->previousWeaponConfig();
+  else if( event.type == SDLK_e)
+    this->bAscend = event.bPressed; //this->shiftCoor(0,.1,0);
+  else if( event.type == SDLK_c)
+    this->bDescend = event.bPressed; //this->shiftCoor(0,-.1,0);
+  else if( event.type == KeyMapper::PEV_UP)
+    this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
+  else if( event.type == KeyMapper::PEV_DOWN)
+    this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0);
+  else if( event.type == EV_MOUSE_MOTION)
+  {
+    this->xMouse = event.xRel*mouseSensitivity;
+    this->yMouse = event.yRel*mouseSensitivity;
+  }
+}
+
+#include "weapons/aiming_turret.h"
+// FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG
+void Hover::ADDWEAPON()
+{
+  Weapon* turret = NULL;
+
+  if ((float)rand()/RAND_MAX < .1)
+  {
+    //if (this->getWeaponManager()->hasFreeSlot(2, WTYPE_TURRET))
+    {
+      turret = new Turret();
+      this->addWeapon(turret, 2);
+      this->getWeaponManager()->changeWeaponConfig(2);
+    }
+  }
+  else
+  {
+    //if (this->getWeaponManager()->hasFreeSlot(3))
+    {
+      turret = new AimingTurret();
+      this->addWeapon(turret, 3);
+
+      this->getWeaponManager()->changeWeaponConfig(3);
+    }
+  }
+
+  if(turret != NULL)
+  {
+    turret->setName("Turret");
+    turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);
+  }
+}
Index: /branches/network/src/world_entities/space_ships/hover.h
===================================================================
--- /branches/network/src/world_entities/space_ships/hover.h	(revision 6693)
+++ /branches/network/src/world_entities/space_ships/hover.h	(revision 6693)
@@ -0,0 +1,70 @@
+
+/*!
+ * @file helicopter.h
+ * Implements the Control of a Hover
+ */
+
+#ifndef _HOVER_H
+#define _HOVER_H
+
+#include "playable.h"
+
+
+class Hover : public Playable
+{
+
+  public:
+
+    Hover();
+    Hover(const char* fileName);
+    Hover(const TiXmlElement* root);
+    virtual ~Hover();
+
+    void init();
+    void loadParams(const TiXmlElement* root);
+
+    virtual void enter();
+    virtual void leave();
+
+    virtual void postSpawn();
+    virtual void leftWorld();
+
+    virtual void collidesWith(WorldEntity* entity, const Vector& location);
+    virtual void tick(float time);
+    virtual void draw() const;
+
+    virtual void process(const Event &event);
+
+
+
+  private:
+    void calculateVelocity(float time);
+    void weaponAction();
+
+    // !! temporary !!
+    void ADDWEAPON();
+
+    bool                  bUp;                //!< up button pressed.
+    bool                  bDown;              //!< down button pressed.
+    bool                  bLeft;              //!< left button pressed.
+    bool                  bRight;             //!< right button pressed.
+    bool                  bAscend;            //!< ascend button pressed.
+    bool                  bDescend;           //!< descend button presses.
+    bool                  bFire;              //!< fire button pressed.
+    bool                  bRollL;             //!< rolling button pressed (left)
+    bool                  bRollR;             //!< rolling button pressed (right)
+
+    float                 xMouse;             //!< mouse moved in x-Direction
+    float                 yMouse;             //!< mouse moved in y-Direction
+    float                 mouseSensitivity;   //!< the mouse sensitivity
+
+    Vector                velocity;           //!< the velocity of the player.
+    Vector                velocityDir;        //!< the direction of the velocity of the spaceship
+    float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
+    float                 acceleration;       //!< the acceleration of the player.
+    
+    float                 airViscosity;
+
+};
+
+#endif /* _HOVER_H */
Index: /branches/network/src/world_entities/space_ships/space_ship.cc
===================================================================
--- /branches/network/src/world_entities/space_ships/space_ship.cc	(revision 6692)
+++ /branches/network/src/world_entities/space_ships/space_ship.cc	(revision 6693)
@@ -128,6 +128,4 @@
   this->addWeapon(cannon, 0, 6);
 
-  //this->addWeapon(turret, 3, 0);
-
   this->getWeaponManager()->changeWeaponConfig(1);
 
@@ -137,14 +135,20 @@
   bFire = false;
   xMouse = yMouse = 0;
+  yInvert = 1;
   mouseSensitivity = 0.001;
-  airViscosity = 1.0;
-  cycle = 0.0;
+  airViscosity = 0.05;
+  controlVelocityX = 25;
+  controlVelocityY = 150;
+  shipInertia = 0.5		;
+//  cycle = 0.0;
 
   this->setMaxEnergy(100);
   this->setEnergy(80);
 
-  travelSpeed = 15.0;
-  this->velocity = Vector(0.0,0.0,0.0);
+  travelSpeed = 40.0;
+  acceleration = 3;
+  this->velocity = this->getAbsDirX()*travelSpeed;
   this->mouseDir = this->getAbsDir();
+  this->pitchDir = this->getAbsDir();
 
 //   GLGuiButton* button = new GLGuiPushButton();
@@ -160,15 +164,15 @@
 
   //add events to the eventlist
-  registerEvent(SDLK_w);
-  registerEvent(SDLK_s);
-  registerEvent(SDLK_a);
-  registerEvent(SDLK_d);
-  registerEvent(SDLK_q);
-  registerEvent(SDLK_e);
+  registerEvent(KeyMapper::PEV_UP);
+  registerEvent(KeyMapper::PEV_DOWN);
+  registerEvent(KeyMapper::PEV_LEFT);
+  registerEvent(KeyMapper::PEV_RIGHT);
+  //registerEvent(SDLK_q);
+  //registerEvent(SDLK_e);
   registerEvent(KeyMapper::PEV_FIRE1);
   registerEvent(KeyMapper::PEV_NEXT_WEAPON);
   registerEvent(KeyMapper::PEV_PREVIOUS_WEAPON);
-  registerEvent(SDLK_PAGEUP);
-  registerEvent(SDLK_PAGEDOWN);
+  //registerEvent(SDLK_PAGEUP);
+  //registerEvent(SDLK_PAGEDOWN);
   registerEvent(EV_MOUSE_MOTION);
 
@@ -285,4 +289,18 @@
   this->weaponAction();
 
+  if( xMouse != 0 || yMouse != 0)
+   {
+    if (xMouse > controlVelocityX) xMouse = controlVelocityX;
+    else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX;
+    if (yMouse > controlVelocityY) yMouse = controlVelocityY;
+    else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY;
+
+    pitchDir = (Quaternion(xMouse*mouseSensitivity*0.5, Vector(1,0,0)));
+
+    mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir);
+    xMouse = yMouse = 0;
+   }
+
+
 //   if( this != State::getPlayer()->getControllable())
 //     return;
@@ -291,5 +309,5 @@
   this->calculateVelocity(time);
 
-  Vector move = (velocity)*time;
+  Vector move = velocity*time;
 
   //orient the velocity in the direction of the spaceship.
@@ -299,5 +317,5 @@
 
   //orient the spaceship in direction of the mouse
-   rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, fabsf(time)*3.0);
+   rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, fabsf(time)*shipInertia);
    if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
     this->setAbsDir( rotQuat);
@@ -305,5 +323,10 @@
 
   // this is the air friction (necessary for a smooth control)
-  if(velocity.len() != 0) velocity -= velocity*0.01;
+  if(travelSpeed >= 120) velocity -= velocity.getNormalized()*travelSpeed*travelSpeed*0.0001;
+  else if (travelSpeed <= 80) velocity -= velocity.getNormalized()*travelSpeed*0.001;
+
+  //other physics (gravity)
+  //if(travelSpeed < 120)
+  //move += Vector(0,-1,0)*60*time + Vector(0,1,0)*travelSpeed/2*time;
 
   //hoover effect
@@ -312,11 +335,4 @@
 
   //readjust
-
-  /*
-    In the game "Yager" the spaceship gets readjusted when the player moves the mouse.
-    I (bknecht) go and check it out how they do it, we could probably use this also in Orxonox.
-  */
-  //if (xMouse != 0 && yMouse != 0)
-
   //if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
   //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
@@ -324,5 +340,5 @@
   //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);
 
-  this->shiftCoor (move);
+  this->shiftCoor(move);
 
 
@@ -343,15 +359,12 @@
   /* calculate the direction in which the craft is heading  */
 
-  Plane plane(Vector(0,1,0), Vector(0,0,0));
+  //Plane plane(Vector(0,1,0), Vector(0,0,0));
 
   if( this->bUp )
    {
      //this->shiftCoor(this->getAbsDirX());
-      accel += (this->getAbsDirX())*2;
-
-      /* Heli-Steuerung
-         accel += (this->getAbsDirX()*2;
-         if(
-      */
+      //accel += (this->getAbsDirX())*2;
+      accel += (this->getAbsDirX())*acceleration;
+
    }
 
@@ -359,5 +372,6 @@
    {
      //this->shiftCoor((this->getAbsDirX())*-1);
-     accel -= (this->getAbsDirX())*2;
+     //accel -= (this->getAbsDirX())*2;
+     accel -= (this->getAbsDirX())*0.5*acceleration;
    }
 
@@ -383,5 +397,5 @@
   if( this->bRollL /* > -this->getRelCoor().z*2*/)
   {
-    mouseDir *= Quaternion(-time, Vector(1,0,0));
+    mouseDir *= Quaternion(-time*2, Vector(1,0,0));
 //    accel -= rightDirection;
     //velocityDir.normalize();
@@ -391,5 +405,5 @@
   if( this->bRollR /* > this->getRelCoor().z*2*/)
   {
-    mouseDir *= Quaternion(time, Vector(1,0,0));
+    mouseDir *= Quaternion(time*2, Vector(1,0,0));
 
     //    accel += rightDirection;
@@ -438,9 +452,7 @@
 void SpaceShip::process(const Event &event)
 {
-
-
-  if( event.type == SDLK_a)
+  if( event.type == KeyMapper::PEV_LEFT)
       this->bRollL = event.bPressed;
-  else if( event.type == SDLK_d)
+  else if( event.type == KeyMapper::PEV_RIGHT)
       this->bRollR = event.bPressed;
   else if( event.type == KeyMapper::PEV_FIRE1)
@@ -452,15 +464,12 @@
   else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
     this->previousWeaponConfig();
-  else if( event.type == SDLK_w)
+  else if( event.type == KeyMapper::PEV_UP)
     this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
-  else if( event.type == SDLK_s)
+  else if( event.type == KeyMapper::PEV_DOWN)
     this->bDown = event.bPressed; //this->shiftCoor(0,-.1,0);
   else if( event.type == EV_MOUSE_MOTION)
   {
-    this->xMouse = event.xRel;
-    this->yMouse = event.yRel;
-    mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
-   // if( xMouse*xMouse + yMouse*yMouse < 0.9)
-     //this->setAbsDir(mouseDir);
+    this->xMouse += event.xRel;
+    this->yMouse += event.yRel;
   }
 }
Index: /branches/network/src/world_entities/space_ships/space_ship.h
===================================================================
--- /branches/network/src/world_entities/space_ships/space_ship.h	(revision 6692)
+++ /branches/network/src/world_entities/space_ships/space_ship.h	(revision 6693)
@@ -65,9 +65,14 @@
     float                 yMouse;             //!< mouse moved in y-Direction
     float                 mouseSensitivity;   //!< the mouse sensitivity
-    float                 cycle;              //!< hovercycle
+    int                   yInvert;
+    int                   controlVelocityX;
+    int                   controlVelocityY;
+//    float                 cycle;              //!< hovercycle
 
     Vector                velocity;           //!< the velocity of the player.
     Quaternion            mouseDir;           //!< the direction where the player wants to fly
+    float                 shipInertia;        //!< the inertia of the ship(how fast the ship reacts to a mouse input)
     Quaternion            rotQuat;
+    Quaternion            pitchDir;
     float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
     float                 acceleration;       //!< the acceleration of the player.
Index: /branches/network/src/world_entities/weapons/aim.cc
===================================================================
--- /branches/network/src/world_entities/weapons/aim.cc	(revision 6692)
+++ /branches/network/src/world_entities/weapons/aim.cc	(revision 6693)
@@ -73,4 +73,6 @@
   this->source = NULL;
 
+  this->range = 0;
+  this->angle = 0;
   this->anim = new tAnimation<Aim>(this, &Aim::setSize);
   this->anim->setInfinity(ANIM_INF_CONSTANT);
@@ -101,13 +103,19 @@
 }
 
-void Aim::searchTarget(float range)
+void Aim::searchTarget()
 {
   std::list<WorldEntity*>::iterator entity;
-
+  Vector diffVec(0.0, 0.0, 0.0);
+  diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() );
+
+//only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
+  if( this == PNode::getNullParent() || diffVec.len() > range  || ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
   for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin();
        entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end();
        entity ++)
   {
-    if (this->source->getAbsCoor().x < (*entity)->getAbsCoor().x && (this->source->getAbsCoor() - (*entity)->getAbsCoor()).len() < range)
+    diffVec = ( (*entity)->getAbsCoor() - this->source->getAbsCoor() );
+
+    if ( diffVec.len() < range  &&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle)
     {
       if (this->getParent() != (*entity))
@@ -119,6 +127,7 @@
     }
   }
-}
-
+//if no target found:
+  this->setParent(PNode::getNullParent());
+}
 
 
@@ -155,6 +164,6 @@
 
 
-  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
-    this->searchTarget(1000);
+//  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
+     this->searchTarget();
 //   float z = 0.0f;
 //   glReadPixels ((int)this->getAbsCoor2D().x,
Index: /branches/network/src/world_entities/weapons/aim.h
===================================================================
--- /branches/network/src/world_entities/weapons/aim.h	(revision 6692)
+++ /branches/network/src/world_entities/weapons/aim.h	(revision 6693)
@@ -38,5 +38,8 @@
   inline PNode* getTarget(PNode* target) { return this->getParent(); };
 
-  void searchTarget(float range);
+  void searchTarget();
+
+  void setRange(float range){this->range = range;};
+  void setAngle(float angle){this->angle = angle;};
 
   void setSize(float size);
@@ -53,4 +56,7 @@
    tAnimation<Aim>* anim;
 
+   float            range;                //!<
+   float            angle;                //!<
+
    PNode*           source;               //!< Where this Shot has come from.
 
Index: /branches/network/src/world_entities/weapons/aiming_turret.cc
===================================================================
--- /branches/network/src/world_entities/weapons/aiming_turret.cc	(revision 6692)
+++ /branches/network/src/world_entities/weapons/aiming_turret.cc	(revision 6693)
@@ -86,5 +86,5 @@
   this->setStateDuration(WS_DEACTIVATING, .4);
 
-  this->setMaximumEnergy(10000, 50);
+  this->setEnergyMax(10000);
   this->increaseEnergy(100000);
 
@@ -98,4 +98,6 @@
   this->target = new Aim(this);
   this->target->setVisibility(false);
+  this->target->setRange(100);
+  this->target->setAngle(M_PI);
 }
 
@@ -146,5 +148,5 @@
   pj->setAbsDir(this->getAbsDir());
   pj->activate();
-  this->target->searchTarget(100);
+  this->target->searchTarget();
 }
 
Index: /branches/network/src/world_entities/weapons/ammo_container.cc
===================================================================
--- /branches/network/src/world_entities/weapons/ammo_container.cc	(revision 6693)
+++ /branches/network/src/world_entities/weapons/ammo_container.cc	(revision 6693)
@@ -0,0 +1,93 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Benjamin Grauer
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
+
+#include "ammo_container.h"
+
+#include "weapon.h"
+
+#include <assert.h>
+
+using namespace std;
+
+/**
+ * standard constructor
+ * @todo this constructor is not jet implemented - do it
+*/
+AmmoContainer::AmmoContainer (ClassID projectileType, float maxEnergy)
+{
+   this->setClassID(CL_AMMO_CONTAINER, "AmmoContainer");
+
+   this->energy = 0.0;
+   this->maxEnergy = maxEnergy;
+}
+
+
+/**
+ * standard deconstructor
+*/
+AmmoContainer::~AmmoContainer ()
+{
+  // delete what has to be deleted here
+}
+
+
+
+float AmmoContainer::increaseEnergy(float energy)
+{
+  this->energy += energy;
+
+  if (unlikely(this->energy > this->maxEnergy))
+  {
+    float retEnergy = this->energy - this->maxEnergy;
+    this->energy = this->maxEnergy;
+    return retEnergy;
+  }
+  else
+    return 0.0f;
+}
+
+
+float AmmoContainer::decreaseEnergy(float energy)
+{
+  this->energy -= energy;
+
+  if (unlikely(this->energy < 0))
+  {
+    float retEnergy = 0 - this->energy;
+    this->energy = 0;
+    return retEnergy;
+  }
+  else
+    return 0.0f;
+}
+
+bool AmmoContainer::weaponValid(const Weapon* weapon)
+{
+  return (weapon->isA(this->projectileType));
+}
+
+
+void AmmoContainer::fillWeapon(Weapon* weapon)
+{
+  assert (weapon != NULL);
+  assert (this->weaponValid(weapon));
+
+  float fillEnergy = weapon->getEnergyMax();
+
+  float restEnergy = weapon->increaseEnergy(fillEnergy);
+  this->decreaseEnergy(fillEnergy - restEnergy);
+}
Index: /branches/network/src/world_entities/weapons/ammo_container.h
===================================================================
--- /branches/network/src/world_entities/weapons/ammo_container.h	(revision 6693)
+++ /branches/network/src/world_entities/weapons/ammo_container.h	(revision 6693)
@@ -0,0 +1,46 @@
+/*!
+ * @file proto_class.h
+ * @brief Definition of ...
+*/
+
+#ifndef _AMMO_CONTAINER_H
+#define _AMMO_CONTAINER_H
+
+#include "base_object.h"
+
+
+// FORWARD DECLARATION
+class Weapon;
+
+#define DEFAULT_MAX_ENERGY 100
+
+//! A class for Storing energy of Projectiles.
+class AmmoContainer : public BaseObject {
+
+ public:
+  AmmoContainer(ClassID projectileType, float maxEnergy = DEFAULT_MAX_ENERGY);
+  virtual ~AmmoContainer();
+
+  bool operator=(ClassID projectileType) const { return (this->projectileType == projectileType); };
+  ClassID getProjectileType() const { return this->projectileType; };
+
+  float increaseEnergy(float energy);
+  float decreaseEnergy(float energy);
+
+  float getStoredEnergy() const { return this->energy; };
+  float getMaxEnergy() const { return this->maxEnergy; };
+
+  void increaseMaxEnergy(float increase);
+
+  bool weaponValid(const Weapon* weapon);
+  void fillWeapon(Weapon* weapon);
+
+
+ private:
+   float  energy;
+   float  maxEnergy;
+
+   ClassID projectileType;
+};
+
+#endif /* _AMMO_CONTAINER_H */
Index: /branches/network/src/world_entities/weapons/cannon.cc
===================================================================
--- /branches/network/src/world_entities/weapons/cannon.cc	(revision 6692)
+++ /branches/network/src/world_entities/weapons/cannon.cc	(revision 6693)
@@ -81,5 +81,5 @@
   this->setStateDuration(WS_DEACTIVATING, .4);
 
-  this->setMaximumEnergy(100, 20);
+  this->setEnergyMax(100);
   this->increaseEnergy(100);
   //this->minCharge = 2;
Index: /branches/network/src/world_entities/weapons/targeting_turret.cc
===================================================================
--- /branches/network/src/world_entities/weapons/targeting_turret.cc	(revision 6692)
+++ /branches/network/src/world_entities/weapons/targeting_turret.cc	(revision 6693)
@@ -81,5 +81,5 @@
   this->setStateDuration(WS_DEACTIVATING, .4);
 
-  this->setMaximumEnergy(10000, 50);
+  this->setEnergyMax(10000);
   this->increaseEnergy(100000);
 
@@ -93,5 +93,9 @@
   this->target = new Aim(this);
   this->target->setVisibility(false);
-
+  this->target->setRange(100);
+  this->target->setAngle(M_PI_4/2);
+  this->lockedTime = 0;
+  this->neededLockTime = 2;
+  this->lockedTarget->setParent(PNode::getNullParent());
   this->loadModel("models/guns/turret2.obj");
 
@@ -120,6 +124,17 @@
 void TargetingTurret::tick(float dt)
 {
+  if( lockedTime >= neededLockTime )
+   {
+    lockedTarget = this->target->getParent();
+    lockedTime = 0;
+   }
 
   this->target->tick(dt);
+
+  if(this->target->getParent() == PNode::getNullParent())
+   lockedTime = 0;
+  else
+   lockedTime += dt;
+
 }
 
@@ -138,5 +153,5 @@
   pj->setAbsDir(this->getAbsDir());
   pj->activate();
-  this->target->searchTarget(100);
+  this->target->searchTarget();
 }
 
Index: /branches/network/src/world_entities/weapons/targeting_turret.h
===================================================================
--- /branches/network/src/world_entities/weapons/targeting_turret.h	(revision 6692)
+++ /branches/network/src/world_entities/weapons/targeting_turret.h	(revision 6693)
@@ -32,6 +32,9 @@
 
   private:
-    Aim*          target;
-  };
+    Aim*           target;
+    PNode*         lockedTarget;
+    float          lockedTime;
+    float          neededLockTime;
+  }; 
 
 #endif /* _TARGETING_TURRET_H */
Index: /branches/network/src/world_entities/weapons/test_gun.cc
===================================================================
--- /branches/network/src/world_entities/weapons/test_gun.cc	(revision 6692)
+++ /branches/network/src/world_entities/weapons/test_gun.cc	(revision 6693)
@@ -122,5 +122,5 @@
   this->setStateDuration(WS_DEACTIVATING, .4);
 
-  this->setMaximumEnergy(1000, 100);
+  this->setEnergyMax(1000);
   this->increaseEnergy(1000);
   //this->minCharge = 2;
Index: /branches/network/src/world_entities/weapons/turret.cc
===================================================================
--- /branches/network/src/world_entities/weapons/turret.cc	(revision 6692)
+++ /branches/network/src/world_entities/weapons/turret.cc	(revision 6693)
@@ -86,5 +86,5 @@
   this->setStateDuration(WS_DEACTIVATING, .4);
 
-  this->setMaximumEnergy(100, 5);
+  this->setEnergyMax(100);
   this->increaseEnergy(100);
   //this->minCharge = 2;
Index: /branches/network/src/world_entities/weapons/weapon.cc
===================================================================
--- /branches/network/src/world_entities/weapons/weapon.cc	(revision 6692)
+++ /branches/network/src/world_entities/weapons/weapon.cc	(revision 6693)
@@ -95,12 +95,9 @@
   this->maxCharge = 1.0;                           //< The maximum charge is also one unit.
 
-  this->energyLoaded = .0;                         //< How much energy is loaded in the Gun. (Weapons must be charged befor usage)
-  this->energyLoadedMax = 5.0;                     //< Each Weapon has a Maximum energy that can be charged onto it
-  this->energy = .0;                               //< The secondary Buffer (before we have to reload)
+  this->energy = 10;                               //< The secondary Buffer (before we have to reload)
   this->energyMax = 10.0;                          //< How much energy can be carried
   this->capability = WTYPE_ALL;                    //< The Weapon has all capabilities @see W_Capability.
 
   this->energyWidget = NULL;
-  this->energyLoadedWidget = NULL;
 
   // set this object to be synchronized over network
@@ -291,18 +288,4 @@
 }
 
-
-GLGuiWidget* Weapon::getLoadedEnergyWidget()
-{
-  if (this->energyLoadedWidget == NULL)
-  {
-    this->energyLoadedWidget = new GLGuiBar;
-    //this->energyLoadedWidget->setParent2D(this->bar);
-    this->energyLoadedWidget->setRelCoor2D(20,0);
-    this->energyLoadedWidget->setSize2D(10,50);
-    this->energyLoadedWidget->setMaximum(this->getLoadedEnergyMax());
-  }
-  return this->energyLoadedWidget;
-}
-
 void Weapon::updateWidgets()
 {
@@ -311,9 +294,4 @@
     this->energyWidget->setMaximum(this->energyMax);
     this->energyWidget->setValue(this->energy);
-  }
-  if (this->energyLoadedWidget != NULL)
-  {
-    this->energyLoadedWidget->setMaximum(this->energyLoadedMax);
-    this->energyLoadedWidget->setValue(this->energyLoaded);
   }
 }
@@ -395,19 +373,19 @@
   switch (action)
   {
-    case WA_SHOOT:
-      return this->fireW();
-      break;
-    case WA_CHARGE:
-      return this->chargeW();
-      break;
-    case WA_RELOAD:
-      return this->reloadW();
-      break;
-    case WA_DEACTIVATE:
-      return this->deactivateW();
-      break;
-    case WA_ACTIVATE:
-      return this->activateW();
-      break;
+  case WA_SHOOT:
+    return this->fireW();
+    break;
+  case WA_CHARGE:
+    return this->chargeW();
+    break;
+  case WA_RELOAD:
+    return this->reloadW();
+    break;
+  case WA_DEACTIVATE:
+    return this->deactivateW();
+    break;
+  case WA_ACTIVATE:
+    return this->activateW();
+    break;
   }
 }
@@ -457,5 +435,5 @@
 bool Weapon::chargeW()
 {
-  if ( this->currentState != WS_INACTIVE && this->energyLoaded >= this->minCharge)
+  if ( this->currentState != WS_INACTIVE && this->energy >= this->minCharge)
   {
     // playing Sound
@@ -481,5 +459,5 @@
 {
   //if (likely(this->currentState != WS_INACTIVE))
-  if (this->minCharge <= this->energyLoaded)
+  if (this->minCharge <= this->energy)
   {
     // playing Sound
@@ -488,5 +466,5 @@
     this->updateWidgets();
     // fire
-    this->energyLoaded -= this->minCharge;
+    this->energy -= this->minCharge;
     this->fire();
     // setting up for the next state
@@ -507,5 +485,6 @@
 {
   PRINTF(4)("Reloading Weapon %s\n", this->getName());
-  if (unlikely(this->energy + this->energyLoaded < this->minCharge))
+  if (this->ammoContainer.get() != NULL &&
+        unlikely(this->energy + this->ammoContainer->getStoredEnergy() < this->minCharge))
   {
     this->requestAction(WA_DEACTIVATE);
@@ -514,22 +493,14 @@
   }
 
-  float chargeSize = this->energyLoadedMax - this->energyLoaded;       //!< The energy to be charged
 
   if (this->soundBuffers[WA_RELOAD] != NULL)
     this->soundSource->play(this->soundBuffers[WA_RELOAD]);
 
-  if (chargeSize > this->energy)
-  {
-    this->energyLoaded += this->energy;
-    this->energy = 0.0;
-    PRINT(5)("Energy depleted\n");
-  }
-  else
-  {
-    PRINTF(5)("Loaded %f energy into the Guns Buffer\n", chargeSize);
-    this->energyLoaded += chargeSize;
-    this->energy -= chargeSize;
-  }
-
+  if (this->ammoContainer.get() != NULL)
+    this->ammoContainer->fillWeapon(this);
+  else
+  {
+    this->energy = this->energyMax;
+  }
   this->updateWidgets();
   this->reload();
@@ -617,6 +588,6 @@
 {
   PRINT(0)("Weapon-Debug %s, state: %s (duration: %fs), nextAction: %s\n", this->getName(), Weapon::stateToChar(this->currentState), this->stateDuration, Weapon::actionToChar(requestedAction));
-  PRINT(0)("Energy: max: %f; current: %f;  loadedMax: %f; loadedCurrent: %f; chargeMin: %f, chargeMax %f\n",
-           this->energyMax, this->energy, this->energyLoadedMax, this->energyLoaded, this->minCharge, this->maxCharge);
+  PRINT(0)("Energy: max: %f; current: %f; chargeMin: %f, chargeMax %f\n",
+           this->energyMax, this->energy, this->minCharge, this->maxCharge);
 
 
@@ -663,25 +634,25 @@
   switch (action)
   {
-    case WA_SHOOT:
-      return "shoot";
-      break;
-    case WA_CHARGE:
-      return "charge";
-      break;
-    case WA_RELOAD:
-      return "reload";
-      break;
-    case WA_ACTIVATE:
-      return "activate";
-      break;
-    case WA_DEACTIVATE:
-      return "deactivate";
-      break;
-    case WA_SPECIAL1:
-      return "special1";
-      break;
-    default:
-      return "none";
-      break;
+  case WA_SHOOT:
+    return "shoot";
+    break;
+  case WA_CHARGE:
+    return "charge";
+    break;
+  case WA_RELOAD:
+    return "reload";
+    break;
+  case WA_ACTIVATE:
+    return "activate";
+    break;
+  case WA_DEACTIVATE:
+    return "deactivate";
+    break;
+  case WA_SPECIAL1:
+    return "special1";
+    break;
+  default:
+    return "none";
+    break;
   }
 }
@@ -726,28 +697,28 @@
   switch (state)
   {
-    case WS_SHOOTING:
-      return "shooting";
-      break;
-    case WS_CHARGING:
-      return "charging";
-      break;
-    case WS_RELOADING:
-      return "reloading";
-      break;
-    case WS_ACTIVATING:
-      return "activating";
-      break;
-    case WS_DEACTIVATING:
-      return "deactivating";
-      break;
-    case WS_IDLE:
-      return "idle";
-      break;
-    case WS_INACTIVE:
-      return "inactive";
-      break;
-    default:
-      return "none";
-      break;
-  }
-}
+  case WS_SHOOTING:
+    return "shooting";
+    break;
+  case WS_CHARGING:
+    return "charging";
+    break;
+  case WS_RELOADING:
+    return "reloading";
+    break;
+  case WS_ACTIVATING:
+    return "activating";
+    break;
+  case WS_DEACTIVATING:
+    return "deactivating";
+    break;
+  case WS_IDLE:
+    return "idle";
+    break;
+  case WS_INACTIVE:
+    return "inactive";
+    break;
+  default:
+    return "none";
+    break;
+  }
+}
Index: /branches/network/src/world_entities/weapons/weapon.h
===================================================================
--- /branches/network/src/world_entities/weapons/weapon.h	(revision 6692)
+++ /branches/network/src/world_entities/weapons/weapon.h	(revision 6693)
@@ -16,4 +16,6 @@
 
 #include "world_entity.h"
+#include "count_pointer.h"
+#include "ammo_container.h"
 
 // FORWARD DECLARATION
@@ -105,5 +107,5 @@
     inline void setCapability(long capabilities) { this->capability = capabilities; };
     /** @returns the Capabilities of this Weapon */
-    inline long getCapability() { return this->capability; };
+    inline long getCapability() const { return this->capability; };
     void setProjectileType(ClassID projectile);
     void setProjectileType(const char* projectile);
@@ -135,10 +137,9 @@
     inline WeaponState getCurrentState() const { return this->currentState; };
 
-    /** @param energyMax the maximum energy the Weapon can have @param energyLoadedMax the maximum energy in the weapon buffers */
-    inline void setMaximumEnergy(float energyMax, float energyLoadedMax) { this->energyMax = energyMax; this->energyLoadedMax = energyLoadedMax; };
-    inline float getLoadedEnergyMax() const { return this->energyLoadedMax; };
+    /** @param energyMax the maximum energy the Weapon can have */
+    inline void setEnergyMax(float energyMax) { this->energyMax = energyMax; };
+    inline float getEnergy() const { return this->energy; };
     inline float getEnergyMax() const { return this->energyMax; };
-    inline float getEnergy() const { return this->energy; };
-    inline float getLoadedEnergy() const { return this->energyLoaded; };
+    inline void setAmmoContainer(const CountPointer<AmmoContainer>& ammoContainer) { this->ammoContainer = ammoContainer;}
 
     void setActionSound(WeaponAction action, const char* soundFile);
@@ -150,5 +151,4 @@
 
     GLGuiWidget* getEnergyWidget();
-    GLGuiWidget* getLoadedEnergyWidget();
 
     // FLOW
@@ -198,8 +198,7 @@
 
     // it is all about energy
-    float                energy;                           //!< The energy stored in the weapons secondary buffers (reserve)
-    float                energyLoaded;                     //!< The energy stored in the weapons primary buffers (fire without reload)
+    float                energy;                           //!< The energy stored in the weapons buffers
     float                energyMax;                        //!< The maximal energy that can be stored in the secondary buffers (reserveMax)
-    float                energyLoadedMax;                  //!< The maximal energy that can be stored in the primary buffers
+    CountPointer<AmmoContainer> ammoContainer;             //!< Pointer to the AmmoContainer this weapon grabs Energy from.
     //! @todo move this to projectile
     float                minCharge;                        //!< The minimal energy to be loaded onto one projectile if chargeable otherwise the power consumed by one projectile
@@ -207,5 +206,4 @@
 
     GLGuiBar*            energyWidget;
-    GLGuiBar*            energyLoadedWidget;
 
     ////////////
Index: /branches/network/src/world_entities/weapons/weapon_manager.cc
===================================================================
--- /branches/network/src/world_entities/weapons/weapon_manager.cc	(revision 6692)
+++ /branches/network/src/world_entities/weapons/weapon_manager.cc	(revision 6693)
@@ -217,14 +217,32 @@
 bool WeaponManager::addWeapon(Weapon* weapon, int configID, int slotID)
 {
+  assert(weapon != NULL);
+
   if (unlikely(configID >= WM_MAX_CONFIGS || slotID >= (int)this->slotCount))
   {
-    PRINTF(2)("Slot %d of config %d is not availiabe (max: %d)\n", slotID, configID, this->slotCount);
+    PRINTF(2)("Slot %d of config %d is not availiabe (max: %d) searching for suitable slot\n", slotID, configID, this->slotCount);
+    if (configID >= WM_MAX_CONFIGS)
+      configID = -1;
+    if (slotID >= (int)this->slotCount)
+      slotID = -1;
+  }
+  // if no ConfigID is supplied set to Current Config.
+  if (configID <= -1)
+    configID = this->currentConfigID;
+  //
+  if (configID > -1 && slotID == -1)
+  {
+    slotID = this->getNextFreeSlot(configID, weapon->getCapability());
+    if (slotID == -1)
+      configID = -1;
+  }
+
+  if (configID > 0 && slotID > 0 && this->configs[configID][slotID] != NULL)
+  {
+    PRINTF(3)("Weapon-slot %d/%d of %s already poulated, remove weapon (%s::%s) first\n", configID, slotID, this->getName(), weapon->getClassName(), weapon->getName());
     return false;
   }
 
-  if (this->configs[configID][slotID] != NULL && configID > 0 && slotID > 0)
-    PRINTF(3)("Weapon-slot %d/%d of %s already poulated, overwriting\n", configID, slotID, this->getName());
-
-  if (slotID == -1) // WM_FREE_SLOT
+  if (slotID <= -1) // WM_FREE_SLOT
   {
     slotID = this->getNextFreeSlot(configID, weapon->getCapability());
@@ -245,10 +263,13 @@
 
   //! @todo check if the weapon is already assigned to another config in another slot
+  assert(this->configs[configID][slotID] == NULL);
+
   this->configs[configID][slotID] = weapon;
+  weapon->setAmmoContainer(this->getAmmoContainer(weapon->getProjectileType()));
   if (this->parent != NULL)
   {
     this->parent->addChild(weapon);
   }
-  PRINTF(3)("Added a new Weapon to the WeaponManager: config %i/ slot %i\n", configID, slotID);
+  PRINTF(3)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassName(), weapon->getName(), configID, slotID);
   return true;
 }
@@ -420,18 +441,42 @@
 /**
  * private gets the next free slot in a certain weaponconfig
- * @param the selected weaponconfig
+ * @param the selected weaponconfig -1 if none found
  */
 int WeaponManager::getNextFreeSlot(int configID, long capability)
 {
-  for( int i = 0; i < this->slotCount; ++i)
-  {
-    if( this->configs[configID][i] == NULL &&
-        (this->currentSlotConfig[i].capability & capability & WTYPE_ALLKINDS) &&
-        (this->currentSlotConfig[i].capability & capability & WTYPE_ALLDIRS))
-      return i;
+  if (configID == -1)
+  {
+    for (configID = 0; configID < WM_MAX_CONFIGS; configID++)
+      for( int i = 0; i < this->slotCount; ++i)
+      {
+        if( this->configs[configID][i] == NULL &&
+            (this->currentSlotConfig[i].capability & capability & WTYPE_ALLKINDS) &&
+            (this->currentSlotConfig[i].capability & capability & WTYPE_ALLDIRS))
+          return i;
+    }
+  }
+  else
+  {
+    for( int i = 0; i < this->slotCount; ++i)
+    {
+      if( this->configs[configID][i] == NULL &&
+          (this->currentSlotConfig[i].capability & capability & WTYPE_ALLKINDS) &&
+          (this->currentSlotConfig[i].capability & capability & WTYPE_ALLDIRS))
+        return i;
+    }
   }
   return -1;
 }
 
+CountPointer<AmmoContainer>& WeaponManager::getAmmoContainer(ClassID projectileType)
+{
+  for (unsigned int i = 0; i < this->ammo.size(); i++)
+  {
+    if (this->ammo[i]->getProjectileType() == projectileType)
+      return this->ammo[i];
+  }
+  this->ammo.push_back(CountPointer<AmmoContainer>(new AmmoContainer(projectileType)));
+  return this->ammo.back();
+}
 
 
Index: /branches/network/src/world_entities/weapons/weapon_manager.h
===================================================================
--- /branches/network/src/world_entities/weapons/weapon_manager.h	(revision 6692)
+++ /branches/network/src/world_entities/weapons/weapon_manager.h	(revision 6693)
@@ -17,4 +17,7 @@
 #include "crosshair.h"
 #include "weapon.h"
+
+#include "count_pointer.h"
+#include "ammo_container.h"
 
 // FORWARD DECLARATION
@@ -71,7 +74,7 @@
     PNode* getParent() const { return this->parent; };
 
-    bool addWeapon(Weapon* weapon);
     bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
     void removeWeapon(Weapon* weapon, int configID = -1);
+
     Weapon* getWeapon(int slotID) const { return (slotID >= 0 && slotID < this->slotCount)? this->currentSlotConfig[slotID].nextWeapon: NULL; };
 
@@ -82,4 +85,7 @@
     void previousWeaponConfig();
     void changeWeaponConfig(int weaponConfig);
+
+    float addAmmunition(ClassID projectileType, float ammo);
+
 
     /** @returns a fixed target namely the Crosshair's 3D position */
@@ -97,4 +103,5 @@
  // private:
     int getNextFreeSlot(int configID, long capability = WTYPE_ALL);
+    CountPointer<AmmoContainer>& getAmmoContainer(ClassID projectileType);
 
   private:
@@ -112,4 +119,6 @@
     Crosshair*              crosshair;                                //!< an aim.
     tAnimation<Crosshair>*  crossHairSizeAnim;                        //!< An animation for the crosshair (scaling)
+
+    std::vector<CountPointer<AmmoContainer> > ammo;                   //!< Containers
 };
 
