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
base_xml.cpp File Reference
#include "config.h"
#include <Python.h>
#include <vector>
#include <string>
#include <math.h>
#include "python/python_class.h"
#include "base.h"
#include "base_util.h"
#include "vsfilesystem.h"
#include <boost/version.hpp>
#include <boost/python/object.hpp>

Go to the source code of this file.

Functions

static FILE * withAndWithout (std::string filename, std::string time_of_day_hint)
 
static FILE * getFullFile (std::string filename, std::string time_of_day_hint, std::string faction)
 

Function Documentation

static FILE* getFullFile ( std::string  filename,
std::string  time_of_day_hint,
std::string  faction 
)
static

Definition at line 27 of file base_xml.cpp.

References withAndWithout().

Referenced by BaseInterface::Load().

28 {
29  FILE *fp = withAndWithout( filename+"_"+faction, time_of_day_hint );
30  if (!fp)
31  fp = withAndWithout( filename, time_of_day_hint );
32  return fp;
33 }
static FILE* withAndWithout ( std::string  filename,
std::string  time_of_day_hint 
)
static

Definition at line 17 of file base_xml.cpp.

References BASE_EXTENSION, and VSFileSystem::vs_open().

Referenced by getFullFile().

18 {
19  string with( filename+"_"+time_of_day_hint+BASE_EXTENSION );
20  FILE *fp = VSFileSystem::vs_open( with.c_str(), "r" );
21  if (!fp) {
22  string without( filename+BASE_EXTENSION );
23  fp = VSFileSystem::vs_open( without.c_str(), "r" );
24  }
25  return fp;
26 }