Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 27454b8

Browse files
authored
Merge pull request #181 from HeliumAnt/linux-meson-build
Linux Build
2 parents ff9b2d0 + 844075d commit 27454b8

File tree

525 files changed

+115620
-492
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

525 files changed

+115620
-492
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
*.vs
88
*.APS
99

10+
compile_commands.json
11+
/.ccls-cache
12+
13+
/build
14+
1015
/_Bin
1116
/NATPunchServer/Server/NATCompleteServer/Debug
1217
/NATPunchServer/Server/NATCompleteServer/Release
1318
/Documentation/Doxygen/Output
14-
MemCleanupInfo.txt
19+
MemCleanupInfo.txt

Activities/GABaseDefense.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ int GABaseDefense::Start()
261261
DisableAIs(m_ActivityState == ActivityState::Editing);
262262

263263
// Set the spawn intervals based ont he min-max and the currently difficulty
264-
m_SpawnInterval = floorf(LERP(DifficultySetting::MinDifficulty, DifficultySetting::MaxDifficulty, m_SpawnIntervalEasiest, m_SpawnIntervalHardest, m_Difficulty));
264+
m_SpawnInterval = std::floor(LERP(DifficultySetting::MinDifficulty, DifficultySetting::MaxDifficulty, m_SpawnIntervalEasiest, m_SpawnIntervalHardest, m_Difficulty));
265265

266266
m_SpawnTimer.Reset();
267267

Activities/GAMetaAttack.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
//////////////////////////////////////////////////////////////////////////////////////////
1515
// Inclusions of header files
1616

17-
#include <string>
1817
#include "GameActivity.h"
1918

2019
namespace RTE
@@ -261,4 +260,4 @@ ENTITYALLOCATION(GAMetaAttack)
261260

262261
} // namespace RTE
263262

264-
#endif // File
263+
#endif // File

