Added conditionals to remotefortressreader.cpp to make compiling for v 0.24.11 easier.

develop
Japa 2015-08-13 11:25:59 +05:30
parent 867e78b6fd
commit a60c8d8e7c
1 changed files with 23 additions and 6 deletions

@ -1,8 +1,4 @@
//define which version of DF this is being built for.
#define DF_VER_040
//#define DF_VER_034
// some headers required for a plugin. Nothing special, just the basics.
#include "Core.h"
#include <Console.h>
@ -27,8 +23,10 @@
#include "df/builtin_mats.h"
#include "df/map_block_column.h"
#include "df/plant.h"
#ifndef DFHACK_VERSION="0.34.11-r5"
#include "df/plant_tree_info.h"
#include "df/plant_growth.h"
#endif
#include "df/itemdef.h"
#include "df/building_def_workshopst.h"
#include "df/building_def_furnacest.h"
@ -67,7 +65,11 @@ using namespace RemoteFortressReader;
using namespace std;
DFHACK_PLUGIN("RemoteFortressReader");
#ifdef DFHACK_VERSION="0.34.11-r5"
using namespace df::global;
#else
REQUIRE_GLOBAL(world);
#endif
// Here go all the command declarations...
// mostly to allow having the mandatory stuff on top of the file and commands on the bottom
@ -236,6 +238,7 @@ RemoteFortressReader::TiletypeMaterial TranslateMaterial(df::tiletype_material m
case df::enums::tiletype_material::RIVER:
return RemoteFortressReader::RIVER;
break;
#ifndef DFHACK_VERSION="0.34.11-r5"
case df::enums::tiletype_material::ROOT:
return RemoteFortressReader::ROOT;
break;
@ -248,6 +251,7 @@ RemoteFortressReader::TiletypeMaterial TranslateMaterial(df::tiletype_material m
case df::enums::tiletype_material::UNDERWORLD_GATE:
return RemoteFortressReader::UNDERWORLD_GATE;
break;
#endif
default:
return RemoteFortressReader::NO_MATERIAL;
break;
@ -295,9 +299,11 @@ RemoteFortressReader::TiletypeSpecial TranslateSpecial(df::tiletype_special spec
case df::enums::tiletype_special::TRACK:
return RemoteFortressReader::TRACK;
break;
#ifndef DFHACK_VERSION="0.34.11-r5"
case df::enums::tiletype_special::SMOOTH_DEAD:
return RemoteFortressReader::SMOOTH_DEAD;
break;
#endif
default:
return RemoteFortressReader::NO_SPECIAL;
break;
@ -351,20 +357,25 @@ RemoteFortressReader::TiletypeShape TranslateShape(df::tiletype_shape shape)
case df::enums::tiletype_shape::BROOK_TOP:
return RemoteFortressReader::BROOK_TOP;
break;
#ifndef DFHACK_VERSION="0.34.11-r5"
case df::enums::tiletype_shape::BRANCH:
return RemoteFortressReader::BRANCH;
break;
#ifdef DF_VER_034
#endif
#ifdef DFHACK_VERSION="0.34.11-r5"
case df::enums::tiletype_shape::TREE:
return RemoteFortressReader::TREE;
return RemoteFortressReader::TREE_SHAPE;
break;
#endif
#ifndef DFHACK_VERSION="0.34.11-r5"
case df::enums::tiletype_shape::TRUNK_BRANCH:
return RemoteFortressReader::TRUNK_BRANCH;
break;
case df::enums::tiletype_shape::TWIG:
return RemoteFortressReader::TWIG;
break;
#endif
case df::enums::tiletype_shape::SAPLING:
return RemoteFortressReader::SAPLING;
break;
@ -622,6 +633,7 @@ static command_result GetGrowthList(color_ostream &stream, const EmptyMessage *i
basePlant->set_name(pp->name);
basePlant->mutable_mat_pair()->set_mat_type(-1);
basePlant->mutable_mat_pair()->set_mat_index(i);
#ifndef DFHACK_VERSION="0.34.11-r5"
for (int g = 0; g < pp->growths.size(); g++)
{
df::plant_growth* growth = pp->growths[g];
@ -636,6 +648,7 @@ static command_result GetGrowthList(color_ostream &stream, const EmptyMessage *i
out_growth->mutable_mat_pair()->set_mat_index(i);
}
}
#endif
}
return CR_OK;
}
@ -860,6 +873,9 @@ static command_result GetPlantList(color_ostream &stream, const BlockRequest *in
int max_y = in->max_y() / 3;
int max_z = in->max_z();
#ifdef DFHACK_VERSION="0.34.11-r5"
//plants are gotten differently here
#else
for (int xx = min_x; xx < max_x; xx++)
for (int yy = min_y; yy < max_y; yy++)
{
@ -894,6 +910,7 @@ static command_result GetPlantList(color_ostream &stream, const BlockRequest *in
out_plant->set_pos_z(plant->pos.z);
}
}
#endif
return CR_OK;
}