Open Simulator Terrain Editor BRIGADOON-0007
Edit Terrain Files for Open Simulator Regions
Loading...
Searching...
No Matches
areacalculator.cpp
Go to the documentation of this file.
1#include "areacalculator.h"
2
3void AreaCalculator::AutoCalcChanged(Qt::CheckState State)
4{
5 auto_calc_size = (bool)State;
7 {
10 }
11}
12
14 : QObject{parent}
15{
16 region_size = 65536;
18 side_additive = 0;
19 lower_x = 0; lower_y = 0; upper_x = 0; upper_y = 0;
21 auto_calc_size = false;
22}
23
25{
26 lower_x = NewValue;
28}
29
31{
32 lower_y = NewValue;
34}
35
37{
38 upper_x = NewValue + side_additive;
40}
41
43{
44 upper_y = NewValue + side_additive;
46}
47
49{
50 world_x_size = NewValue;
52}
53
55{
56 world_y_size = NewValue;
58}
59
61{
62 int world_block = world_x_size * world_y_size;
63 int region_count = world_block;
64 float world_area = (float)world_block * region_size;
65 REMOTE_WORLD_SIZE remote_world_size;
66
67 remote_world_size.WorldArea = world_area;
68 remote_world_size.WorldRegionCount = region_count;
69
70 emit SendWorldArea(remote_world_size);
71}
72
80
88
96
98{
99 REMOTE_WORLD_SIDES world_sides;
100
101 // Check that None of the Limits are currently 0
102 if ((lower_x != 0) && (upper_x != 0) && (lower_y != 0) && (upper_y != 0))
103 {
104 world_sides.WorldXSize = upper_x - lower_x + side_additive + 1;
105 world_sides.WorldYSize = upper_y - lower_y + side_additive + 1;
106 }
107 else
108 {
109 world_sides.WorldXSize = 0;
110 world_sides.WorldYSize = 0;
111 }
112
113 emit SendWorldSides(world_sides);
114}
115
116void AreaCalculator::LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, QString Message)
117{
118 REMOTE_LOG_ENTRY log_entry;
119 log_entry.Severity = Severity;
120 log_entry.Mode = Mode;
121 log_entry.Message = Message;
122 emit SendLogEntry(log_entry);
123}
124
126{
127 auto_calc_size = true;
128
129 if ((lower_x == 0) || Location.RegionXLocation < lower_x) LowerXChanged(Location.RegionXLocation);
130 if (Location.RegionXLocation > upper_x) UpperXChanged(Location.RegionXLocation);
132
133 if ((lower_y == 0) || Location.RegionYLocation < lower_y) LowerYChanged(Location.RegionYLocation);
134 if (Location.RegionYLocation > upper_y) UpperYChanged(Location.RegionYLocation);
136}
137
AreaCalculator(QObject *parent=nullptr)
void SendWorldArea(REMOTE_WORLD_SIZE WorldArea)
void WorldXChanged(int NewValue)
void SendWorldSides(REMOTE_WORLD_SIDES world_sides)
void UpperXChanged(int NewValue)
void CalculateWorldArea(void)
void LowerYChanged(int NewValue)
void IncludeNewRegion(REMOTE_REGION_ADDRESS Location)
void SendLogEntry(REMOTE_LOG_ENTRY LogEntry)
Send Log Entry via the Signal-Slot Method.
void Regionx16Pressed(void)
void UpperYChanged(int NewValue)
void FindWorldLimits(void)
void WorldYChanged(int NewValue)
void Regionx1Pressed(void)
void LogAdd(LOGGING_SEVERITY Severity, LOGGING_MODE Mode, QString Message)
void AutoCalcChanged(Qt::CheckState)
void LowerXChanged(int NewValue)
void Regionx4Pressed(void)
LOGGING_SEVERITY
Log Severity allow the selection of logging events based on Severity.
Definition logger.h:48
LOGGING_MODE
Log Severity allow the selection of logging events based on the mode.
Definition logger.h:21
Definition logger.h:60
LOGGING_MODE Mode
Definition logger.h:61
QString Message
Definition logger.h:63
LOGGING_SEVERITY Severity
Definition logger.h:62