Activities/GATutorial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ int GATutorial::Start()
269269
{
270270
// See if there are specified landing zone areas defined in the scene
271271
char str[64];
272-
sprintf_s(str, sizeof(str), "LZ Team %d", team + 1);
272+
std::snprintf(str, sizeof(str), "LZ Team %d", team + 1);
273273
Scene::Area *pArea = g_SceneMan.GetScene()->GetArea(str);
274274
// pArea = pArea ? pArea : g_SceneMan.GetScene()->GetArea("Landing Zone");
275275
// If area is defined, save a copy so we can lock the LZ selection to within its boxes
@@ -589,7 +589,7 @@ void GATutorial::Update()
589589
{
590590
if (!m_AttackerSpawns.empty())
591591
{
592-
int whichSpawn = floorf(m_AttackerSpawns.size() * RandomNum());
592+
int whichSpawn = std::floor(m_AttackerSpawns.size() * RandomNum());
593593
Actor *pSpawn = dynamic_cast<Actor *>(m_AttackerSpawns[whichSpawn]->Clone());
594594
if (pSpawn)
595595
{

Activities/GameActivity.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ int GameActivity::Start()
849849
/* This is taken care of by the individual Activity logic
850850
// See if there are specified landing zone areas defined in the scene
851851
char str[64];
852-
sprintf_s(str, sizeof(str), "LZ Team %d", team + 1);
852+
std::snprintf(str, sizeof(str), "LZ Team %d", team + 1);
853853
Scene::Area *pArea = g_SceneMan.GetScene()->GetArea(str);
854854
pArea = pArea ? pArea : g_SceneMan.GetScene()->GetArea("Landing Zone");
855855
// If area is defined, save a copy so we can lock the LZ selection to within its boxes
@@ -2054,7 +2054,7 @@ void GameActivity::Update()
20542054
if (m_MessageTimer[player].IsPastSimMS(1000))
20552055
{
20562056
char message[512];
2057-
sprintf_s(message, sizeof(message), "Next delivery in %i secs", ((int)m_Deliveries[team].front().delay - (int)m_Deliveries[team].front().timer.GetElapsedSimTimeMS()) / 1000);
2057+
std::snprintf(message, sizeof(message), "Next delivery in %i secs", ((int)m_Deliveries[team].front().delay - (int)m_Deliveries[team].front().timer.GetElapsedSimTimeMS()) / 1000);
20582058
g_FrameMan.SetScreenText(message, ScreenOfPlayer(player));
20592059
m_MessageTimer[player].Reset();
20602060
}
@@ -2197,9 +2197,9 @@ void GameActivity::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int w
21972197
// Text
21982198
pSmallFont->DrawAligned(&pBitmapInt, landZone.m_X, landZone.m_Y - 38, "ETA:", GUIFont::Centre);
21992199
if (m_ActivityState == ActivityState::PreGame)
2200-
sprintf_s(str, sizeof(str), "???s");
2200+
std::snprintf(str, sizeof(str), "???s");
22012201
else
2202-
sprintf_s(str, sizeof(str), "%is", ((int)itr->delay - (int)itr->timer.GetElapsedSimTimeMS()) / 1000);
2202+
std::snprintf(str, sizeof(str), "%is", ((int)itr->delay - (int)itr->timer.GetElapsedSimTimeMS()) / 1000);
22032203
pLargeFont->DrawAligned(&pBitmapInt, landZone.m_X, landZone.m_Y - 32, str, GUIFont::Centre);
22042204
// Draw wrap around the world if necessary, and only if this is being drawn directly to a scenewide target bitmap
22052205
if (targetPos.IsZero() && (landZone.m_X < halfWidth || landZone.m_X > g_SceneMan.GetSceneWidth() - halfWidth))
@@ -2319,11 +2319,11 @@ void GameActivity::DrawGUI(BITMAP *pTargetBitmap, const Vector &targetPos, int w
23192319
if (pIcon)
23202320
draw_sprite(pTargetBitmap, pIcon->GetBitmaps8()[0], MAX(2, g_SceneMan.GetScreenOcclusion(which).m_X + 2), 2);
23212321
// Gold
2322-
sprintf_s(str, sizeof(str), "%c Funds: %.0f oz", TeamFundsChanged(which) ? -57 : -58, GetTeamFunds(m_Team[PoS]));
2322+
std::snprintf(str, sizeof(str), "%c Funds: %.0f oz", TeamFundsChanged(which) ? -57 : -58, GetTeamFunds(m_Team[PoS]));
23232323
g_FrameMan.GetLargeFont()->DrawAligned(&pBitmapInt, MAX(16, g_SceneMan.GetScreenOcclusion(which).m_X + 16), yTextPos, str, GUIFont::Left);
23242324
/* Not applicable anymore to the 4-team games
23252325
// Body losses
2326-
sprintf_s(str, sizeof(str), "%c Losses: %c%i %c%i", -39, -62, GetTeamDeathCount(Teams::TeamOne), -59, GetTeamDeathCount(Teams::TeamTwo));
2326+
std::snprintf(str, sizeof(str), "%c Losses: %c%i %c%i", -39, -62, GetTeamDeathCount(Teams::TeamOne), -59, GetTeamDeathCount(Teams::TeamTwo));
23272327
g_FrameMan.GetLargeFont()->DrawAligned(&pBitmapInt, MIN(pTargetBitmap->w - 4, pTargetBitmap->w - 4 + g_SceneMan.GetScreenOcclusion(which).m_X), yTextPos, str, GUIFont::Right);
23282328
*/
23292329
// Show the player's controller scheme icon in the upper right corner of his screen, but only for a minute
@@ -2591,9 +2591,9 @@ void GameActivity::Draw(BITMAP *pTargetBitmap, const Vector &targetPos)
25912591
// Text
25922592
pSmallFont->DrawAligned(&pBitmapInt, landZone.m_X, landZone.m_Y - 38, "ETA:", GUIFont::Centre);
25932593
if (m_ActivityState == ActivityState::PreGame)
2594-
sprintf_s(str, sizeof(str), "???s");
2594+
std::snprintf(str, sizeof(str), "???s");
25952595
else
2596-
sprintf_s(str, sizeof(str), "%is", ((int)itr->delay - (int)itr->timer.GetElapsedSimTimeMS()) / 1000);
2596+
std::snprintf(str, sizeof(str), "%is", ((int)itr->delay - (int)itr->timer.GetElapsedSimTimeMS()) / 1000);
25972597
pLargeFont->DrawAligned(&pBitmapInt, landZone.m_X, landZone.m_Y - 32, str, GUIFont::Centre);
25982598
// Draw wrap around the world if necessary, and only if this is being drawn directly to a scenewide target bitmap
25992599
if (targetPos.IsZero() && (landZone.m_X < halfWidth || landZone.m_X > g_SceneMan.GetSceneWidth() - halfWidth))

Activities/MultiplayerGame.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ namespace RTE {
328328
}
329329

330330
if (saveSettings)
331-
g_SettingsMan.Save(Writer("Base.rte/Settings.ini"));
331+
g_SettingsMan.UpdateSettingsFile();
332332

333333
m_pGUIController->EnableMouse(false);
334334
m_Mode = CONNECTION;
@@ -392,7 +392,7 @@ namespace RTE {
392392
}
393393

394394
if (saveSettings)
395-
g_SettingsMan.Save(Writer("Base.rte/Settings.ini"));
395+
g_SettingsMan.UpdateSettingsFile();
396396

397397
m_pGUIController->EnableMouse(false);
398398
m_Mode = CONNECTION;
@@ -473,4 +473,4 @@ namespace RTE {
473473
Activity::Draw(pTargetBitmap, targetPos);
474474
}
475475

476-
} // namespace RTE
476+
} // namespace RTE

Activities/MultiplayerServerLobby.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ namespace RTE {
255255
for (int team = Teams::TeamOne; team < TEAMROWCOUNT; ++team)
256256
{
257257
// +1 because the controls are indexed starting at 1, not 0
258-
sprintf_s(str, sizeof(str), "P%dT%dBox", player + 1, team + 1);
258+
std::snprintf(str, sizeof(str), "P%dT%dBox", player + 1, team + 1);
259259
m_aapPlayerBoxes[player][team] = dynamic_cast<GUICollectionBox *>(m_pGUIController->GetControl(str));
260260
}
261261
}
@@ -765,7 +765,7 @@ namespace RTE {
765765
if (!pIcon)
766766
{
767767
char str[128];
768-
sprintf_s(str, sizeof(str), "Team %d Default", team + 1);
768+
std::snprintf(str, sizeof(str), "Team %d Default", team + 1);
769769
pIcon = dynamic_cast<const Icon *>(g_PresetMan.GetEntityPreset("Icon", str));
770770
}
771771
m_apTeamNameLabels[team]->SetText(pActivity->GetTeamName(team) + ":");
@@ -828,7 +828,7 @@ namespace RTE {
828828
m_pStartScenarioButton->SetVisible(false);
829829
m_pStartErrorLabel->SetVisible(true);
830830
char str[256];
831-
sprintf_s(str, sizeof(str), "Too many players assigned! Max for this activity is %d", pGameActivity->GetMaxPlayerSupport());
831+
std::snprintf(str, sizeof(str), "Too many players assigned! Max for this activity is %d", pGameActivity->GetMaxPlayerSupport());
832832
m_pStartErrorLabel->SetText(str);
833833
}
834834
// If we are under the required number of teams with players assigned, disable the start button and show why
@@ -837,7 +837,7 @@ namespace RTE {
837837
m_pStartScenarioButton->SetVisible(false);
838838
m_pStartErrorLabel->SetVisible(true);
839839
char str[256];
840-
sprintf_s(str, sizeof(str), "Assign players to at\nleast %d of the teams!", pGameActivity->GetMinTeamsRequired());
840+
std::snprintf(str, sizeof(str), "Assign players to at\nleast %d of the teams!", pGameActivity->GetMinTeamsRequired());
841841
m_pStartErrorLabel->SetText(str);
842842
}
843843
// Assign at least one human player
@@ -860,9 +860,9 @@ namespace RTE {
860860
int startGold = m_pGoldSlider->GetValue();
861861
startGold = startGold - startGold % 500;
862862
if (m_pGoldSlider->GetValue() == m_pGoldSlider->GetMaximum())
863-
sprintf_s(str, sizeof(str), "Starting Gold: %c Infinite", -58);
863+
std::snprintf(str, sizeof(str), "Starting Gold: %c Infinite", -58);
864864
else
865-
sprintf_s(str, sizeof(str), "Starting Gold: %c %d oz", -58, startGold);
865+
std::snprintf(str, sizeof(str), "Starting Gold: %c %d oz", -58, startGold);
866866
m_pGoldLabel->SetText(str);
867867

868868

@@ -1168,7 +1168,7 @@ namespace RTE {
11681168
m_pGUIInput->GetMousePosition(&x, &y);
11691169
11701170
char buf[256];
1171-
sprintf_s(buf, sizeof(buf), "MB-%d%d%d MS-%d%d%d %d - %d", states[0], states[1], states[2], events[0], events[1], events[2], x, y);
1171+
std::snprintf(buf, sizeof(buf), "MB-%d%d%d MS-%d%d%d %d - %d", states[0], states[1], states[2], events[0], events[1], events[2], x, y);
11721172
11731173
result = result + buf;
11741174
g_FrameMan.SetScreenText(result, 0, 0, -1, false);

Activities/meson.build

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sources += files('ActorEditor.cpp',
2+
'AreaEditor.cpp',
3+
'AssemblyEditor.cpp',
4+
'BaseEditor.cpp',
5+
'EditorActivity.cpp',
6+
'GABaseDefense.cpp',
7+
'GABrainMatch.cpp',
8+
'GAScripted.cpp',
9+
'GATutorial.cpp',
10+
'GameActivity.cpp',
11+
'GibEditor.cpp',
12+
'MultiplayerGame.cpp',
13+
'MultiplayerServerLobby.cpp',
14+
'SceneEditor.cpp')

Entities/ACDropShip.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,11 +1170,11 @@ void ACDropShip::Draw(BITMAP *pTargetBitmap,
11701170
{
11711171
#ifdef DEBUG_BUILD
11721172
acquire_bitmap(pTargetBitmap);
1173-
putpixel(pTargetBitmap, floorf(m_Pos.m_X),
1174-
floorf(m_Pos.m_Y),
1173+
putpixel(pTargetBitmap, std::floor(m_Pos.m_X),
1174+
std::floor(m_Pos.m_Y),
11751175
64);
1176-
putpixel(pTargetBitmap, floorf(m_Pos.m_X),
1177-
floorf(m_Pos.m_Y),
1176+
putpixel(pTargetBitmap, std::floor(m_Pos.m_X),
1177+
std::floor(m_Pos.m_Y),
11781178
64);
11791179
release_bitmap(pTargetBitmap);
11801180

Entities/ACRocket.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,6 @@ void ACRocket::Update()
10371037
}
10381038
else if (m_HatchState == CLOSING) {
10391039
if (m_HatchTimer.GetElapsedSimTimeMS() <= m_HatchDelay && m_HatchDelay)
1040-
10411040
m_Frame = lastFrame - static_cast<unsigned int>(static_cast<double>(lastFrame) * (m_HatchTimer.GetElapsedSimTimeMS() / static_cast<double>(m_HatchDelay)));
10421041
else
10431042
{
@@ -1243,11 +1242,11 @@ void ACRocket::Draw(BITMAP *pTargetBitmap,
12431242
if (mode == g_DrawColor) {
12441243
#ifdef DEBUG_BUILD
12451244
acquire_bitmap(pTargetBitmap);
1246-
putpixel(pTargetBitmap, floorf(m_Pos.m_X),
1247-
floorf(m_Pos.m_Y),
1245+
putpixel(pTargetBitmap, std::floor(m_Pos.m_X),
1246+
std::floor(m_Pos.m_Y),
12481247
64);
1249-
putpixel(pTargetBitmap, floorf(m_Pos.m_X),
1250-
floorf(m_Pos.m_Y),
1248+
putpixel(pTargetBitmap, std::floor(m_Pos.m_X),
1249+
std::floor(m_Pos.m_Y),
12511250
64);
12521251
release_bitmap(pTargetBitmap);
12531252

0 commit comments

Comments
 (0)