Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
script_callbacks.cpp File Reference
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <ctype.h>
#include <assert.h>
#include <unistd.h>
#include <expat.h>
#include "xml_support.h"
#include "vegastrike.h"
#include "lin_time.h"
#include "cmd/unit_generic.h"
#include "mission.h"
#include "easydom.h"
#include "msgcenter.h"
#include "pythonmission.h"

Go to the source code of this file.

Functions

string varToString (varInst *vi)
 

Function Documentation

string varToString ( varInst vi)

Definition at line 55 of file script_callbacks.cpp.

References varInst::bool_val, varInst::float_val, varInst::int_val, varInst::object, varInst::objectname, XMLSupport::tostring(), varInst::type, VAR_BOOL, VAR_FLOAT, VAR_INT, and VAR_OBJECT.

56 {
57  switch (vi->type)
58  {
59  case VAR_FLOAT:
60  return XMLSupport::tostring( (float) vi->float_val );
61  case VAR_INT:
62  return XMLSupport::tostring( vi->int_val );
63  case VAR_BOOL:
64  return XMLSupport::tostring( vi->bool_val );
65  case VAR_OBJECT:
66  default:
67  if (vi->objectname == "string")
68  return *( (string*) vi->object );
69  else
70  return XMLSupport::tostring( (long) vi->object );
71  }
72 }