Skip to content

Commit

Permalink
Feature: Region-based pathfinder for ships
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuhnovic committed Mar 9, 2023
1 parent 87f4d37 commit c6745fa
Show file tree
Hide file tree
Showing 17 changed files with 1,144 additions and 42 deletions.
4 changes: 3 additions & 1 deletion src/depot_gui.cpp
Expand Up @@ -908,7 +908,9 @@ struct DepotWindow : Window {
{
if (_ctrl_pressed) {
/* Share-clone, do not open new viewport, and keep tool active */
Command<CMD_CLONE_VEHICLE>::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, this->window_number, v->index, true);
for (int i = 0; i < 50; ++i) { // TODO KB for performance testing, remove again
Command<CMD_CLONE_VEHICLE>::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, this->window_number, v->index, true);
}
} else {
/* Copy-clone, open viewport for new vehicle, and deselect the tool (assume player wants to change things on new vehicle) */
if (Command<CMD_CLONE_VEHICLE>::Post(STR_ERROR_CAN_T_BUY_TRAIN + v->type, CcCloneVehicle, this->window_number, v->index, false)) {
Expand Down
3 changes: 3 additions & 0 deletions src/genworld.cpp
Expand Up @@ -34,6 +34,7 @@
#include "string_func.h"
#include "thread.h"
#include "tgp.h"
#include "pathfinder/water_regions.h" // TODO KB for ship pathfinder reset

#include "safeguards.h"

Expand Down Expand Up @@ -173,6 +174,8 @@ static void _GenerateWorld()
}
}

ResetShipPathfinder();

BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP);

ResetObjectToPlace();
Expand Down
1 change: 1 addition & 0 deletions src/misc.cpp
Expand Up @@ -105,6 +105,7 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
InitializeIndustries();
InitializeObjects();
InitializeBuildingCounts();
//ResetShipPathfinder(); // TODO KB figure out if it's necessary or not

InitializeNPF();

Expand Down
4 changes: 4 additions & 0 deletions src/misc_gui.cpp
Expand Up @@ -28,6 +28,7 @@
#include "viewport_func.h"
#include "landscape_cmd.h"
#include "rev.h"
#include "pathfinder/water_regions.h"

#include "widgets/misc_widget.h"

Expand Down Expand Up @@ -128,6 +129,9 @@ class LandInfoWindow : public Window {
Debug(misc, LANDINFOD_LEVEL, "m7 = {:#x}", tile.m7());
Debug(misc, LANDINFOD_LEVEL, "m8 = {:#x}", tile.m8());
#undef LANDINFOD_LEVEL

// TODO debug code, remove again
DEBUG_UpdateWaterRegion(tile);
}

void OnInit() override
Expand Down
2 changes: 2 additions & 0 deletions src/pathfinder/CMakeLists.txt
Expand Up @@ -5,4 +5,6 @@ add_files(
follow_track.hpp
pathfinder_func.h
pathfinder_type.h
water_regions.h
water_regions.cpp
)

0 comments on commit c6745fa

Please sign in to comment.