Merge remote-tracking branch 'dfhack/develop' into develop

develop
expwnent 2015-09-21 17:48:34 -04:00
commit b532a56790
5 changed files with 44 additions and 4 deletions

@ -128,18 +128,19 @@ bool Filesystem::exists (std::string path)
_filetype Filesystem::filetype (std::string path)
{
STAT_STRUCT info;
Filesystem::stat(path, info);
if (!Filesystem::stat(path, info))
return FILETYPE_NONE;
return mode2type(info.st_mode);
}
bool Filesystem::isfile (std::string path)
{
return Filesystem::filetype(path) == FILETYPE_FILE;
return Filesystem::exists(path) && Filesystem::filetype(path) == FILETYPE_FILE;
}
bool Filesystem::isdir (std::string path)
{
return Filesystem::filetype(path) == FILETYPE_DIRECTORY;
return Filesystem::exists(path) && Filesystem::filetype(path) == FILETYPE_DIRECTORY;
}
#define DEFINE_STAT_TIME_WRAPPER(attr) \

@ -1 +1 @@
Subproject commit 2a49a0761e4413603d9a72542077755cea2ad56d
Subproject commit 32960d38410e7caedf2b38cff7ef3f21c1785bbd

@ -302,6 +302,9 @@ message WorldMap
repeated int32 salinity = 14;
optional int32 map_x = 15;
optional int32 map_y = 16;
optional int32 center_x = 17;
optional int32 center_y = 18;
optional int32 center_z = 19;
}
message RegionMaps
@ -336,3 +339,19 @@ message CreatureRawList
{
repeated CreatureRaw creature_raws = 1;
}
message Army
{
optional int32 id = 1;
optional int32 pos_x = 2;
optional int32 pos_y = 3;
optional int32 pos_z = 4;
optional UnitDefinition leader = 5;
repeated UnitDefinition members = 6;
optional uint32 flags = 7;
}
message ArmyList
{
repeated Army armies = 1;
}

@ -42,6 +42,8 @@
#include "df/region_map_entry.h"
#include "df/world_region_details.h"
#include "df/army.h"
#include "df/army_flags.h"
#include "df/unit.h"
#include "df/creature_raw.h"
@ -1256,6 +1258,23 @@ static command_result GetWorldMap(color_ostream &stream, const EmptyMessage *in,
clouds->set_front((RemoteFortressReader::FrontType)map_entry->clouds.bits.front);
clouds->set_stratus((RemoteFortressReader::StratusType)map_entry->clouds.bits.stratus);
}
int32_t pos_x = 0, pos_y = 0, pos_z = 0;
if (Maps::IsValid())
Maps::getPosition(pos_x, pos_y, pos_z);
else
for (int i = 0; i < df::global::world->armies.all.size(); i++)
{
df::army * thisArmy = df::global::world->armies.all[i];
if (thisArmy->flags.is_set(df::enums::army_flags::player))
{
pos_x = (thisArmy->pos.x / 3) - 1;
pos_y = (thisArmy->pos.y / 3) - 1;
pos_z = thisArmy->pos.z;
}
}
out->set_center_x(pos_x);
out->set_center_y(pos_y);
out->set_center_z(pos_z);
return CR_OK;
}

@ -174,6 +174,7 @@ function GmEditorUi:getSelectedEnumType()
local trg=self:currentTarget()
local trg_key=trg.keys[self.subviews.list_main:getSelected()]
if trg.target._field==nil then return nil end
if trg.target:_field(trg_key)==nil then return nil end
local enum=trg.target:_field(trg_key)._type
if enum._kind=="enum-type" then
return enum