src/ship_cmd.cpp
branchnoai
changeset 10370 fa4f88090694
parent 10355 ee4b5f7a5bf2
child 10455 22c441f5adf9
equal deleted inserted replaced
10362:7fb36b849909 10370:fa4f88090694
    38 #include "autoreplace_gui.h"
    38 #include "autoreplace_gui.h"
    39 #include "gfx_func.h"
    39 #include "gfx_func.h"
    40 #include "settings_type.h"
    40 #include "settings_type.h"
    41 #include "order_func.h"
    41 #include "order_func.h"
    42 #include "effectvehicle_func.h"
    42 #include "effectvehicle_func.h"
       
    43 #include "ai/ai.h"
    43 
    44 
    44 #include "table/strings.h"
    45 #include "table/strings.h"
    45 
    46 
    46 static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
    47 static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};
    47 
    48 
   722 {
   723 {
   723 	Vehicle *v;
   724 	Vehicle *v;
   724 
   725 
   725 	FOR_ALL_VEHICLES(v) {
   726 	FOR_ALL_VEHICLES(v) {
   726 		if (v->type == VEH_SHIP) {
   727 		if (v->type == VEH_SHIP) {
       
   728 			if (v->age >= 730 && v->GetDisplayProfitThisYear() < 0) {
       
   729 				AI_Event(v->owner, new AIEventVehicleUnprofitable(v->index));
       
   730 			}
   727 			v->profit_last_year = v->profit_this_year;
   731 			v->profit_last_year = v->profit_this_year;
   728 			v->profit_this_year = 0;
   732 			v->profit_this_year = 0;
   729 			InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   733 			InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
   730 		}
   734 		}
   731 	}
   735 	}