Consider assigned vehicles in use, and tweak text color rendering.

develop
Alexander Gavrilov 2012-10-25 13:20:41 +04:00
parent 79d2cb1a5c
commit 1f994295b8
2 changed files with 14 additions and 2 deletions

@ -246,11 +246,12 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled)
local keypen local keypen
if dc then if dc then
local tpen = getval(token.pen)
if disabled or is_disabled(token) then if disabled or is_disabled(token) then
dc:pen(getval(token.dpen) or dpen) dc:pen(getval(token.dpen) or tpen or dpen)
keypen = COLOR_GREEN keypen = COLOR_GREEN
else else
dc:pen(getval(token.pen) or pen) dc:pen(tpen or pen)
keypen = COLOR_LIGHTGREEN keypen = COLOR_LIGHTGREEN
end end
end end

@ -40,6 +40,7 @@
#include "df/plant_raw.h" #include "df/plant_raw.h"
#include "df/inorganic_raw.h" #include "df/inorganic_raw.h"
#include "df/builtin_mats.h" #include "df/builtin_mats.h"
#include "df/vehicle.h"
using std::vector; using std::vector;
using std::string; using std::string;
@ -994,6 +995,15 @@ static bool itemInRealJob(df::item *item)
!= job_type_class::Hauling; != job_type_class::Hauling;
} }
static bool isRouteVehicle(df::item *item)
{
int id = item->getVehicleID();
if (id < 0) return false;
auto vehicle = df::vehicle::find(id);
return vehicle && vehicle->route_id >= 0;
}
static void map_job_items(color_ostream &out) static void map_job_items(color_ostream &out)
{ {
for (size_t i = 0; i < constraints.size(); i++) for (size_t i = 0; i < constraints.size(); i++)
@ -1103,6 +1113,7 @@ static void map_job_items(color_ostream &out)
item->flags.bits.owned || item->flags.bits.owned ||
item->flags.bits.in_chest || item->flags.bits.in_chest ||
item->isAssignedToStockpile() || item->isAssignedToStockpile() ||
isRouteVehicle(item) ||
itemInRealJob(item) || itemInRealJob(item) ||
itemBusy(item)) itemBusy(item))
{ {