mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-05-06 11:41:42 -04:00
commit
11c7110736
92 changed files with 6603 additions and 7548 deletions
36
.github/workflows/verify.yml
vendored
Normal file
36
.github/workflows/verify.yml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
name: Basic verify
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "!main", "!RN", "*" ]
|
||||
|
||||
jobs:
|
||||
compile-check:
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
CONFIGURATION: Debug
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: recursive
|
||||
- name: Change configuration to debug for PR
|
||||
if: github.event_name == 'pull_request'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "CONFIGURATION=FinalAlertDebug YR" >> $GITHUB_ENV
|
||||
mkdir Debug || true
|
||||
|
||||
- name: setup-msvc
|
||||
uses: egor-tensin/vs-shell@v2
|
||||
with:
|
||||
# Target architecture
|
||||
arch: x64
|
||||
- name: build-msvc
|
||||
run: |
|
||||
devenv.com "MissionEditor.sln" /Build "${{ env.CONFIGURATION }}|x64" /project UnitTest
|
||||
- name: do UT
|
||||
run: |
|
||||
cd x64\Debug
|
||||
./UnitTest
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -42,9 +42,6 @@ build_*/
|
|||
*.ncb
|
||||
*.sdf
|
||||
*.suo
|
||||
*.sln
|
||||
*.vcxproj
|
||||
*.filters
|
||||
*.aps
|
||||
|
||||
# CMake
|
||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "gtest-lib"]
|
||||
path = googletest
|
||||
url = ../gtest-lib.git
|
1
3rdParty/xcc/Library/StdAfx.h
vendored
1
3rdParty/xcc/Library/StdAfx.h
vendored
|
@ -32,6 +32,7 @@
|
|||
#include <span>
|
||||
#include <string>
|
||||
#include <vartypes.h>
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <xcc/data_ref.h>
|
||||
#include <xcc/find_ptr.h>
|
||||
|
|
130
3rdParty/xcc/Library/XCC Library.vcxproj
vendored
130
3rdParty/xcc/Library/XCC Library.vcxproj
vendored
|
@ -5,18 +5,34 @@
|
|||
<Configuration>DebugMinimal</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DebugMinimal|x64">
|
||||
<Configuration>DebugMinimal</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ReleaseMinimal|Win32">
|
||||
<Configuration>ReleaseMinimal</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ReleaseMinimal|x64">
|
||||
<Configuration>ReleaseMinimal</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}</ProjectGuid>
|
||||
|
@ -34,6 +50,15 @@
|
|||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMinimal|Win32'" Label="Configuration">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
|
@ -43,6 +68,15 @@
|
|||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMinimal|x64'" Label="Configuration">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
|
@ -51,6 +85,14 @@
|
|||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMinimal|Win32'" Label="Configuration">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
|
@ -59,6 +101,14 @@
|
|||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMinimal|x64'" Label="Configuration">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="XCC">
|
||||
<XCC_MINIMAL_BUILD>
|
||||
</XCC_MINIMAL_BUILD>
|
||||
|
@ -86,18 +136,34 @@
|
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\XCC.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\XCC.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMinimal|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\XCC.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMinimal|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\XCC.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\XCC.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\XCC.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugMinimal|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\XCC.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugMinimal|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\XCC.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
|
@ -120,6 +186,21 @@
|
|||
<Culture>0x0413</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;WIN32;_LIB;$(XCC_MINIMAL_BUILD);$(NO_FT_SUPPORT);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0413</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugMinimal|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
|
@ -135,6 +216,21 @@
|
|||
<Culture>0x0413</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugMinimal|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;WIN32;_LIB;$(XCC_MINIMAL_BUILD);$(NO_FT_SUPPORT);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0413</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;_LIB;$(XCC_MINIMAL_BUILD);$(NO_FT_SUPPORT);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -150,6 +246,21 @@
|
|||
<Culture>0x0413</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;_LIB;$(XCC_MINIMAL_BUILD);$(NO_FT_SUPPORT);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0413</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMinimal|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;_LIB;$(XCC_MINIMAL_BUILD);$(NO_FT_SUPPORT);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -165,6 +276,21 @@
|
|||
<Culture>0x0413</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMinimal|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;WIN32;_LIB;$(XCC_MINIMAL_BUILD);$(NO_FT_SUPPORT);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0413</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\misc\aud_decode.cpp">
|
||||
<ExcludedFromBuild Condition="'$(XCC_MINIMAL_BUILD)'!=''">true</ExcludedFromBuild>
|
||||
|
@ -350,9 +476,13 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugMinimal|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugMinimal|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='ReleaseMinimal|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='ReleaseMinimal|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\misc\string_conversion.cpp">
|
||||
</ClCompile>
|
||||
|
|
12
3rdParty/xcc/misc/blowfish.cpp
vendored
12
3rdParty/xcc/misc/blowfish.cpp
vendored
|
@ -385,15 +385,9 @@ void Cblowfish::decipher(uint32_t& xl, uint32_t& xr) const
|
|||
|
||||
static uint32_t reverse(uint32_t v)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
mov eax, v
|
||||
xchg al, ah
|
||||
rol eax, 16
|
||||
xchg al, ah
|
||||
mov v, eax
|
||||
}
|
||||
return v;
|
||||
uint32_t result = ((v & 0x00FF00FF) << 8) | ((v & 0xFF00FF00) >> 8);
|
||||
result = (result << 16) | (result >> 16);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Cblowfish::encipher(const void* s, void* d, int size) const
|
||||
|
|
1
3rdParty/xcc/misc/blowfish.h
vendored
1
3rdParty/xcc/misc/blowfish.h
vendored
|
@ -19,6 +19,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <vartypes.h>
|
||||
#include <xcc/data_ref.h>
|
||||
|
||||
class Cblowfish
|
||||
{
|
||||
|
|
15
3rdParty/xcc/misc/cc_structures.h
vendored
15
3rdParty/xcc/misc/cc_structures.h
vendored
|
@ -43,17 +43,12 @@ enum t_game
|
|||
|
||||
const char* game_name[];
|
||||
|
||||
inline __int32 reverse(__int32 v)
|
||||
|
||||
static int32_t reverse(int32_t v)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
mov eax, v
|
||||
xchg al, ah
|
||||
rol eax, 16
|
||||
xchg al, ah
|
||||
mov v, eax
|
||||
}
|
||||
return v;
|
||||
uint32_t result = ((v & 0x00FF00FF) << 8) | ((v & 0xFF00FF00) >> 8);
|
||||
result = (result << 16) | (result >> 16);
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
|
2
3rdParty/xcc/misc/mix_file.h
vendored
2
3rdParty/xcc/misc/mix_file.h
vendored
|
@ -48,7 +48,7 @@ public:
|
|||
m_mix_expansion = true;
|
||||
}
|
||||
|
||||
int get_c_files() const
|
||||
auto get_c_files() const
|
||||
{
|
||||
return m_index.size();
|
||||
}
|
||||
|
|
348
3rdParty/xcc/misc/shp_decode.cpp
vendored
348
3rdParty/xcc/misc/shp_decode.cpp
vendored
|
@ -377,45 +377,47 @@ static void write_v80(byte v, int count, byte*& d)
|
|||
}
|
||||
}
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
void get_same(const byte* s, const byte* r, const byte* s_end, byte*& p, int& cb_p)
|
||||
{
|
||||
_asm
|
||||
{
|
||||
push esi
|
||||
push edi
|
||||
mov eax, s_end
|
||||
mov ebx, s
|
||||
xor ecx, ecx
|
||||
mov edi, p
|
||||
mov [edi], ecx
|
||||
dec ebx
|
||||
const byte* s_end_ptr = s_end;
|
||||
const byte* s_ptr = s;
|
||||
int ecx_value = 0;
|
||||
byte* edi_ptr = p;
|
||||
*edi_ptr = static_cast<byte>(ecx_value);
|
||||
s_ptr--;
|
||||
|
||||
next_s:
|
||||
inc ebx
|
||||
xor edx, edx
|
||||
mov esi, r
|
||||
mov edi, ebx
|
||||
cmp edi, esi
|
||||
jnb end0
|
||||
s_ptr++;
|
||||
int edx_value = 0;
|
||||
const byte* esi_ptr = r;
|
||||
const byte* edi_val = s_ptr;
|
||||
if (edi_val >= esi_ptr)
|
||||
goto end0;
|
||||
|
||||
next0:
|
||||
inc edx
|
||||
cmp esi, eax
|
||||
jnb end_line
|
||||
cmpsb
|
||||
je next0
|
||||
edx_value++;
|
||||
if (esi_ptr >= s_end_ptr)
|
||||
goto end_line;
|
||||
|
||||
if (*esi_ptr == *s_ptr)
|
||||
goto next0;
|
||||
|
||||
end_line:
|
||||
dec edx
|
||||
cmp edx, ecx
|
||||
jl next_s
|
||||
mov ecx, edx
|
||||
mov edi, p
|
||||
mov [edi], ebx
|
||||
jmp next_s
|
||||
edx_value--;
|
||||
if (edx_value < ecx_value)
|
||||
goto next_s;
|
||||
|
||||
ecx_value = edx_value;
|
||||
edi_ptr = p;
|
||||
*edi_ptr = static_cast<byte>(*s_ptr);
|
||||
goto next_s;
|
||||
|
||||
end0:
|
||||
mov edi, cb_p
|
||||
mov [edi], ecx
|
||||
pop edi
|
||||
pop esi
|
||||
}
|
||||
edi_ptr = reinterpret_cast<byte*>(& cb_p);
|
||||
*edi_ptr = ecx_value;
|
||||
// Restore registers
|
||||
}
|
||||
|
||||
static void write80_c0(byte*& w, int count, int p)
|
||||
|
@ -617,162 +619,144 @@ int decode80c(const byte image_in[], byte image_out[], int cb_in)
|
|||
return (w - image_out);
|
||||
}
|
||||
|
||||
int decode80(const byte image_in[], byte image_out[])
|
||||
int __fastcall decode80(const byte image_in[], byte image_out[])
|
||||
{
|
||||
int cb_out;
|
||||
/*
|
||||
0 copy 0cccpppp p
|
||||
1 copy 10cccccc
|
||||
2 copy 11cccccc p p
|
||||
3 fill 11111110 c c v
|
||||
4 copy 11111111 c c p p
|
||||
*/
|
||||
|
||||
_asm
|
||||
byte* i; // edi
|
||||
unsigned int v4; // eax
|
||||
const byte* v5; // esi
|
||||
unsigned int v6; // ecx
|
||||
int v7; // eax
|
||||
const byte* v8; // edx
|
||||
byte* v9; // esi
|
||||
unsigned int v10; // ecx
|
||||
unsigned int v11; // eax
|
||||
const byte* v12; // esi
|
||||
unsigned int v13; // ecx
|
||||
char v14; // al
|
||||
|
||||
for (i = image_out; ; i += v10)
|
||||
{
|
||||
push esi
|
||||
push edi
|
||||
mov ax, ds
|
||||
mov es, ax
|
||||
mov esi, image_in
|
||||
mov edi, image_out
|
||||
next0:
|
||||
xor eax, eax
|
||||
lodsb
|
||||
mov ecx, eax
|
||||
test eax, 0x80
|
||||
jnz c1c
|
||||
shr ecx, 4
|
||||
add ecx, 3
|
||||
and eax, 0xf
|
||||
shl eax, 8
|
||||
lodsb
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
sub esi, eax
|
||||
jmp copy_from_destination
|
||||
c1c:
|
||||
and ecx, 0x3f
|
||||
test eax, 0x40
|
||||
jnz c2c
|
||||
or ecx, ecx
|
||||
jz end0
|
||||
jmp copy_from_source
|
||||
c2c:
|
||||
xor eax, eax
|
||||
lodsw
|
||||
cmp ecx, 0x3e
|
||||
je c3
|
||||
ja c4
|
||||
mov edx, esi
|
||||
mov esi, image_out
|
||||
add esi, eax
|
||||
add ecx, 3
|
||||
jmp copy_from_destination
|
||||
c3:
|
||||
mov ecx, eax
|
||||
lodsb
|
||||
rep stosb
|
||||
jmp next0
|
||||
c4:
|
||||
mov ecx, eax
|
||||
lodsw
|
||||
mov edx, esi
|
||||
mov esi, image_out
|
||||
add esi, eax
|
||||
copy_from_destination:
|
||||
rep movsb
|
||||
mov esi, edx
|
||||
jmp next0
|
||||
copy_from_source:
|
||||
rep movsb
|
||||
jmp next0
|
||||
end0:
|
||||
sub edi, image_out
|
||||
mov cb_out, edi
|
||||
pop edi
|
||||
pop esi
|
||||
while (1)
|
||||
{
|
||||
v4 = (unsigned __int8)*image_in;
|
||||
v5 = image_in + 1;
|
||||
if ((v4 & 0x80) == 0)
|
||||
{
|
||||
v6 = (v4 >> 4) + 3;
|
||||
v7 = (v4 & 0xF) << 8;
|
||||
v7 |= static_cast<unsigned char>(*v5);
|
||||
v8 = v5 + 1;
|
||||
v9 = &i[-v7];
|
||||
goto copy_from_destination;
|
||||
}
|
||||
v10 = v4 & 0x3F;
|
||||
if ((v4 & 0x40) == 0)
|
||||
break;
|
||||
v11 = *(unsigned __int16*)v5;
|
||||
v12 = v5 + 2;
|
||||
if (v10 == 62)
|
||||
{
|
||||
v13 = v11;
|
||||
v14 = *v12;
|
||||
image_in = v12 + 1;
|
||||
memset(i, v14, v13);
|
||||
i += v13;
|
||||
} else
|
||||
{
|
||||
if (v10 > 0x3E)
|
||||
{
|
||||
v6 = v11;
|
||||
v11 = *reinterpret_cast<const int16_t*>(v12);
|
||||
v8 = v12 + 2;
|
||||
v9 = &image_out[v11];
|
||||
} else
|
||||
{
|
||||
v8 = v12;
|
||||
v9 = &image_out[v11];
|
||||
v6 = v10 + 3;
|
||||
}
|
||||
copy_from_destination:
|
||||
memcpy(i, v9, v6);
|
||||
i += v6;
|
||||
image_in = v8;
|
||||
}
|
||||
}
|
||||
if ((v4 & 0x3F) == 0)
|
||||
break;
|
||||
memcpy(i, v5, v10);
|
||||
image_in = &v5[v10];
|
||||
}
|
||||
return cb_out;
|
||||
return i - image_out;
|
||||
}
|
||||
|
||||
int decode80r(const byte image_in[], byte image_out[])
|
||||
int __fastcall decode80r(const byte image_in[], byte image_out[])
|
||||
{
|
||||
int cb_out;
|
||||
/*
|
||||
0 copy 0cccpppp p
|
||||
1 copy 10cccccc
|
||||
2 copy 11cccccc p p
|
||||
3 fill 11111110 c c v
|
||||
4 copy 11111111 c c p p
|
||||
*/
|
||||
|
||||
_asm
|
||||
byte* i; // edi
|
||||
unsigned int v4; // eax
|
||||
const byte* v5; // esi
|
||||
unsigned int v6; // ecx
|
||||
int v7; // eax
|
||||
const byte* v8; // edx
|
||||
byte* v9; // esi
|
||||
unsigned int v10; // ecx
|
||||
unsigned int v11; // eax
|
||||
const byte* v12; // esi
|
||||
unsigned int v13; // ecx
|
||||
char v14; // al
|
||||
|
||||
for (i = image_out; ; i += v10)
|
||||
{
|
||||
push esi
|
||||
push edi
|
||||
mov ax, ds
|
||||
mov es, ax
|
||||
mov esi, image_in
|
||||
mov edi, image_out
|
||||
next0:
|
||||
xor eax, eax
|
||||
lodsb
|
||||
mov ecx, eax
|
||||
test eax, 0x80
|
||||
jnz c1c
|
||||
shr ecx, 4
|
||||
add ecx, 3
|
||||
and eax, 0xf
|
||||
shl eax, 8
|
||||
lodsb
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
sub esi, eax
|
||||
jmp copy_from_destination
|
||||
c1c:
|
||||
and ecx, 0x3f
|
||||
test eax, 0x40
|
||||
jnz c2c
|
||||
or ecx, ecx
|
||||
jz end0
|
||||
jmp copy_from_source
|
||||
c2c:
|
||||
xor eax, eax
|
||||
lodsw
|
||||
cmp ecx, 0x3e
|
||||
je c3
|
||||
ja c4
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
sub esi, eax
|
||||
add ecx, 3
|
||||
jmp copy_from_destination
|
||||
c3:
|
||||
mov ecx, eax
|
||||
lodsb
|
||||
rep stosb
|
||||
jmp next0
|
||||
c4:
|
||||
mov ecx, eax
|
||||
lodsw
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
sub esi, eax
|
||||
copy_from_destination:
|
||||
rep movsb
|
||||
mov esi, edx
|
||||
jmp next0
|
||||
copy_from_source:
|
||||
rep movsb
|
||||
jmp next0
|
||||
end0:
|
||||
sub edi, image_out
|
||||
mov cb_out, edi
|
||||
pop edi
|
||||
pop esi
|
||||
while (1)
|
||||
{
|
||||
v4 = (unsigned __int8)*image_in;
|
||||
v5 = image_in + 1;
|
||||
if ((v4 & 0x80) == 0)
|
||||
{
|
||||
v6 = (v4 >> 4) + 3;
|
||||
v7 = (v4 & 0xF) << 8;
|
||||
v7 |= static_cast<unsigned char>(*v5);
|
||||
v8 = v5 + 1;
|
||||
v9 = &i[-v7];
|
||||
goto copy_from_destination;
|
||||
}
|
||||
v10 = v4 & 0x3F;
|
||||
if ((v4 & 0x40) == 0)
|
||||
break;
|
||||
v11 = *(unsigned __int16*)v5;
|
||||
v12 = v5 + 2;
|
||||
if (v10 == 62)
|
||||
{
|
||||
v13 = v11;
|
||||
v14 = *v12;
|
||||
image_in = v12 + 1;
|
||||
memset(i, v14, v13);
|
||||
i += v13;
|
||||
} else
|
||||
{
|
||||
if (v10 > 0x3E)
|
||||
{
|
||||
v6 = v11;
|
||||
v11 = *reinterpret_cast<const int16_t*>(v12);
|
||||
v8 = v12 + 2;
|
||||
v9 = &i[-v11];
|
||||
} else
|
||||
{
|
||||
v8 = v12;
|
||||
v9 = &i[-v11];
|
||||
v6 = v10 + 3;
|
||||
}
|
||||
copy_from_destination:
|
||||
memcpy(i, v9, v6);
|
||||
i += v6;
|
||||
image_in = v8;
|
||||
}
|
||||
}
|
||||
if ((v4 & 0x3F) == 0)
|
||||
break;
|
||||
memcpy(i, v5, v10);
|
||||
image_in = &v5[v10];
|
||||
}
|
||||
return cb_out;
|
||||
return i - image_out;
|
||||
}
|
||||
|
||||
int decode2(const byte* s, byte* d, int cb_s, const byte* reference_palet)
|
||||
|
@ -1167,7 +1151,7 @@ int encode5(const byte* s, byte* d, int cb_s, int format)
|
|||
byte* w = d;
|
||||
while (r < r_end)
|
||||
{
|
||||
int cb_section = min(r_end - r, 8192);
|
||||
int cb_section = min<size_t>(r_end - r, 8192);
|
||||
t_pack_section_header& header = *reinterpret_cast<t_pack_section_header*>(w);
|
||||
w += sizeof(t_pack_section_header);
|
||||
w += header.size_in = format == 80 ? encode80(r, w, cb_section) : encode5s(r, w, cb_section);
|
||||
|
|
6
3rdParty/xcc/misc/tmp_ts_file.h
vendored
6
3rdParty/xcc/misc/tmp_ts_file.h
vendored
|
@ -34,7 +34,7 @@ public:
|
|||
bool is_valid() const
|
||||
{
|
||||
const t_tmp_ts_header& h = header();
|
||||
int size = get_size();
|
||||
auto const size = get_size();
|
||||
if (sizeof(t_tmp_ts_header) > size ||
|
||||
!h.cblocks_x || !h.cblocks_y ||
|
||||
h.cx != 48 && h.cx != 60 ||
|
||||
|
@ -183,8 +183,8 @@ public:
|
|||
|
||||
const byte* get_z_image(int i) const
|
||||
{
|
||||
int a = get_index()[i] + get_image_header(i)->z_ofs;
|
||||
int b = get_image(i) + get_cb_diamond() - data();
|
||||
auto const a = get_index()[i] + get_image_header(i)->z_ofs;
|
||||
auto const b = get_image(i) + get_cb_diamond() - data();
|
||||
assert(a == b);
|
||||
return data() + get_index()[i] + get_image_header(i)->z_ofs;
|
||||
}
|
||||
|
|
1
3rdParty/xcc/misc/vartypes.h
vendored
1
3rdParty/xcc/misc/vartypes.h
vendored
|
@ -1,3 +1,4 @@
|
|||
#pragma once
|
||||
/*
|
||||
XCC Utilities and Library
|
||||
Copyright (C) 2000 Olaf van der Spek <olafvdspek@gmail.com>
|
||||
|
|
2
3rdParty/xcc/misc/virtual_tfile.h
vendored
2
3rdParty/xcc/misc/virtual_tfile.h
vendored
|
@ -32,7 +32,7 @@ private:
|
|||
return reinterpret_cast<const char*>(m_data.data());
|
||||
}
|
||||
|
||||
int size() const
|
||||
auto size() const
|
||||
{
|
||||
return m_data.size();
|
||||
}
|
||||
|
|
2
3rdParty/xcc/misc/vxl_file.h
vendored
2
3rdParty/xcc/misc/vxl_file.h
vendored
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
int get_c_spans(int i) const
|
||||
{
|
||||
return get_section_tailer(i)->span_end_ofs - get_section_tailer(i)->span_start_ofs >> 2;
|
||||
return (get_section_tailer(i)->span_end_ofs - get_section_tailer(i)->span_start_ofs) >> 2;
|
||||
}
|
||||
|
||||
int get_c_section_tailers() const
|
||||
|
|
|
@ -15,66 +15,192 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MissionEditorPackLib", "Mis
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XCC Library", "3rdParty\xcc\Library\XCC Library.vcxproj", "{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{75E18879-7564-4A2C-8C00-393A5A17171F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
FinalAlertDebug YR|Win32 = FinalAlertDebug YR|Win32
|
||||
FinalAlertDebug YR|x64 = FinalAlertDebug YR|x64
|
||||
FinalAlertDebug|Win32 = FinalAlertDebug|Win32
|
||||
FinalAlertDebug|x64 = FinalAlertDebug|x64
|
||||
FinalAlertRelease YR|Win32 = FinalAlertRelease YR|Win32
|
||||
FinalAlertRelease YR|x64 = FinalAlertRelease YR|x64
|
||||
FinalAlertRelease|Win32 = FinalAlertRelease|Win32
|
||||
FinalAlertRelease|x64 = FinalAlertRelease|x64
|
||||
FinalSunDebug|Win32 = FinalSunDebug|Win32
|
||||
FinalSunDebug|x64 = FinalSunDebug|x64
|
||||
FinalSunRelease|Win32 = FinalSunRelease|Win32
|
||||
FinalSunRelease|x64 = FinalSunRelease|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
Template|Win32 = Template|Win32
|
||||
Template|x64 = Template|x64
|
||||
Tests FinalAlertDebug YR|Win32 = Tests FinalAlertDebug YR|Win32
|
||||
Tests FinalAlertDebug YR|x64 = Tests FinalAlertDebug YR|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Debug|Win32.ActiveCfg = Tests FinalAlertDebug YR|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Debug|Win32.Build.0 = Tests FinalAlertDebug YR|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Debug|x64.ActiveCfg = Tests FinalAlertDebug YR|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Debug|x64.Build.0 = Tests FinalAlertDebug YR|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertDebug YR|Win32.ActiveCfg = FinalAlertDebug YR|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertDebug YR|Win32.Build.0 = FinalAlertDebug YR|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertDebug YR|x64.ActiveCfg = FinalAlertDebug YR|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertDebug YR|x64.Build.0 = FinalAlertDebug YR|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertDebug|Win32.ActiveCfg = FinalAlertDebug|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertDebug|Win32.Build.0 = FinalAlertDebug|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertDebug|x64.ActiveCfg = FinalAlertDebug|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertDebug|x64.Build.0 = FinalAlertDebug|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertRelease YR|Win32.ActiveCfg = FinalAlertRelease YR|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertRelease YR|Win32.Build.0 = FinalAlertRelease YR|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertRelease YR|x64.ActiveCfg = FinalAlertRelease YR|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertRelease YR|x64.Build.0 = FinalAlertRelease YR|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertRelease|Win32.ActiveCfg = FinalAlertRelease|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertRelease|Win32.Build.0 = FinalAlertRelease|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertRelease|x64.ActiveCfg = FinalAlertRelease|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalAlertRelease|x64.Build.0 = FinalAlertRelease|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalSunDebug|Win32.ActiveCfg = FinalSunDebug|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalSunDebug|Win32.Build.0 = FinalSunDebug|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalSunDebug|x64.ActiveCfg = FinalSunDebug|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalSunDebug|x64.Build.0 = FinalSunDebug|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalSunRelease|Win32.ActiveCfg = FinalSunRelease|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalSunRelease|Win32.Build.0 = FinalSunRelease|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalSunRelease|x64.ActiveCfg = FinalSunRelease|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.FinalSunRelease|x64.Build.0 = FinalSunRelease|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Release|Win32.ActiveCfg = FinalSunRelease|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Release|Win32.Build.0 = FinalSunRelease|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Release|x64.ActiveCfg = FinalSunRelease|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Release|x64.Build.0 = FinalSunRelease|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Template|Win32.Build.0 = Template|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Template|x64.ActiveCfg = Template|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Template|x64.Build.0 = Template|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Tests FinalAlertDebug YR|Win32.ActiveCfg = Tests FinalAlertDebug YR|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Tests FinalAlertDebug YR|Win32.Build.0 = Tests FinalAlertDebug YR|Win32
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Tests FinalAlertDebug YR|x64.ActiveCfg = Tests FinalAlertDebug YR|x64
|
||||
{9326D29A-6547-42B9-A668-519F3C0720A9}.Tests FinalAlertDebug YR|x64.Build.0 = Tests FinalAlertDebug YR|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Debug|x64.Build.0 = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertDebug YR|Win32.ActiveCfg = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertDebug YR|Win32.Build.0 = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertDebug YR|x64.ActiveCfg = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertDebug YR|x64.Build.0 = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertDebug|Win32.Build.0 = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertDebug|x64.ActiveCfg = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertDebug|x64.Build.0 = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertRelease YR|Win32.ActiveCfg = Release|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertRelease YR|Win32.Build.0 = Release|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertRelease YR|x64.ActiveCfg = Release|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertRelease YR|x64.Build.0 = Release|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertRelease|Win32.ActiveCfg = Release|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertRelease|Win32.Build.0 = Release|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertRelease|x64.ActiveCfg = Release|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalAlertRelease|x64.Build.0 = Release|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalSunDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalSunDebug|Win32.Build.0 = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalSunDebug|x64.ActiveCfg = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalSunDebug|x64.Build.0 = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalSunRelease|Win32.ActiveCfg = Release|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalSunRelease|Win32.Build.0 = Release|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalSunRelease|x64.ActiveCfg = Release|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.FinalSunRelease|x64.Build.0 = Release|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Release|Win32.Build.0 = Release|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Release|x64.ActiveCfg = Release|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Release|x64.Build.0 = Release|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Template|Win32.ActiveCfg = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Template|Win32.Build.0 = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Template|x64.ActiveCfg = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Template|x64.Build.0 = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Tests FinalAlertDebug YR|Win32.ActiveCfg = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Tests FinalAlertDebug YR|Win32.Build.0 = Debug|Win32
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Tests FinalAlertDebug YR|x64.ActiveCfg = Debug|x64
|
||||
{DEB40EF0-E215-4C2F-A0AD-3742E2E01A8C}.Tests FinalAlertDebug YR|x64.Build.0 = Debug|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Debug|x64.Build.0 = Debug|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertDebug YR|Win32.ActiveCfg = DebugMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertDebug YR|Win32.Build.0 = DebugMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertDebug YR|x64.ActiveCfg = DebugMinimal|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertDebug YR|x64.Build.0 = DebugMinimal|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertDebug|Win32.ActiveCfg = DebugMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertDebug|Win32.Build.0 = DebugMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertDebug|x64.ActiveCfg = Debug|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertDebug|x64.Build.0 = Debug|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertRelease YR|Win32.ActiveCfg = ReleaseMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertRelease YR|Win32.Build.0 = ReleaseMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertRelease YR|x64.ActiveCfg = Release|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertRelease YR|x64.Build.0 = Release|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertRelease|Win32.ActiveCfg = ReleaseMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertRelease|Win32.Build.0 = ReleaseMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertRelease|x64.ActiveCfg = Release|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalAlertRelease|x64.Build.0 = Release|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalSunDebug|Win32.ActiveCfg = DebugMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalSunDebug|Win32.Build.0 = DebugMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalSunDebug|x64.ActiveCfg = Debug|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalSunDebug|x64.Build.0 = Debug|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalSunRelease|Win32.ActiveCfg = ReleaseMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalSunRelease|Win32.Build.0 = ReleaseMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalSunRelease|x64.ActiveCfg = Release|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.FinalSunRelease|x64.Build.0 = Release|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Release|Win32.Build.0 = Release|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Release|x64.ActiveCfg = Release|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Release|x64.Build.0 = Release|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Template|Win32.ActiveCfg = ReleaseMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Template|Win32.Build.0 = ReleaseMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Template|x64.ActiveCfg = DebugMinimal|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Template|x64.Build.0 = DebugMinimal|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Tests FinalAlertDebug YR|Win32.ActiveCfg = DebugMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Tests FinalAlertDebug YR|Win32.Build.0 = DebugMinimal|Win32
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Tests FinalAlertDebug YR|x64.ActiveCfg = Debug|x64
|
||||
{5E445578-CB45-4D82-9A1C-FC7D3E8D866A}.Tests FinalAlertDebug YR|x64.Build.0 = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Debug|x64.Build.0 = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertDebug YR|Win32.ActiveCfg = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertDebug YR|Win32.Build.0 = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertDebug YR|x64.ActiveCfg = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertDebug YR|x64.Build.0 = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertDebug|Win32.Build.0 = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertDebug|x64.ActiveCfg = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertDebug|x64.Build.0 = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertRelease YR|Win32.ActiveCfg = Release|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertRelease YR|Win32.Build.0 = Release|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertRelease YR|x64.ActiveCfg = Release|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertRelease YR|x64.Build.0 = Release|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertRelease|Win32.ActiveCfg = Release|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertRelease|Win32.Build.0 = Release|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertRelease|x64.ActiveCfg = Release|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalAlertRelease|x64.Build.0 = Release|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalSunDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalSunDebug|Win32.Build.0 = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalSunDebug|x64.ActiveCfg = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalSunDebug|x64.Build.0 = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalSunRelease|Win32.ActiveCfg = Release|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalSunRelease|Win32.Build.0 = Release|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalSunRelease|x64.ActiveCfg = Release|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.FinalSunRelease|x64.Build.0 = Release|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Release|Win32.Build.0 = Release|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Release|x64.ActiveCfg = Release|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Release|x64.Build.0 = Release|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Template|Win32.ActiveCfg = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Template|Win32.Build.0 = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Template|x64.ActiveCfg = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Template|x64.Build.0 = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Tests FinalAlertDebug YR|Win32.ActiveCfg = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Tests FinalAlertDebug YR|Win32.Build.0 = Debug|Win32
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Tests FinalAlertDebug YR|x64.ActiveCfg = Debug|x64
|
||||
{75E18879-7564-4A2C-8C00-393A5A17171F}.Tests FinalAlertDebug YR|x64.Build.0 = Debug|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -71,9 +71,10 @@ BOOL CAITriggerAddDlg::OnInitDialog()
|
|||
CListBox* lb=(CListBox*)GetDlgItem(IDC_AITRIGGERS);
|
||||
|
||||
int i;
|
||||
for(i=0;i<ai.sections["AITriggerTypes"].values.size();i++)
|
||||
{
|
||||
lb->AddString(*ai.sections["AITriggerTypes"].GetValueName(i)+ (CString)" " +GetParam(*ai.sections["AITriggerTypes"].GetValue(i), 0));
|
||||
for (i = 0; i < ai["AITriggerTypes"].Size(); i++) {
|
||||
auto const& section = ai.GetSection("AITriggerTypes");
|
||||
auto const& valuePair = section.Nth(i);
|
||||
lb->AddString(valuePair.first + (CString)" " + GetParam(valuePair.second, 0));
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
|
|
@ -151,122 +151,26 @@ END_MESSAGE_MAP()
|
|||
|
||||
void ListObjects(CComboBox& cb)
|
||||
{
|
||||
CComboBox& m_UnitType=cb;
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CComboBox& m_UnitType = cb;
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
int i;
|
||||
auto addToUnitTypeByIni = [&m_UnitType](CIniFile& ini, const CString& sectionName) {
|
||||
for (auto const& item : ini.GetSection(sectionName)) {
|
||||
auto const& type = item.second;
|
||||
auto const desc = type +
|
||||
" (" + Map->GetUnitName(type) + ")";
|
||||
m_UnitType.AddString(desc);
|
||||
}
|
||||
};
|
||||
auto addToUnitType = [&ini, &addToUnitTypeByIni](const CString& sectionName) {
|
||||
addToUnitTypeByIni(rules, sectionName);
|
||||
addToUnitTypeByIni(ini, sectionName);
|
||||
};
|
||||
|
||||
CString ss="InfantryTypes";
|
||||
for(i=0;i<rules.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*rules.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
for(i=0;i<ini.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
|
||||
ss="VehicleTypes";
|
||||
for(i=0;i<rules.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*rules.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
for(i=0;i<ini.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
|
||||
ss="AircraftTypes";
|
||||
for(i=0;i<rules.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*rules.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
for(i=0;i<ini.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
|
||||
ss="BuildingTypes";
|
||||
for(i=0;i<rules.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*rules.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
for(i=0;i<ini.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
addToUnitType("InfantryTypes");
|
||||
addToUnitType("VehicleTypes");
|
||||
addToUnitType("AircraftTypes");
|
||||
addToUnitType("BuildingTypes");
|
||||
}
|
||||
|
||||
void CAITriggerTypes::UpdateDialog()
|
||||
|
@ -347,9 +251,9 @@ void CAITriggerTypes::OnSelchangeAitriggertype()
|
|||
|
||||
m_Enabled=FALSE;
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
if(ini.sections["AITriggerTypesEnable"].values.find((LPCTSTR)aitrigger)!=ini.sections["AITriggerTypesEnable"].values.end())
|
||||
if(stricmp(ini.sections["AITriggerTypesEnable"].values[(LPCTSTR)aitrigger], "yes")==NULL)
|
||||
m_Enabled=TRUE;
|
||||
if (ini.GetBool("AITriggerTypesEnable", aitrigger)) {
|
||||
m_Enabled = TRUE;
|
||||
}
|
||||
|
||||
AITrigInfo info;
|
||||
info=ConvertToAITrigInfoFromHex((char*)(LPCSTR)aitt.data);
|
||||
|
@ -541,34 +445,41 @@ void CAITriggerTypes::OnEnabled()
|
|||
UpdateData();
|
||||
|
||||
int sel=m_AITriggerType.GetCurSel();
|
||||
if(sel<0) return;
|
||||
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
CString aitrigger;
|
||||
m_AITriggerType.GetLBText(sel,aitrigger);
|
||||
TruncSpace(aitrigger);
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(m_Enabled)
|
||||
{
|
||||
if(m_Enabled) {
|
||||
// enable it
|
||||
ini.sections["AITriggerTypesEnable"].values[(LPCTSTR)aitrigger]="yes";
|
||||
ini.SetBool("AITriggerTypesEnable", aitrigger, true);
|
||||
} else {
|
||||
if (auto const pSec = ini.TryGetSection("AITriggerTypesEnable")) {
|
||||
pSec->RemoveByKey(aitrigger);
|
||||
}
|
||||
}
|
||||
else
|
||||
ini.sections["AITriggerTypesEnable"].values.erase((LPCTSTR)aitrigger);
|
||||
}
|
||||
|
||||
void CAITriggerTypes::SetAITriggerParam(const char *value, int param)
|
||||
{
|
||||
int sel=m_AITriggerType.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString aitrigger;
|
||||
m_AITriggerType.GetLBText(sel,aitrigger);
|
||||
TruncSpace(aitrigger);
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["AITriggerTypes"].values[aitrigger]=SetParam(ini.sections["AITriggerTypes"].values[aitrigger],param,value);
|
||||
|
||||
if (auto const pSec = ini.TryGetSection("AITriggerTypes")) {
|
||||
pSec->SetString(aitrigger, SetParam(pSec->GetString(aitrigger), param, value));
|
||||
}
|
||||
}
|
||||
|
||||
void CAITriggerTypes::OnAdd()
|
||||
|
@ -578,12 +489,9 @@ void CAITriggerTypes::OnAdd()
|
|||
CString data="New AI Trigger,";
|
||||
|
||||
// now try to set a teamtype
|
||||
if(ini.sections["TeamTypes"].values.size()>0)
|
||||
{
|
||||
data+=*ini.sections["TeamTypes"].GetValue(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ini["TeamTypes"].Size()>0) {
|
||||
data+=*ini["TeamTypes"].Nth(0).second;
|
||||
} else {
|
||||
data+="<none>";
|
||||
}
|
||||
|
||||
|
@ -599,18 +507,18 @@ void CAITriggerTypes::OnAdd()
|
|||
data+="<none>,0000000000000000000000000000000000000000000000000000000000000000,50.000000,30.000000,50.000000,1,0,1,1,";
|
||||
|
||||
// a pool seems to need both teamtypes the same
|
||||
if(ini.sections["TeamTypes"].values.size()>0)
|
||||
{
|
||||
data+="<none>";//*ini.sections["TeamTypes"].GetValue(0);
|
||||
}
|
||||
else
|
||||
//if(ini.sections["TeamTypes"].values.size()>0)
|
||||
//{
|
||||
// data+="<none>";//*ini.sections["TeamTypes"].GetValue(0);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
data+="<none>";
|
||||
}
|
||||
|
||||
data+=",1,1,1";
|
||||
|
||||
ini.sections["AITriggerTypes"].values[ID]=data;
|
||||
ini.SetString("AITriggerTypes", ID, data);
|
||||
|
||||
UpdateDialog();
|
||||
|
||||
|
@ -639,10 +547,10 @@ void CAITriggerTypes::OnDelete()
|
|||
m_AITriggerType.GetLBText(sel,aitrigger);
|
||||
TruncSpace(aitrigger);
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
ini.sections["AITriggerTypes"].values.erase(aitrigger);
|
||||
ini.sections["AITriggerTypesEnable"].values.erase(aitrigger);
|
||||
ini.RemoveValueByKey("AITriggerTypes", aitrigger);
|
||||
ini.RemoveValueByKey("AITriggerTypesEnable", aitrigger);
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
|
|
@ -80,29 +80,27 @@ void CAiTriggerTypesEnable::UpdateDialog()
|
|||
|
||||
while(m_AITriggerType.DeleteString(0)!=CB_ERR);
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
int i;
|
||||
for(i=0;i<ini.sections["AITriggerTypesEnable"].values.size();i++)
|
||||
{
|
||||
CString aitrigger=*ini.sections["AITriggerTypesEnable"].GetValueName(i);
|
||||
CString str=aitrigger;
|
||||
for(auto const[aitrigger, val] : ini["AITriggerTypesEnable"]) {
|
||||
CString str = aitrigger;
|
||||
str+=" (";
|
||||
|
||||
if(ai.sections["AITriggerTypes"].values.find(aitrigger)!=ai.sections["AITriggerTypes"].values.end())
|
||||
{
|
||||
// standard ai trigger
|
||||
str+=GetParam(ai.sections["AITriggerTypes"].values[aitrigger],0);
|
||||
str+=" -> ";
|
||||
str+=*ini.sections["AITriggerTypesEnable"].GetValue(i);
|
||||
|
||||
|
||||
}
|
||||
if(ini.sections["AITriggerTypes"].values.find(aitrigger)!=ini.sections["AITriggerTypes"].values.end())
|
||||
{
|
||||
str+=GetParam(ini.sections["AITriggerTypes"].values[aitrigger],0);
|
||||
str+=" -> ";
|
||||
str+=*ini.sections["AITriggerTypesEnable"].GetValue(i);
|
||||
// parse from map definition first
|
||||
auto const& aiDef = ini.GetString("AITriggerTypes", aitrigger);
|
||||
if (!aiDef.IsEmpty()) {
|
||||
str += GetParam(aiDef, 0);
|
||||
str += " -> ";
|
||||
str += val;
|
||||
} else {
|
||||
// if not found, try retrieving from global AI ini
|
||||
auto const& aiDef = ai.GetString("AITriggerTypes", aitrigger);
|
||||
if (!aiDef.IsEmpty()) {
|
||||
// standard ai trigger
|
||||
str += GetParam(aiDef, 0);
|
||||
str += " -> ";
|
||||
str += val;
|
||||
}
|
||||
}
|
||||
|
||||
str+=")";
|
||||
|
@ -122,9 +120,8 @@ void CAiTriggerTypesEnable::OnEnableall()
|
|||
// enable all standard ai triggers
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
int i;
|
||||
for(i=0;i<ai.sections["AITriggerTypes"].values.size();i++)
|
||||
{
|
||||
ini.sections["AITriggerTypesEnable"].values[*ai.sections["AITriggerTypes"].GetValueName(i)]="yes";
|
||||
for (auto const& [id, def] : ai["AITriggerTypes"]) {
|
||||
ini.SetBool("AITriggerTypesEnable", id, true);
|
||||
}
|
||||
|
||||
UpdateDialog();
|
||||
|
@ -140,31 +137,35 @@ void CAiTriggerTypesEnable::OnSelchangeAitriggertype()
|
|||
void CAiTriggerTypesEnable::OnDelete()
|
||||
{
|
||||
int sel=m_AITriggerType.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
CString aitrigger;
|
||||
m_AITriggerType.GetLBText(sel,aitrigger);
|
||||
if(aitrigger.Find(" ")>=0) aitrigger.SetAt(aitrigger.Find(" "), 0);
|
||||
if (aitrigger.Find(" ") >= 0) {
|
||||
aitrigger.SetAt(aitrigger.Find(" "), 0);
|
||||
}
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
ini.sections["AITriggerTypesEnable"].values.erase((LPCTSTR)aitrigger);
|
||||
ini.RemoveValueByKey("AITriggerTypesEnable", aitrigger);
|
||||
UpdateDialog();
|
||||
}
|
||||
|
||||
void CAiTriggerTypesEnable::OnAdd()
|
||||
{
|
||||
|
||||
|
||||
//CString p=InputBox("Please enter the ID of the AITriggerType (for a list of all AITriggerType-IDs use the All-Section)","Enable AITriggerType");
|
||||
//CString newTriggerId=InputBox("Please enter the ID of the AITriggerType (for a list of all AITriggerType-IDs use the All-Section)","Enable AITriggerType");
|
||||
CAITriggerAddDlg dlg;
|
||||
if(dlg.DoModal()==IDCANCEL) return;
|
||||
|
||||
CString p=dlg.m_AITrigger;
|
||||
TruncSpace(p);
|
||||
if(p.GetLength()==0) return;
|
||||
CString newTriggerId = dlg.m_AITrigger;
|
||||
TruncSpace(newTriggerId);
|
||||
if (newTriggerId.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
ini.sections["AITriggerTypesEnable"].values[p]="yes";
|
||||
ini.SetBool("AITriggerTypesEnable", newTriggerId, true);
|
||||
UpdateDialog();
|
||||
}
|
||||
|
|
|
@ -95,11 +95,10 @@ void CAll::UpdateDialog()
|
|||
m_Value.SetWindowText("");
|
||||
|
||||
int i;
|
||||
for(i=ini.sections.size()-1;i>=0;i--)
|
||||
{
|
||||
const CString* name=ini.GetSectionName(i);
|
||||
if(!Map->IsMapSection(*name))
|
||||
m_Sections.InsertString(0, *name);
|
||||
for (auto const& [name, sec] : ini) {
|
||||
if (!Map->IsMapSection(name)) {
|
||||
m_Sections.InsertString(-1, name);
|
||||
}
|
||||
}
|
||||
|
||||
m_Sections.SetCurSel(1);
|
||||
|
@ -119,10 +118,8 @@ void CAll::OnSelchangeSections()
|
|||
int i;
|
||||
m_Keys.SetRedraw(FALSE);
|
||||
SetCursor(LoadCursor(0,IDC_WAIT));
|
||||
for(i=0;i<ini.sections[cuSection].values.size();i++)
|
||||
{
|
||||
const CString* name=ini.sections[cuSection].GetValueName(i);
|
||||
m_Keys.InsertString(-1, *name);
|
||||
for(auto const&[key, val] : ini[cuSection]) {
|
||||
m_Keys.InsertString(-1, key);
|
||||
|
||||
}
|
||||
SetCursor(m_hArrowCursor);
|
||||
|
@ -144,11 +141,11 @@ void CAll::OnChangeValue()
|
|||
|
||||
|
||||
CString cuKey;
|
||||
if(m_Keys.GetCurSel()>=0)m_Keys.GetText(m_Keys.GetCurSel(), cuKey) ;
|
||||
if (m_Keys.GetCurSel() >= 0) {
|
||||
m_Keys.GetText(m_Keys.GetCurSel(), cuKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ini.sections[cuSection].values[cuKey]=t;
|
||||
ini.SetString(cuSection, cuKey, t);
|
||||
|
||||
}
|
||||
|
||||
|
@ -162,7 +159,7 @@ void CAll::OnSelchangeKeys()
|
|||
CString cuKey;
|
||||
m_Keys.GetText(m_Keys.GetCurSel(), cuKey) ;
|
||||
|
||||
m_Value.SetWindowText(ini.sections[cuSection].values[cuKey]);
|
||||
m_Value.SetWindowText(ini.GetString(cuSection, cuKey));
|
||||
}
|
||||
|
||||
void CAll::OnUpdateValue()
|
||||
|
@ -172,11 +169,11 @@ void CAll::OnUpdateValue()
|
|||
|
||||
void CAll::OnAddsection()
|
||||
{
|
||||
CString name=InputBox("Please set the name of the new section (the section may already exist)", "Insert Section");
|
||||
CString name = InputBox("Please set the name of the new section (the section may already exist)", "Insert Section");
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
CIniFileSection stub=ini.sections[(LPCTSTR)name];
|
||||
ini.AddSection(name);
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
@ -187,7 +184,7 @@ void CAll::OnDeletesection()
|
|||
|
||||
int cusection;
|
||||
cusection=m_Sections.GetCurSel();
|
||||
if(cusection==-1) {
|
||||
if (cusection==-1) {
|
||||
MessageBox("You cannot delete a section without choosing one.");
|
||||
return;
|
||||
}
|
||||
|
@ -195,9 +192,11 @@ void CAll::OnDeletesection()
|
|||
CString str;
|
||||
m_Sections.GetLBText(cusection, str);
|
||||
|
||||
if(MessageBox(CString((CString)"Are you sure you want to delete " + str + "? You should be really careful, you may not be able to use the map afterwards."), "Delete section", MB_YESNO)==IDNO) return;
|
||||
if (MessageBox(CString((CString)"Are you sure you want to delete " + str + "? You should be really careful, you may not be able to use the map afterwards."), "Delete section", MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini.sections.erase(str);
|
||||
ini.DeleteSection(str);
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
@ -220,9 +219,11 @@ void CAll::OnDeletekey()
|
|||
m_Sections.GetLBText(cuSection, sec);
|
||||
m_Keys.GetText(cukey, str);
|
||||
|
||||
if(MessageBox(CString((CString)"Are you sure you want to delete " + str + "? You should be really careful, you may not be able to use the map afterwards."), "Delete key", MB_YESNO)==IDNO) return;
|
||||
if (MessageBox(CString((CString)"Are you sure you want to delete " + str + "? You should be really careful, you may not be able to use the map afterwards."), "Delete key", MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini.sections[sec].values.erase(str);
|
||||
ini.RemoveValueByKey(sec, str);
|
||||
|
||||
UpdateDialog();
|
||||
|
||||
|
@ -246,15 +247,14 @@ void CAll::OnAddkey()
|
|||
CString key, value;
|
||||
key=InputBox("Please set the name and value for the current key here: (for example, setting a new key ""Strength"" with the value 200 can be written as ""Strength=200"". You don´t need to specify a value.)", "Create key");
|
||||
|
||||
if(key.Find("=")!=-1)
|
||||
{
|
||||
if (key.Find("=") != -1) {
|
||||
// value specified
|
||||
// MW BUGFIX
|
||||
value=key.Right(key.GetLength()-key.Find("=")-1);
|
||||
key=key.Left(key.Find("="));
|
||||
}
|
||||
|
||||
ini.sections[sec].values[key]=value;
|
||||
ini.SetString(sec, key, value);
|
||||
|
||||
UpdateDialog();
|
||||
m_Sections.SetCurSel(cusection);
|
||||
|
|
|
@ -122,41 +122,42 @@ void CBasic::UpdateDialog()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
m_AltNextScenario.SetWindowText(ini.sections["Basic"].values["AltNextScenario"]);
|
||||
m_Name.SetWindowText(ini.sections["Basic"].values["Name"]);
|
||||
m_CarryOverCap.SetWindowText(ini.sections["Basic"].values["CarryOverCap"]);
|
||||
m_EndOfGame.SetWindowText(ini.sections["Basic"].values["EndOfGame"]);
|
||||
m_FreeRadar.SetWindowText(ini.sections["Basic"].values["FreeRadar"]);
|
||||
m_IceGrowthEnabled.SetWindowText(ini.sections["Basic"].values["IceGrowthEnabled"]);
|
||||
m_IgnoreGlobalAITriggers.SetWindowText(ini.sections["Basic"].values["IgnoreGlobalAITriggers"]);
|
||||
m_InitTime.SetWindowText(ini.sections["Basic"].values["InitTime"]);
|
||||
m_MultiplayerOnly.SetWindowText(ini.sections["Basic"].values["MultiplayerOnly"]);
|
||||
m_NewINIFormat.SetWindowText(ini.sections["Basic"].values["NewINIFormat"]);
|
||||
m_NextScenario.SetWindowText(ini.sections["Basic"].values["NextScenario"]);
|
||||
m_Official.SetWindowText(ini.sections["Basic"].values["Official"]);
|
||||
m_OneTimeOnly.SetWindowText(ini.sections["Basic"].values["OneTimeOnly"]);
|
||||
m_Percent.SetWindowText(ini.sections["Basic"].values["Percent"]);
|
||||
m_SkipMapSelect.SetWindowText(ini.sections["Basic"].values["SkipMapSelect"]);
|
||||
m_SkipScore.SetWindowText(ini.sections["Basic"].values["SkipScore"]);
|
||||
m_TiberiumDeathToVisceroid.SetWindowText(ini.sections["Basic"].values["TiberiumDeathToVisceroid"]);
|
||||
m_TiberiumGrowthEnabled.SetWindowText(ini.sections["Basic"].values["TiberiumGrowthEnabled"]);
|
||||
m_TrainCrate.SetWindowText(ini.sections["Basic"].values["TrainCrate"]);
|
||||
m_TruckCrate.SetWindowText(ini.sections["Basic"].values["TruckCrate"]);
|
||||
m_VeinGrowthEnabled.SetWindowText(ini.sections["Basic"].values["VeinGrowthEnabled"]);
|
||||
auto const& basicSec = ini["Basic"];
|
||||
m_AltNextScenario.SetWindowText(basicSec["AltNextScenario"]);
|
||||
m_Name.SetWindowText(basicSec["Name"]);
|
||||
m_CarryOverCap.SetWindowText(basicSec["CarryOverCap"]);
|
||||
m_EndOfGame.SetWindowText(basicSec["EndOfGame"]);
|
||||
m_FreeRadar.SetWindowText(basicSec["FreeRadar"]);
|
||||
m_IceGrowthEnabled.SetWindowText(basicSec["IceGrowthEnabled"]);
|
||||
m_IgnoreGlobalAITriggers.SetWindowText(basicSec["IgnoreGlobalAITriggers"]);
|
||||
m_InitTime.SetWindowText(basicSec["InitTime"]);
|
||||
m_MultiplayerOnly.SetWindowText(basicSec["MultiplayerOnly"]);
|
||||
m_NewINIFormat.SetWindowText(basicSec["NewINIFormat"]);
|
||||
m_NextScenario.SetWindowText(basicSec["NextScenario"]);
|
||||
m_Official.SetWindowText(basicSec["Official"]);
|
||||
m_OneTimeOnly.SetWindowText(basicSec["OneTimeOnly"]);
|
||||
m_Percent.SetWindowText(basicSec["Percent"]);
|
||||
m_SkipMapSelect.SetWindowText(basicSec["SkipMapSelect"]);
|
||||
m_SkipScore.SetWindowText(basicSec["SkipScore"]);
|
||||
m_TiberiumDeathToVisceroid.SetWindowText(basicSec["TiberiumDeathToVisceroid"]);
|
||||
m_TiberiumGrowthEnabled.SetWindowText(basicSec["TiberiumGrowthEnabled"]);
|
||||
m_TrainCrate.SetWindowText(basicSec["TrainCrate"]);
|
||||
m_TruckCrate.SetWindowText(basicSec["TruckCrate"]);
|
||||
m_VeinGrowthEnabled.SetWindowText(basicSec["VeinGrowthEnabled"]);
|
||||
|
||||
if(ini.sections["Basic"].values.find("RequiredAddOn")!=ini.sections["Basic"].values.end())
|
||||
{
|
||||
m_RequiredAddOn.SetWindowText(ini.sections["Basic"].values["RequiredAddOn"]);
|
||||
}
|
||||
else
|
||||
auto const& addOn = basicSec.GetString("RequiredAddOn");
|
||||
if (!addOn.IsEmpty()) {
|
||||
m_RequiredAddOn.SetWindowText(addOn);
|
||||
} else {
|
||||
m_RequiredAddOn.SetWindowText("0");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CBasic::OnChangeName()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["Name"]=GetText(&m_Name);
|
||||
ini.SetString("Basic", "Name", GetText(&m_Name));
|
||||
}
|
||||
|
||||
void CBasic::UpdateData()
|
||||
|
@ -170,121 +171,121 @@ void CBasic::UpdateData()
|
|||
void CBasic::OnEditchangeNextscenario()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["NextScenario"]=GetText(&m_NextScenario);
|
||||
ini.SetString("Basic", "NextScenario", GetText(&m_NextScenario));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeAltnextscenario()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["AltNextScenario"]=GetText(&m_AltNextScenario);
|
||||
ini.SetString("Basic", "AltNextScenario", GetText(&m_AltNextScenario));
|
||||
}
|
||||
|
||||
void CBasic::OnChangeNewiniformat()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["NewINIFormat"]=GetText(&m_NewINIFormat);
|
||||
ini.SetString("Basic", "NewINIFormat", GetText(&m_NewINIFormat));
|
||||
}
|
||||
|
||||
void CBasic::OnChangeCarryovercap()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["CarryOverCap"]=GetText(&m_CarryOverCap);
|
||||
ini.SetString("Basic", "CarryOverCap", GetText(&m_CarryOverCap));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeEndofgame()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["EndOfGame"]=GetText(&m_EndOfGame);
|
||||
ini.SetString("Basic", "EndOfGame", GetText(&m_EndOfGame));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeSkipscore()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["SkipScore"]=GetText(&m_SkipScore);
|
||||
ini.SetString("Basic", "SkipScore", GetText(&m_SkipScore));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeOnetimeonly()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["OneTimeOnly"]=GetText(&m_OneTimeOnly);
|
||||
ini.SetString("Basic", "OneTimeOnly", GetText(&m_OneTimeOnly));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeSkipmapselect()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["SkipMapSelect"]=GetText(&m_SkipMapSelect);
|
||||
ini.SetString("Basic", "SkipMapSelect", GetText(&m_SkipMapSelect));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeOfficial()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["Official"]=GetText(&m_Official);
|
||||
ini.SetString("Basic", "Official", GetText(&m_Official));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeIgnoreglobalaitriggers()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["IgnoreGlobalAITriggers"]=GetText(&m_IgnoreGlobalAITriggers);
|
||||
ini.SetString("Basic", "IgnoreGlobalAITriggers", GetText(&m_IgnoreGlobalAITriggers));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeTruckcrate()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["TruckCrate"]=GetText(&m_TruckCrate);
|
||||
ini.SetString("Basic", "TruckCrate", GetText(&m_TruckCrate));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeTraincrate()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["TrainCrate"]=GetText(&m_TrainCrate);
|
||||
ini.SetString("Basic", "TrainCrate", GetText(&m_TrainCrate));
|
||||
}
|
||||
|
||||
void CBasic::OnChangePercent()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["Percent"]=GetText(&m_Percent);
|
||||
ini.SetString("Basic", "Percent", GetText(&m_Percent));
|
||||
}
|
||||
|
||||
void CBasic::OnChangeMultiplayeronly()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["MultiplayerOnly"]=GetText(&m_MultiplayerOnly);
|
||||
ini.SetString("Basic", "MultiplayerOnly", GetText(&m_MultiplayerOnly));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeTiberiumgrowthenabled()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["TiberiumGrowthEnabled"]=GetText(&m_TiberiumGrowthEnabled);
|
||||
ini.SetString("Basic", "TiberiumGrowthEnabled", GetText(&m_TiberiumGrowthEnabled));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeVeingrowthenabled()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["VeinGrowthEnabled"]=GetText(&m_VeinGrowthEnabled);
|
||||
ini.SetString("Basic", "VeinGrowthEnabled", GetText(&m_VeinGrowthEnabled));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeIcegrowthenabled()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["IceGrowthEnabled"]=GetText(&m_IceGrowthEnabled);
|
||||
ini.SetString("Basic", "IceGrowthEnabled", GetText(&m_IceGrowthEnabled));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeTiberiumdeathtovisceroid()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["TiberiumDeathToVisceroid"]=GetText(&m_TiberiumDeathToVisceroid);
|
||||
ini.SetString("Basic", "TiberiumDeathToVisceroid", GetText(&m_TiberiumDeathToVisceroid));
|
||||
}
|
||||
|
||||
void CBasic::OnEditchangeFreeradar()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["FreeRadar"]=GetText(&m_FreeRadar);
|
||||
ini.SetString("Basic", "FreeRadar", GetText(&m_FreeRadar));
|
||||
}
|
||||
|
||||
void CBasic::OnChangeInittime()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["InitTime"]=GetText(&m_InitTime);
|
||||
ini.SetString("Basic", "InitTime", GetText(&m_InitTime));
|
||||
}
|
||||
|
||||
void CBasic::UpdateStrings()
|
||||
|
@ -333,9 +334,11 @@ void CBasic::UpdateStrings()
|
|||
|
||||
void CBasic::OnEditchangeRequiredaddon()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["RequiredAddOn"]=GetText(&m_RequiredAddOn);
|
||||
if(ini.sections["Basic"].values["RequiredAddOn"]=="0") ini.sections["Basic"].values.erase("RequiredAddOn");
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
ini.SetString("Basic", "RequiredAddOn", GetText(&m_RequiredAddOn));
|
||||
if (ini.GetInteger("Basic", "RequiredAddOn") == 0) {
|
||||
ini.RemoveValueByKey("Basic", "RequiredAddOn");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -102,12 +102,12 @@ BOOL CBitmap2MapConverter::Convert(HBITMAP hBitmap, CMapData & mapdata)
|
|||
int water_start=i+8; // to 12
|
||||
|
||||
|
||||
int sandset=atoi((*tiles).sections["General"].values["SandTile"]);
|
||||
int greenset=atoi((*tiles).sections["General"].values["GreenTile"]);
|
||||
int sandset = tiles->GetInteger("General", "SandTile");
|
||||
int greenset= tiles->GetInteger("General", "GreenTile");
|
||||
|
||||
#ifdef RA2_MODE
|
||||
sandset=atoi((*tiles).sections["General"].values["GreenTile"]);
|
||||
greenset=atoi((*tiles).sections["General"].values["RoughTile"]);
|
||||
sandset = tiles->GetInteger("General", "GreenTile");
|
||||
greenset = tiles->GetInteger("General", "RoughTile");
|
||||
#endif
|
||||
|
||||
for(i=0;i<(*tiledata_count);i++)
|
||||
|
|
|
@ -95,14 +95,7 @@ END_MESSAGE_MAP()
|
|||
|
||||
CString GetName(CString id)
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
if(ini.sections.find(id)!=ini.sections.end())
|
||||
{
|
||||
if(ini.sections[id].values.find("Name")!=ini.sections[id].values.end())
|
||||
return ini.sections[id].values["Name"];
|
||||
|
||||
}
|
||||
return rules.sections[id].values["Name"];
|
||||
return rules.GetString(id, "Name");
|
||||
}
|
||||
|
||||
void CBuilding::OnOK()
|
||||
|
@ -152,93 +145,28 @@ BOOL CBuilding::OnInitDialog()
|
|||
UpdateData(FALSE);
|
||||
|
||||
int upgradecount=0;
|
||||
if(strcmp(m_type,"GACTWR")==NULL)
|
||||
upgradecount=1;
|
||||
|
||||
|
||||
if(ini.sections.find(m_type)!=ini.sections.end())
|
||||
{
|
||||
if(ini.sections[m_type].values.find("Upgrades")!=ini.sections[m_type].values.end())
|
||||
{
|
||||
// ok we have our upgrade
|
||||
upgradecount=atoi(ini.sections[m_type].values["Upgrades"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rules.sections[m_type].values.find("Upgrades")!=rules.sections[m_type].values.end())
|
||||
upgradecount=atoi(rules.sections[m_type].values["Upgrades"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rules.sections[m_type].values.find("Upgrades")!=rules.sections[m_type].values.end())
|
||||
upgradecount=atoi(rules.sections[m_type].values["Upgrades"]);
|
||||
if (strcmp(m_type, "GACTWR") == NULL) {
|
||||
upgradecount = 1;
|
||||
}
|
||||
|
||||
upgradecount = ini.GetInteger(m_type, "Upgrades");
|
||||
|
||||
GetDlgItem(IDC_P5)->SendMessage(CB_SETCURSEL, atoi(m_spotlight), 0);
|
||||
|
||||
if(upgradecount>0)
|
||||
{
|
||||
for(i=0;i<rules.sections["BuildingTypes"].values.size();i++)
|
||||
{
|
||||
const char* unitname=*rules.sections["BuildingTypes"].GetValue(i);
|
||||
|
||||
// okay, first all the old units
|
||||
if(ini.sections.find(unitname)!=ini.sections.end())
|
||||
{
|
||||
// new thing specified
|
||||
if(ini.sections[unitname].values.find("PowersUpBuilding")!=ini.sections[unitname].values.end())
|
||||
{
|
||||
|
||||
// ini file specified new PowersUpBuilding
|
||||
if(_stricmp(ini.sections[unitname].values["PowersUpBuilding"], m_type)==NULL)
|
||||
{
|
||||
((CComboBox*)GetDlgItem(IDC_P6))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
((CComboBox*)GetDlgItem(IDC_P7))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
((CComboBox*)GetDlgItem(IDC_P8))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
}
|
||||
if (upgradecount > 0) {
|
||||
auto updatePowerupItems = [=](const CIniFile& ini) {
|
||||
for (auto const& [seq, unitname] : ini["BuildingTypes"]) {
|
||||
auto const& targetBldID = ini.GetString(unitname, "PowersUpBuilding");
|
||||
if (targetBldID == m_type) {
|
||||
auto const desc = unitname + " (" + GetName(unitname) + ")";
|
||||
((CComboBox*)GetDlgItem(IDC_P6))->AddString(desc);
|
||||
((CComboBox*)GetDlgItem(IDC_P7))->AddString(desc);
|
||||
((CComboBox*)GetDlgItem(IDC_P8))->AddString(desc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ini did not specify thing specified
|
||||
if(rules.sections[unitname].values.find("PowersUpBuilding")!=rules.sections[unitname].values.end())
|
||||
{
|
||||
// rules file specified new PowersUpBuilding
|
||||
if(_stricmp(rules.sections[unitname].values["PowersUpBuilding"], m_type)==NULL)
|
||||
{
|
||||
((CComboBox*)GetDlgItem(IDC_P6))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
((CComboBox*)GetDlgItem(IDC_P7))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
((CComboBox*)GetDlgItem(IDC_P8))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ini.sections.find("BuildingTypes")!=ini.sections.end())
|
||||
{
|
||||
for(i=0;i<ini.sections["BuildingTypes"].values.size();i++)
|
||||
{
|
||||
const char* unitname=*ini.sections["BuildingTypes"].GetValue(i);
|
||||
|
||||
// okay, first all the old units
|
||||
if(ini.sections.find(unitname)!=ini.sections.end())
|
||||
{
|
||||
// new thing specified
|
||||
if(ini.sections[unitname].values.find("PowersUpBuilding")!=ini.sections[unitname].values.end())
|
||||
{
|
||||
// ini file specified new PowersUpBuilding
|
||||
if(_stricmp(ini.sections[unitname].values["PowersUpBuilding"], m_type)==NULL)
|
||||
{
|
||||
((CComboBox*)GetDlgItem(IDC_P6))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
((CComboBox*)GetDlgItem(IDC_P7))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
((CComboBox*)GetDlgItem(IDC_P8))->AddString(((CString)unitname+" ("+GetName(unitname)+")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
updatePowerupItems(rules);
|
||||
updatePowerupItems(ini);
|
||||
}
|
||||
|
||||
GetDlgItem(IDC_P8)->EnableWindow(TRUE);
|
||||
|
|
|
@ -74,7 +74,7 @@ BOOL CCellTag::OnInitDialog()
|
|||
|
||||
CComboBox& m_Tag=*((CComboBox*)GetDlgItem(IDC_TAG));
|
||||
|
||||
if(ini.sections.find("Tags")==ini.sections.end())
|
||||
if(!ini.TryGetSection("Tags"))
|
||||
{
|
||||
MessageBox("No tags are specified.");
|
||||
OnCancel();
|
||||
|
@ -82,7 +82,9 @@ BOOL CCellTag::OnInitDialog()
|
|||
else
|
||||
{
|
||||
ListTags(m_Tag, FALSE);
|
||||
if(m_tag=="") m_Tag.SetCurSel(0);
|
||||
if (m_tag == "") {
|
||||
m_Tag.SetCurSel(0);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateStrings();
|
||||
|
|
|
@ -310,12 +310,14 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall)
|
|||
}
|
||||
|
||||
|
||||
CString sec=GetDataSection();
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
if(g_data.sections.find(sec+ini.sections["Map"].values["Theater"])!=g_data.sections.end())
|
||||
sec=sec+ini.sections["Map"].values["Theater"];
|
||||
CString sec = GetDataSection();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
auto const& theaterID = g_data.GetString("Map", "Theater");
|
||||
if (!theaterID.IsEmpty()) {
|
||||
sec += theaterID;
|
||||
}
|
||||
|
||||
count=atoi(g_data.sections[sec].values[type+"c"]);
|
||||
count = g_data.GetInteger(sec, type + "c");
|
||||
|
||||
|
||||
|
||||
|
@ -339,7 +341,7 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall)
|
|||
itoa(i, c, 10);
|
||||
CString cur=type;
|
||||
cur+=c;
|
||||
notusedascliff[dwStartSet+atoi(g_data.sections[sec].values[cur])]=TRUE;
|
||||
notusedascliff[dwStartSet + g_data.GetInteger(sec, cur)] = TRUE;
|
||||
}
|
||||
|
||||
CString corner_searched="";
|
||||
|
@ -373,17 +375,13 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall)
|
|||
if(corner_searched.GetLength()>0) break;
|
||||
}
|
||||
|
||||
BOOL bCornerFound=FALSE;
|
||||
if(g_data.sections[sec].FindName(type+corner_searched+"c")>=0)
|
||||
{
|
||||
int icount=atoi(g_data.sections[sec].values[type+corner_searched+"c"]);
|
||||
if(icount)
|
||||
{
|
||||
bCornerFound=TRUE;
|
||||
count=icount;
|
||||
}
|
||||
BOOL bCornerFound = FALSE;;
|
||||
if (int icount = g_data.GetInteger(sec, type + corner_searched + "c")) {
|
||||
bCornerFound = TRUE;
|
||||
count = icount;
|
||||
}
|
||||
|
||||
|
||||
if(!bCornerFound) corner_searched="";
|
||||
|
||||
if(count==0) return -1;
|
||||
|
@ -395,11 +393,10 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall)
|
|||
DWORD dwDY=m_dwTo/Map->GetIsoSize();
|
||||
|
||||
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
for (i = 0; i < count; i++) {
|
||||
char c[50];
|
||||
itoa(i,c,10);
|
||||
careables.push_back(dwStartSet+atoi(g_data.sections[sec].values[type+corner_searched+c]));
|
||||
careables.push_back(dwStartSet + g_data.GetInteger(sec, type + corner_searched + c));
|
||||
}
|
||||
|
||||
for(i=0;i<careables.size();i++)
|
||||
|
@ -453,21 +450,26 @@ DWORD CCliffModifier::GetTileToPlace(DWORD dwPos, BOOL* bSmall)
|
|||
{
|
||||
CString tset;
|
||||
char c[50];
|
||||
int watercliffs=atoi(tiles->sections["General"].values["WaterCliffs"]);
|
||||
if(m_bAlternative) watercliffs=cliffwater2set;
|
||||
int watercliffs = tiles->GetInteger("General", "WaterCliffs");
|
||||
if (m_bAlternative) {
|
||||
watercliffs = cliffwater2set;
|
||||
}
|
||||
itoa(watercliffs, c, 10);
|
||||
int e;
|
||||
for(e=0;e<4-strlen(c);e++)
|
||||
tset+="0";
|
||||
for (e = 0; e < 4 - strlen(c); e++) {
|
||||
tset += "0";
|
||||
}
|
||||
tset+=c;
|
||||
CString sec="TileSet";
|
||||
sec+=tset;
|
||||
|
||||
if(tiles->sections.find(sec)==tiles->sections.end()) return useables[k];
|
||||
auto const pSec = tiles->TryGetSection(sec);
|
||||
if (!pSec) {
|
||||
return useables[k];
|
||||
}
|
||||
|
||||
|
||||
if(atoi(tiles->sections[sec].values["TilesInSet"])>useables[k]-dwStartSet)
|
||||
{
|
||||
if (pSec->GetInteger("TilesInSet") > useables[k] - dwStartSet) {
|
||||
DWORD dwStartWaterSet=0;
|
||||
for(i=0;i<(*tiledata_count);i++)
|
||||
{
|
||||
|
|
|
@ -188,8 +188,7 @@ BOOL CFinalSunApp::InitInstance()
|
|||
#endif
|
||||
language.LoadFile(languagefile);
|
||||
|
||||
if (language.sections.size() == 0)
|
||||
{
|
||||
if (language.Size() == 0) {
|
||||
MessageBox(0, "FALanguage.ini does not exist or is not valid (download corrupt?)", "", 0);
|
||||
exit(0);
|
||||
}
|
||||
|
@ -233,122 +232,128 @@ BOOL CFinalSunApp::InitInstance()
|
|||
|
||||
auto& opts = m_Options;
|
||||
|
||||
HKEY hKey = 0;
|
||||
int res;
|
||||
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, key.c_str(), 0, KEY_EXECUTE/*KEY_ALL_ACCESS*/, &hKey);
|
||||
if (res != ERROR_SUCCESS)
|
||||
{
|
||||
std::wstring s = L"Failed to access registry. Using manual setting. Error was:\n";
|
||||
wchar_t c[1024] = { 0 };
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, res, 0, c, 1023, NULL);
|
||||
MessageBoxW(0, (s + c).c_str(), L"Error", 0);
|
||||
opts.TSExe = optini.sections[game].values["Exe"];
|
||||
}
|
||||
else
|
||||
{
|
||||
// key opened
|
||||
wchar_t path[MAX_PATH + 1] = { 0 };
|
||||
DWORD pathsize = MAX_PATH;
|
||||
DWORD type = REG_SZ;
|
||||
if ((res = RegQueryValueExW(hKey, L"InstallPath", 0, &type, (unsigned char*)path, &pathsize)) != ERROR_SUCCESS)
|
||||
{
|
||||
std::wstring s = L"Failed to access registry. Using manual setting. Error was:\n";
|
||||
wchar_t c[1024] = { 0 };
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, res, 0, c, 1023, NULL);
|
||||
MessageBoxW(0, (s + c).c_str(), L"Error", 0);
|
||||
opts.TSExe = optini.sections[game].values["Exe"];
|
||||
}
|
||||
else
|
||||
// TODO: use config
|
||||
auto getPathFromRegistry = false;
|
||||
auto getPathFromIni = true;
|
||||
|
||||
if (getPathFromRegistry) {
|
||||
do {
|
||||
int res;
|
||||
HKEY hKey = 0;
|
||||
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, key.c_str(), 0, KEY_EXECUTE/*KEY_ALL_ACCESS*/, &hKey);
|
||||
if (res != ERROR_SUCCESS) {
|
||||
getPathFromIni = true;
|
||||
std::wstring s = L"Failed to access registry. Using manual setting. Error was:\n";
|
||||
wchar_t c[1024] = { 0 };
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, res, 0, c, 1023, NULL);
|
||||
MessageBoxW(0, (s + c).c_str(), L"Error", 0);
|
||||
break;
|
||||
}
|
||||
// key opened
|
||||
wchar_t path[MAX_PATH + 1] = { 0 };
|
||||
DWORD pathsize = MAX_PATH;
|
||||
DWORD type = REG_SZ;
|
||||
if ((res = RegQueryValueExW(hKey, L"InstallPath", 0, &type, (unsigned char*)path, &pathsize)) != ERROR_SUCCESS) {
|
||||
getPathFromIni = true;
|
||||
std::wstring s = L"Failed to access registry. Using manual setting. Error was:\n";
|
||||
wchar_t c[1024] = { 0 };
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, 0, res, 0, c, 1023, NULL);
|
||||
MessageBoxW(0, (s + c).c_str(), L"Error", 0);
|
||||
break;
|
||||
}
|
||||
opts.TSExe = path;
|
||||
} while (0);
|
||||
}
|
||||
|
||||
if (getPathFromIni) {
|
||||
opts.TSExe = optini.GetString(game, "Exe");
|
||||
}
|
||||
|
||||
auto const& appSec = optini[app];
|
||||
if (copiedDefaultFile ||
|
||||
optini.sections.size() == 0 ||
|
||||
opts.TSExe.GetLength() == 0 ||
|
||||
optini.sections[app].values["Language"].GetLength() == 0 ||
|
||||
optini.sections[app].values.find("FileSearchLikeGame") == optini.sections[app].values.end() ||
|
||||
optini.sections[app].values.find("PreferLocalTheaterFiles") == optini.sections[app].values.end())
|
||||
{
|
||||
optini.Size() == 0 ||
|
||||
opts.TSExe.IsEmpty() ||
|
||||
appSec.GetString( "Language").IsEmpty() ||
|
||||
!appSec.GetBool("FileSearchLikeGame") ||
|
||||
!appSec.GetBool("PreferLocalTheaterFiles")) {
|
||||
opts.bSearchLikeTS = TRUE;
|
||||
|
||||
bOptionsStartup = TRUE;
|
||||
ShowOptionsDialog();
|
||||
bOptionsStartup = FALSE;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
opts.LanguageName = optini.sections[app].values["Language"];
|
||||
if (optini.sections[app].values["FileSearchLikeGame"] != "no")
|
||||
} else {
|
||||
opts.LanguageName = appSec.GetString("Language");
|
||||
if (appSec.GetBool("FileSearchLikeGame")) {
|
||||
opts.bSearchLikeTS = TRUE;
|
||||
else opts.bSearchLikeTS = FALSE;
|
||||
}
|
||||
else {
|
||||
opts.bSearchLikeTS = FALSE;
|
||||
}
|
||||
}
|
||||
opts.bPreferLocalTheaterFiles = optini.sections[app].values.emplace("PreferLocalTheaterFiles", opts.bPreferLocalTheaterFiles ? "1" : "0").first->second == "1";
|
||||
opts.bPreferLocalTheaterFiles = appSec.GetBool("PreferLocalTheaterFiles", opts.bPreferLocalTheaterFiles);
|
||||
auto const& graphSec = optini["Graphics"];
|
||||
opts.bDoNotLoadAircraftGraphics = graphSec.GetBool("NoAircraftGraphics");
|
||||
opts.bDoNotLoadVehicleGraphics = graphSec.GetBool("NoVehicleGraphics");
|
||||
opts.bDoNotLoadBuildingGraphics = graphSec.GetBool("NoBuildingGraphics");
|
||||
opts.bDoNotLoadInfantryGraphics = graphSec.GetBool("NoInfantryGraphics");
|
||||
opts.bDoNotLoadTreeGraphics = graphSec.GetBool("NoTreeGraphics");
|
||||
opts.bDoNotLoadSnowGraphics = graphSec.GetBool("NoSnowGraphics");
|
||||
opts.bDoNotLoadTemperateGraphics = graphSec.GetBool("NoTemperateGraphics");
|
||||
opts.bDoNotLoadBMPs = graphSec.GetBool("NoBMPs");
|
||||
opts.bDoNotLoadOverlayGraphics = graphSec.GetBool("NoOverlayGraphics");
|
||||
opts.bVSync = graphSec.GetBool("VSync", opts.bVSync);
|
||||
|
||||
opts.bDoNotLoadAircraftGraphics = optini.sections["Graphics"].values["NoAircraftGraphics"] == "1";
|
||||
opts.bDoNotLoadVehicleGraphics = optini.sections["Graphics"].values["NoVehicleGraphics"] == "1";
|
||||
opts.bDoNotLoadBuildingGraphics = optini.sections["Graphics"].values["NoBuildingGraphics"] == "1";
|
||||
opts.bDoNotLoadInfantryGraphics = optini.sections["Graphics"].values["NoInfantryGraphics"] == "1";
|
||||
opts.bDoNotLoadTreeGraphics = optini.sections["Graphics"].values["NoTreeGraphics"] == "1";
|
||||
opts.bDoNotLoadSnowGraphics = optini.sections["Graphics"].values["NoSnowGraphics"] == "1";
|
||||
opts.bDoNotLoadTemperateGraphics = optini.sections["Graphics"].values["NoTemperateGraphics"] == "1";
|
||||
opts.bDoNotLoadBMPs = optini.sections["Graphics"].values["NoBMPs"] == "1";
|
||||
opts.bDoNotLoadOverlayGraphics = optini.sections["Graphics"].values["NoOverlayGraphics"] == "1";
|
||||
opts.bVSync = optini.sections["Graphics"].values.emplace("VSync", opts.bVSync ? "1" : "0").first->second == "1";
|
||||
auto const& userInterfaceSec = optini["UserInterface"];
|
||||
opts.bDisableAutoShore = userInterfaceSec.GetBool("DisableAutoShore");
|
||||
opts.bDisableAutoLat = userInterfaceSec.GetBool("DisableAutoLat");
|
||||
opts.bNoSounds = !userInterfaceSec.GetBool("Sounds");
|
||||
opts.bDisableSlopeCorrection = userInterfaceSec.GetBool("DisableSlopeCorrection");
|
||||
opts.fLoadScreenDelayInSeconds = userInterfaceSec.GetFloat("LoadScreenDelay", opts.fLoadScreenDelayInSeconds);
|
||||
opts.bShowStats = userInterfaceSec.GetBool("ShowStats", opts.bShowStats);
|
||||
opts.bHighResUI = userInterfaceSec.GetBool("HighRes", opts.bHighResUI);
|
||||
opts.useDefaultMouseCursor = userInterfaceSec.GetBool("UseDefaultMouseCursor", opts.useDefaultMouseCursor);
|
||||
|
||||
opts.bDisableAutoShore = optini.sections["UserInterface"].values["DisableAutoShore"] == "1";
|
||||
opts.bDisableAutoLat = optini.sections["UserInterface"].values["DisableAutoLat"] == "1";
|
||||
opts.bNoSounds = optini.sections["UserInterface"].values["Sounds"] != "1";
|
||||
opts.bDisableSlopeCorrection = optini.sections["UserInterface"].values["DisableSlopeCorrection"] == "1";
|
||||
opts.fLoadScreenDelayInSeconds = static_cast<float>(atof(optini.sections["UserInterface"].values.emplace("LoadScreenDelay", std::to_string(opts.fLoadScreenDelayInSeconds).c_str()).first->second));
|
||||
opts.bShowStats = optini.sections["UserInterface"].values.emplace("ShowStats", opts.bShowStats ? "1" : "0").first->second == "1";
|
||||
opts.bHighResUI = optini.sections["UserInterface"].values.emplace("HighRes", opts.bHighResUI ? "1" : "0").first->second == "1";
|
||||
opts.useDefaultMouseCursor = optini.sections["UserInterface"].values.emplace("UseDefaultMouseCursor", opts.useDefaultMouseCursor ? "1" : "0").first->second == "1";
|
||||
|
||||
opts.fMiniMapScale = static_cast<float>(atof(optini.sections["MiniMap"].values.emplace("Scale", std::to_string(opts.fMiniMapScale).c_str()).first->second));
|
||||
opts.fMiniMapScale = optini["MiniMap"].GetFloat("Scale", opts.fMiniMapScale);
|
||||
|
||||
auto defaultViewSteps = CString(Join(",", opts.viewScaleSteps | std::views::transform([](auto v) {return std::to_string(v); })).c_str());
|
||||
auto viewScaleStepsRange = SplitParams(optini.sections["UserInterface"].values.emplace("ViewScaleSteps", defaultViewSteps).first->second) | std::views::transform([](auto v) { return static_cast<float>(std::atof(v)); });
|
||||
auto viewScaleStepsRange = SplitParams(userInterfaceSec.GetStringOr("ViewScaleSteps", defaultViewSteps)) | std::views::transform([](auto v) { return static_cast<float>(std::atof(v)); });
|
||||
opts.viewScaleSteps.assign(viewScaleStepsRange.begin(), viewScaleStepsRange.end());
|
||||
opts.viewScaleUseSteps = optini.sections["UserInterface"].values.emplace("ViewScaleUseSteps", opts.viewScaleUseSteps ? "1" : "0").first->second == "1";
|
||||
opts.viewScaleSpeed = static_cast<float>(atof(optini.sections["UserInterface"].values.emplace("ViewScaleSpeed", std::to_string(opts.viewScaleSpeed).c_str()).first->second));
|
||||
opts.viewScaleUseSteps = userInterfaceSec.GetBool("ViewScaleUseSteps", opts.viewScaleUseSteps);
|
||||
opts.viewScaleSpeed = userInterfaceSec.GetFloat("ViewScaleSpeed", opts.viewScaleSpeed);
|
||||
|
||||
// MW 07/19/01
|
||||
opts.bShowCells = optini.sections["UserInterface"].values["ShowBuildingCells"] == "1";
|
||||
opts.bShowCells = userInterfaceSec.GetBool("ShowBuildingCells");
|
||||
|
||||
optini.SaveFile(iniFile);
|
||||
|
||||
// MW 07/20/01: Load file list
|
||||
int i;
|
||||
for (i = 0;i < 4;i++)
|
||||
{
|
||||
for (i = 0;i < 4;i++) {
|
||||
char c[50];
|
||||
itoa(i, c, 10);
|
||||
opts.prev_maps[i] = optini.sections["Files"].values[c];
|
||||
opts.prev_maps[i] = optini.GetString("Files", c);
|
||||
}
|
||||
|
||||
if (opts.bDoNotLoadTemperateGraphics && opts.bDoNotLoadSnowGraphics)
|
||||
{
|
||||
if (opts.bDoNotLoadTemperateGraphics && opts.bDoNotLoadSnowGraphics) {
|
||||
MessageBox(0, "You have turned off loading of both snow and temperate terrain in 'FinalAlert.ini'. At least one of these must be loaded. The application will now quit.", "Error", 0);
|
||||
exit(-982);
|
||||
}
|
||||
|
||||
int EasyView;
|
||||
if (optini.sections["UserInterface"].FindName("EasyView") < 0)
|
||||
{
|
||||
if (userInterfaceSec.FindIndex("EasyView") < 0) {
|
||||
MessageBox(0, GetLanguageStringACP("ExplainEasyView"), GetLanguageStringACP("ExplainEasyViewCap"), 0);
|
||||
EasyView = 1;
|
||||
|
||||
optini.LoadFile(iniFile);
|
||||
optini.sections["UserInterface"].values["EasyView"] = "1";
|
||||
optini.SetInteger("UserInterface", "EasyView", 1);
|
||||
optini.SaveFile(iniFile);
|
||||
} else {
|
||||
EasyView = userInterfaceSec.GetInteger("EasyView");
|
||||
}
|
||||
else
|
||||
{
|
||||
EasyView = atoi(optini.sections["UserInterface"].values["EasyView"]);
|
||||
if (EasyView != 0) {
|
||||
theApp.m_Options.bEasy = TRUE;
|
||||
}
|
||||
if (EasyView != 0) theApp.m_Options.bEasy = TRUE;
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -109,7 +109,7 @@ public:
|
|||
//{{AFX_VIRTUAL(CFinalSunDlg)
|
||||
public:
|
||||
virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
|
||||
virtual int DoModal();
|
||||
virtual INT_PTR DoModal();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung
|
||||
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
|
||||
|
|
|
@ -100,19 +100,19 @@ void CGlobalsDlg::UpdateDialog()
|
|||
CString added=c;
|
||||
added+=" ";
|
||||
|
||||
if(ini.sections["VariableNames"].FindName(c)>=0)
|
||||
{
|
||||
added+=ini.sections["VariableNames"].values[c];
|
||||
}
|
||||
else
|
||||
{
|
||||
bFailFind=TRUE;
|
||||
added+=" No name";
|
||||
auto const& variableStr = ini.GetString("VariableNames", c);
|
||||
if (!variableStr.IsEmpty()) {
|
||||
added += variableStr;
|
||||
} else {
|
||||
bFailFind = TRUE;
|
||||
added += " No name";
|
||||
}
|
||||
|
||||
m_Global.SetItemData(m_Global.AddString(added),i);
|
||||
|
||||
if(bFailFind) break;
|
||||
if (bFailFind) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_Global.SetCurSel(oldsel);
|
||||
|
@ -136,8 +136,10 @@ void CGlobalsDlg::OnChangeDescription()
|
|||
|
||||
if(m_Description.Find(",")>=0) m_Description.SetAt(m_Description.Find(","), 0);
|
||||
|
||||
if(ini.sections["VariableNames"].values[c].GetLength()==0) ini.sections["VariableNames"].values[c]="text,0";
|
||||
ini.sections["VariableNames"].values[c]=SetParam(ini.sections["VariableNames"].values[c], 0, m_Description);
|
||||
if (ini.GetString( "VariableNames",c).IsEmpty()) {
|
||||
ini.SetString("VariableNames", c, "text,0");
|
||||
}
|
||||
ini.SetString("VariableNames", c, SetParam(ini.GetString("VariableNames", c), 0, m_Description));
|
||||
|
||||
// do not remove, Tiberian Sun seems to don´t like probably unused global numbers
|
||||
//if(m_Description.GetLength()==0)
|
||||
|
@ -158,13 +160,13 @@ void CGlobalsDlg::OnSelchangeGlobal()
|
|||
char c[50];
|
||||
itoa(curglob, c, 10);
|
||||
|
||||
if(ini.sections["VariableNames"].FindName(c)>=0)
|
||||
{
|
||||
m_Description=GetParam(ini.sections["VariableNames"].values[c],0);
|
||||
m_Value.SetWindowText(GetParam(ini.sections["VariableNames"].values[c],1));
|
||||
auto const& variable = ini.GetString("VariableNames", c);
|
||||
if (!variable.IsEmpty()) {
|
||||
m_Description = GetParam(variable, 0);
|
||||
m_Value.SetWindowText(GetParam(variable, 1));
|
||||
} else {
|
||||
m_Description = "";
|
||||
}
|
||||
else
|
||||
m_Description="";
|
||||
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
@ -197,14 +199,16 @@ void CGlobalsDlg::OnEditchangeValue()
|
|||
char c[50];
|
||||
itoa(curglob, c, 10);
|
||||
|
||||
if(ini.sections["VariableNames"].FindName(c)<0) return;
|
||||
|
||||
auto const& variable = ini.GetString("VariableNames", c);
|
||||
if (variable.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
str=GetParam(str, 0);
|
||||
TruncSpace(str);
|
||||
ini.sections["VariableNames"].values[c]=SetParam(ini.sections["VariableNames"].values[c], 1, str);
|
||||
ini.SetString("VariableNames", c, SetParam(variable, 1, str));
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
|
|
@ -111,50 +111,44 @@ void CHouses::UpdateDialog()
|
|||
ListHouses(m_Side, FALSE, TRUE);
|
||||
|
||||
int i;
|
||||
for(i=0;i<rules.sections[HOUSES].values.size();i++)
|
||||
{
|
||||
auto const& houseSec = rules[HOUSES];
|
||||
for (i = 0; i < houseSec.Size(); i++) {
|
||||
#ifdef RA2_MODE
|
||||
CString j=*rules.sections[HOUSES].GetValue(i);
|
||||
j.MakeLower();
|
||||
if(j=="nod" || j=="gdi") continue;
|
||||
auto const& name = houseSec.Nth(i).second;
|
||||
if (!name.CompareNoCase("nod") || !name.CompareNoCase("gdi")) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
char house_id[5];
|
||||
CString houseCString;
|
||||
itoa(i,house_id,10);
|
||||
houseCString=house_id;
|
||||
houseCString+=" ";
|
||||
houseCString+=TranslateHouse(*rules.sections[HOUSES].GetValue(i), TRUE);
|
||||
itoa(i, house_id, 10);
|
||||
CString houseCString = house_id;
|
||||
houseCString += " ";
|
||||
houseCString += TranslateHouse(name, TRUE);
|
||||
m_ActsLike.AddString(houseCString);
|
||||
}
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections.find(MAPHOUSES)==ini.sections.end() && ini.sections.size()>0)
|
||||
{
|
||||
if(!ini.TryGetSection(MAPHOUSES) && ini.Size()>0) {
|
||||
// MessageBox("No houses do exist, if you want to use houses, you should use ""Prepare houses"" before doing anything else.");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
m_HumanPlayer.AddString("None");
|
||||
m_HumanPlayer.SetCurSel(0);
|
||||
for(i=0;i<ini.sections[MAPHOUSES].values.size();i++)
|
||||
for(auto const& [seq, id]: ini[MAPHOUSES])
|
||||
{
|
||||
#ifdef RA2_MODE
|
||||
CString j=*ini.sections[MAPHOUSES].GetValue(i);
|
||||
j.MakeLower();
|
||||
if(j=="nod" || j=="gdi") continue;
|
||||
#endif
|
||||
m_houses.AddString(TranslateHouse(*ini.sections[MAPHOUSES].GetValue(i), TRUE));
|
||||
m_HumanPlayer.AddString(TranslateHouse(*ini.sections[MAPHOUSES].GetValue(i), TRUE));
|
||||
|
||||
if (!id.CompareNoCase("nod") || !id.CompareNoCase("gdi")) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
m_houses.AddString(TranslateHouse(id, TRUE));
|
||||
m_HumanPlayer.AddString(TranslateHouse(id, TRUE));
|
||||
}
|
||||
|
||||
|
||||
if(ini.sections["Basic"].values.find("Player")!=ini.sections["Basic"].values.end())
|
||||
{
|
||||
m_HumanPlayer.SetCurSel(m_HumanPlayer.FindStringExact(0, TranslateHouse(ini.sections["Basic"].values["Player"], TRUE)));
|
||||
|
||||
auto const& playerHouseStr = ini.GetString("Basic", "Player");
|
||||
if(!playerHouseStr.IsEmpty()) {
|
||||
m_HumanPlayer.SetCurSel(m_HumanPlayer.FindStringExact(0, TranslateHouse(playerHouseStr, TRUE)));
|
||||
}
|
||||
|
||||
m_houses.SetCurSel(0);
|
||||
|
@ -180,16 +174,14 @@ void CHouses::UpdateDialog()
|
|||
|
||||
|
||||
// ok now color list
|
||||
const auto& rulesColors = rules.sections["Colors"];
|
||||
for(i=0;i< rulesColors.values.size();i++)
|
||||
{
|
||||
m_Color.AddString(*rulesColors.GetValueName(i));
|
||||
const auto& rulesColors = rules["Colors"];
|
||||
for (auto const& [id, def] : rulesColors) {
|
||||
m_Color.AddString(id);
|
||||
}
|
||||
for (i = 0;i < ini.sections["Colors"].values.size();i++)
|
||||
{
|
||||
auto col = *ini.sections["Colors"].GetValueName(i);
|
||||
if(rulesColors.values.find(col) == rulesColors.values.end())
|
||||
m_Color.AddString(*ini.sections["Colors"].GetValueName(i));
|
||||
for (auto const& [id, def] : ini["Colors"]) {
|
||||
if (!rulesColors.Exists(id)) {
|
||||
m_Color.AddString(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,27 +214,27 @@ void CHouses::OnSelchangeHouses()
|
|||
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
auto const& s = ini[name];
|
||||
|
||||
// ListHouses(m_ActsLike, TRUE);
|
||||
|
||||
#ifndef RA2_MODE
|
||||
m_ActsLike.SetWindowText(s.values["ActsLike"]);
|
||||
#endif
|
||||
m_Allies.SetWindowText(TranslateHouse(s.values["Allies"], TRUE));
|
||||
m_Color.SetWindowText(s.values["Color"]);
|
||||
m_Credits.SetWindowText(s.values["Credits"]);
|
||||
m_Edge.SetWindowText(s.values["Edge"]);
|
||||
m_IQ.SetWindowText(s.values["IQ"]);
|
||||
m_Nodecount.SetWindowText(s.values["NodeCount"]);
|
||||
m_PercentBuilt.SetWindowText(s.values["PercentBuilt"]);
|
||||
m_PlayerControl.SetWindowText(s.values["PlayerControl"]);
|
||||
m_Allies.SetWindowText(TranslateHouse(s.GetString("Allies"), TRUE));
|
||||
m_Color.SetWindowText(s.GetString("Color"));
|
||||
m_Credits.SetWindowText(s.GetString("Credits"));
|
||||
m_Edge.SetWindowText(s.GetString("Edge"));
|
||||
m_IQ.SetWindowText(s.GetString("IQ"));
|
||||
m_Nodecount.SetWindowText(s.GetString("NodeCount"));
|
||||
m_PercentBuilt.SetWindowText(s.GetString("PercentBuilt"));
|
||||
m_PlayerControl.SetWindowText(s.GetString("PlayerControl"));
|
||||
#ifndef RA2_MODE
|
||||
m_Side.SetWindowText(s.values["Side"]);
|
||||
m_Side.SetWindowText(s.GetString("Side"));
|
||||
#else
|
||||
m_Side.SetWindowText(TranslateHouse(s.values["Country"], TRUE));
|
||||
m_Side.SetWindowText(TranslateHouse(s.GetString("Country"), TRUE));
|
||||
#endif
|
||||
m_TechLevel.SetWindowText(s.values["TechLevel"]);
|
||||
m_TechLevel.SetWindowText(s.GetString("TechLevel"));
|
||||
|
||||
}
|
||||
|
||||
|
@ -253,29 +245,27 @@ void CHouses::OnPreparehouses()
|
|||
#ifdef RA2_MODE
|
||||
if(Map->IsMultiplayer())
|
||||
{
|
||||
ini.sections["Basic"].values["MultiplayerOnly"]="1";
|
||||
ini.SetInteger("Basic", "MultiplayerOnly", 1);
|
||||
|
||||
int i;
|
||||
for (i=0;i<rules.sections[HOUSES].values.size();i++)
|
||||
{
|
||||
auto const rulesHouseSec = rules[HOUSES];
|
||||
for (auto i = 0;i < rulesHouseSec.Size();++i) {
|
||||
char c[50];
|
||||
int k=i;
|
||||
itoa(k,c,10);
|
||||
CString country=*rules.sections[HOUSES].GetValue(i);
|
||||
|
||||
auto const& country = rulesHouseSec.Nth(i).second;
|
||||
// we now create a MAPHOUSE with the same name as the current rules house
|
||||
ini.sections[MAPHOUSES].values[c]=country;
|
||||
|
||||
ini.sections[country].values["IQ"]="0";
|
||||
ini.sections[country].values["Edge"]="North";
|
||||
ini.sections[country].values["Color"]=rules.sections[country].values["Color"];
|
||||
ini.sections[country].values["Allies"]=country;
|
||||
ini.sections[country].values["Country"]=country;
|
||||
ini.sections[country].values["Credits"]="0";
|
||||
ini.sections[country].values["NodeCount"]="0";
|
||||
ini.sections[country].values["TechLevel"]="1";
|
||||
ini.sections[country].values["PercentBuilt"]="0";
|
||||
ini.sections[country].values["PlayerControl"]="no";
|
||||
ini.SetString(MAPHOUSES, c, country);
|
||||
|
||||
ini.SetString(country, "IQ", "0");
|
||||
ini.SetString(country, "Edge", "North");
|
||||
ini.SetString(country, "Color", rules.GetString(country, "Color"));
|
||||
ini.SetString(country, "Allies", country);
|
||||
ini.SetString(country, "Country", country);
|
||||
ini.SetString(country, "Credits", "0");
|
||||
ini.SetString(country, "NodeCount", "0");
|
||||
ini.SetString(country, "TechLevel", "1");
|
||||
ini.SetString(country, "PercentBuilt", "0");
|
||||
ini.SetString(country, "PlayerControl", "no");
|
||||
|
||||
}
|
||||
|
||||
|
@ -285,39 +275,33 @@ void CHouses::OnPreparehouses()
|
|||
#endif
|
||||
|
||||
// import the rules.ini houses
|
||||
if(ini.sections.find(MAPHOUSES)!=ini.sections.end())
|
||||
{
|
||||
if(ini.sections[MAPHOUSES].values.size()>0)
|
||||
{
|
||||
MessageBox("There are already houses in your map. You need to delete these first.");
|
||||
return;
|
||||
}
|
||||
if (ini[MAPHOUSES].Size() > 0) {
|
||||
MessageBox("There are already houses in your map. You need to delete these first.");
|
||||
return;
|
||||
}
|
||||
|
||||
int i;
|
||||
for(i=0;i<rules.sections[HOUSES].values.size();i++)
|
||||
{
|
||||
AddHouse(GetHouseSectionName(*rules.sections[HOUSES].GetValue(i)));
|
||||
for (auto const& [seq, id] : rules[HOUSES]) {
|
||||
AddHouse(GetHouseSectionName(id));
|
||||
}
|
||||
}
|
||||
|
||||
void CHouses::AddHouse(const char *name)
|
||||
void CHouses::AddHouse(const CString& name)
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections.find(name)!=ini.sections.end())
|
||||
{
|
||||
MessageBox(((CString)"Sorry this name is not available. " + name + (CString)" is already used in the map file. You need to use another name."));
|
||||
if (ini.TryGetSection(name)) {
|
||||
MessageBox("Sorry this name is not available. " + name + " is already used in the map file. You need to use another name.");
|
||||
return;
|
||||
}
|
||||
if(ini.sections.find(TranslateHouse(name))!=ini.sections.end())
|
||||
{
|
||||
MessageBox(((CString)"Sorry this name is not available. " + name + (CString)" is already used in the map file. You need to use another name."));
|
||||
if (ini.TryGetSection(TranslateHouse(name))) {
|
||||
MessageBox("Sorry this name is not available. " + name + " is already used in the map file. You need to use another name.");
|
||||
return;
|
||||
}
|
||||
#ifdef RA2_MODE
|
||||
CNewRA2HouseDlg dlg;
|
||||
if(dlg.DoModal()==IDCANCEL) return;
|
||||
if (dlg.DoModal() == IDCANCEL) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
int c;
|
||||
|
@ -331,17 +315,21 @@ void CHouses::AddHouse(const char *name)
|
|||
{
|
||||
char k[50];
|
||||
itoa(c,k,10);
|
||||
if(ini.sections[MAPHOUSES].values.find(k)==ini.sections[MAPHOUSES].values.end())
|
||||
pos=c;
|
||||
if(pos!=-1) break;
|
||||
if (!ini[MAPHOUSES].Exists(k)) {
|
||||
pos = c;
|
||||
}
|
||||
if (pos != -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef RA2_MODE
|
||||
for(c=0;c>-1;c++)
|
||||
{
|
||||
char k[50];
|
||||
itoa(c,k,10);
|
||||
if(ini.sections[HOUSES].values.find(k)==ini.sections[HOUSES].values.end())
|
||||
if (!ini[HOUSES].Exists(k)) {
|
||||
pos2=c;
|
||||
}
|
||||
if(pos2!=-1) break;
|
||||
}
|
||||
#endif
|
||||
|
@ -349,72 +337,77 @@ void CHouses::AddHouse(const char *name)
|
|||
char k[50];
|
||||
itoa(pos,k,10);
|
||||
|
||||
ini.sections[MAPHOUSES].values[k]=TranslateHouse(name);
|
||||
auto const translatedHouseName = TranslateHouse(name);
|
||||
ini.SetString(MAPHOUSES, k, translatedHouseName);
|
||||
|
||||
CString country;
|
||||
country=name;
|
||||
country = name;
|
||||
country.Replace(" House", "");
|
||||
country.Replace("House","");
|
||||
if(country.Find(" ")>=0) country.Replace(" ", "_"); //=country.Left(country.Find(" "));
|
||||
if (country.Find(" ") >= 0) {
|
||||
country.Replace(" ", "_"); //=country.Left(country.Find(" "));
|
||||
}
|
||||
|
||||
#ifdef RA2_MODE
|
||||
itoa(pos2, k, 10);
|
||||
ini.sections[HOUSES].values[k]=country;
|
||||
_itoa(pos2, k, 10);
|
||||
ini.SetString(HOUSES, k, country);
|
||||
#endif
|
||||
|
||||
ini.sections[TranslateHouse(name)].values["IQ"]="0";
|
||||
ini.sections[TranslateHouse(name)].values["Edge"]="West";
|
||||
ini.sections[TranslateHouse(name)].values["Allies"]=TranslateHouse(name);
|
||||
ini.SetInteger(translatedHouseName, "IQ", 0);
|
||||
ini.SetString(translatedHouseName, "Edge", "West");
|
||||
ini.SetString(translatedHouseName, "Allies", translatedHouseName);
|
||||
|
||||
CString side=name;
|
||||
CString side = name;
|
||||
#ifdef RA2_MODE
|
||||
side=rules.sections[TranslateHouse(dlg.m_Country)].values["Side"];
|
||||
side = rules.GetString(TranslateHouse(dlg.m_Country), "Side");
|
||||
#endif
|
||||
|
||||
if(strstr(name, "Nod")!=NULL)
|
||||
{
|
||||
if (strstr(name, "Nod") != NULL) {
|
||||
#ifndef RA2_MODE
|
||||
ini.sections[TranslateHouse(name)].values["Side"]="Nod";
|
||||
ini.sections[translatedHouseName].values["Side"]="Nod";
|
||||
#endif
|
||||
ini.sections[TranslateHouse(name)].values["Color"]="DarkRed";
|
||||
if(name!="Nod") ini.sections[name].values["Allies"]+=",Nod";
|
||||
}
|
||||
else
|
||||
{
|
||||
ini.SetString(translatedHouseName, "Color", "DarkRed");
|
||||
if (name != "Nod") {
|
||||
ini.SetString(name, "Allies", ini.GetString(name, "Allies") + ",Nod");
|
||||
}
|
||||
} else {
|
||||
#ifndef RA2_MODE
|
||||
ini.sections[TranslateHouse(name)].values["Side"]="GDI";
|
||||
ini.sections[translatedHouseName].values["Side"]="GDI";
|
||||
#endif
|
||||
ini.sections[TranslateHouse(name)].values["Color"]="Gold";
|
||||
if(name!="GDI") ini.sections[TranslateHouse(name)].values["Allies"]+=",GDI";
|
||||
ini.SetString(translatedHouseName, "Color", "Gold");
|
||||
if (name != "GDI") {
|
||||
ini.SetString(translatedHouseName, "Allies", ini.GetString(translatedHouseName, "Allies") + ",GDI");
|
||||
}
|
||||
}
|
||||
ini.sections[TranslateHouse(name)].values["Credits"]="0";
|
||||
ini.SetInteger(translatedHouseName, "Credits", 0);
|
||||
#ifndef RA2_MODE
|
||||
ini.sections[TranslateHouse(name)].values["ActsLike"]="0";
|
||||
ini.SetInteger(translatedHouseName, "ActsLike", 0);
|
||||
#else
|
||||
ini.sections[TranslateHouse(name)].values["Country"]=TranslateHouse(country);
|
||||
ini.SetString(translatedHouseName, "Country", TranslateHouse(country));
|
||||
#endif
|
||||
ini.sections[TranslateHouse(name)].values["NodeCount"]="0";
|
||||
ini.sections[TranslateHouse(name)].values["TechLevel"]="10";
|
||||
ini.sections[TranslateHouse(name)].values["PercentBuilt"]="100";
|
||||
ini.sections[TranslateHouse(name)].values["PlayerControl"]="no";
|
||||
ini.SetInteger(translatedHouseName, "NodeCount", 0);
|
||||
ini.SetInteger(translatedHouseName, "TechLevel", 10);
|
||||
ini.SetInteger(translatedHouseName, "PercentBuilt", 100);
|
||||
ini.SetBool(translatedHouseName, "PlayerControl", false);
|
||||
|
||||
#ifdef RA2_MODE
|
||||
dlg.m_Country=TranslateHouse(dlg.m_Country); // just to make sure...
|
||||
country=TranslateHouse(country);
|
||||
ini.sections[country].values["ParentCountry"]=dlg.m_Country;
|
||||
ini.sections[country].values["Name"]=country;
|
||||
ini.sections[country].values["Suffix"]=rules.sections[dlg.m_Country].values["Suffix"];
|
||||
ini.sections[country].values["Prefix"]=rules.sections[dlg.m_Country].values["Prefix"];
|
||||
ini.sections[country].values["Color"]=rules.sections[dlg.m_Country].values["Color"];
|
||||
ini.sections[country].values["Side"]=rules.sections[dlg.m_Country].values["Side"];
|
||||
ini.sections[country].values["SmartAI"]=rules.sections[dlg.m_Country].values["SmartAI"];
|
||||
ini.sections[country].values["CostUnitsMult"]="1";
|
||||
dlg.m_Country = TranslateHouse(dlg.m_Country); // just to make sure...
|
||||
country = TranslateHouse(country);
|
||||
ini.SetString(country, "ParentCountry", dlg.m_Country);
|
||||
ini.SetString(country, "Name", country);
|
||||
ini.SetString(country, "Suffix", rules.GetString(dlg.m_Country, "Suffix"));
|
||||
ini.SetString(country, "Prefix", rules.GetString(dlg.m_Country, "Prefix"));
|
||||
ini.SetString(country, "Color", rules.GetString(dlg.m_Country, "Color"));
|
||||
ini.SetString(country, "Side", rules.GetString(dlg.m_Country, "Side"));
|
||||
ini.SetString(country, "SmartAI", rules.GetString(dlg.m_Country, "SmartAI"));
|
||||
ini.SetInteger(country, "CostUnitsMult", 1);
|
||||
#endif
|
||||
|
||||
int cusel=m_houses.GetCurSel();
|
||||
UpdateDialog();
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs();
|
||||
if(cusel!=-1)m_houses.SetCurSel(cusel);
|
||||
if (cusel != -1) {
|
||||
m_houses.SetCurSel(cusel);
|
||||
}
|
||||
}
|
||||
|
||||
void CHouses::OnShowWindow(BOOL bShow, UINT nStatus)
|
||||
|
@ -423,10 +416,8 @@ void CHouses::OnShowWindow(BOOL bShow, UINT nStatus)
|
|||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(bShow)
|
||||
{
|
||||
if(ini.sections.find(MAPHOUSES)==ini.sections.end() && ini.sections.size()>0)
|
||||
{
|
||||
if (bShow) {
|
||||
if (!ini.TryGetSection(MAPHOUSES) && ini.Size() > 0) {
|
||||
#ifndef RA2_MODE
|
||||
MessageBox("No houses do exist, if you want to use houses, you should use ""Prepare houses"" before doing anything else. Note that in a multiplayer map independent computer players cannot be created by using the names GDI and Nod for the house. Just use something like GDI_AI.");
|
||||
#else
|
||||
|
@ -434,23 +425,20 @@ void CHouses::OnShowWindow(BOOL bShow, UINT nStatus)
|
|||
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
// call all KillFocus !
|
||||
OnKillfocusIq();
|
||||
OnEditchangeActslike();
|
||||
OnKillfocusAllies();
|
||||
OnKillfocusColor();
|
||||
OnKillfocusCredits();
|
||||
OnKillfocusEdge();
|
||||
OnKillfocusNodecount();
|
||||
OnKillfocusPercentbuilt();
|
||||
OnKillfocusPlayercontrol();
|
||||
OnKillfocusSide();
|
||||
OnKillfocusTechlevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
// call all KillFocus !
|
||||
OnKillfocusIq();
|
||||
OnEditchangeActslike();
|
||||
OnKillfocusAllies();
|
||||
OnKillfocusColor();
|
||||
OnKillfocusCredits();
|
||||
OnKillfocusEdge();
|
||||
OnKillfocusNodecount();
|
||||
OnKillfocusPercentbuilt();
|
||||
OnKillfocusPlayercontrol();
|
||||
OnKillfocusSide();
|
||||
OnKillfocusTechlevel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CHouses::OnAddhouse()
|
||||
|
@ -468,33 +456,31 @@ void CHouses::OnDeletehouse()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int cusel;
|
||||
cusel=m_houses.GetCurSel();
|
||||
if(cusel==-1) return;
|
||||
cusel = m_houses.GetCurSel();
|
||||
if (cusel == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString name;
|
||||
CString uiname;
|
||||
m_houses.GetLBText(cusel, name);
|
||||
|
||||
uiname=name;
|
||||
name=TranslateHouse(name);
|
||||
name = TranslateHouse(name);
|
||||
|
||||
CString str=GetLanguageStringACP("DeleteHouse");
|
||||
str=TranslateStringVariables(1, str, uiname);
|
||||
if(MessageBox(str,GetLanguageStringACP("DeleteHouseCap"),MB_YESNO)==IDNO) return;
|
||||
|
||||
ini.sections.erase((LPCTSTR)name);
|
||||
|
||||
int i;
|
||||
for(i=0;i<ini.sections[MAPHOUSES].values.size();i++)
|
||||
{
|
||||
if(*ini.sections[MAPHOUSES].GetValue(i)==name)
|
||||
{
|
||||
ini.sections[MAPHOUSES].values.erase(*ini.sections[MAPHOUSES].GetValueName(i));
|
||||
}
|
||||
str = TranslateStringVariables(1, str, uiname);
|
||||
if (MessageBox(str, GetLanguageStringACP("DeleteHouseCap"), MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(ini.sections[MAPHOUSES].values.size()==0)
|
||||
ini.sections.erase(MAPHOUSES);
|
||||
ini.DeleteSection(name);
|
||||
|
||||
ini.RemoveValueByKey(MAPHOUSES, name);
|
||||
|
||||
if (ini[MAPHOUSES].Size() == 0) {
|
||||
ini.DeleteSection(MAPHOUSES);
|
||||
}
|
||||
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs();
|
||||
UpdateDialog();
|
||||
|
@ -514,11 +500,9 @@ void CHouses::OnKillfocusIq()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_IQ.GetWindowText(t);
|
||||
s.values["IQ"]=t;
|
||||
ini.SetString(name, "IQ", t);
|
||||
}
|
||||
|
||||
void CHouses::OnKillfocusEdge()
|
||||
|
@ -535,11 +519,9 @@ void CHouses::OnKillfocusEdge()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_Edge.GetWindowText(t);
|
||||
s.values["Edge"]=t;
|
||||
ini.SetString(name, "Edge", t);
|
||||
}
|
||||
|
||||
void CHouses::OnKillfocusSide()
|
||||
|
@ -556,15 +538,13 @@ void CHouses::OnKillfocusSide()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_Side.GetWindowText(t);
|
||||
t=TranslateHouse(t);
|
||||
#ifndef RA2_MODE
|
||||
s.values["Side"]=t;
|
||||
ini.SetString(name, "Side", t);
|
||||
#else
|
||||
s.values["Country"]=t;
|
||||
ini.SetString(name, "Country", t);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -582,11 +562,9 @@ void CHouses::OnKillfocusColor()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_Color.GetWindowText(t);
|
||||
s.values["Color"]=t;
|
||||
ini.SetString(name, "Color", t);
|
||||
|
||||
//Map->UpdateIniFile(MAPDATA_UPDATE_FROM_INI);
|
||||
// MW fix: Only update structures
|
||||
|
@ -612,12 +590,10 @@ void CHouses::OnKillfocusAllies()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_Allies.GetWindowText(t);
|
||||
t=TranslateHouse(t);
|
||||
s.values["Allies"]=t;
|
||||
ini.SetString(name, "Allies", t);
|
||||
}
|
||||
|
||||
void CHouses::OnKillfocusCredits()
|
||||
|
@ -634,11 +610,9 @@ void CHouses::OnKillfocusCredits()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_Credits.GetWindowText(t);
|
||||
s.values["Credits"]=t;
|
||||
ini.SetString(name, "Credits", t);
|
||||
}
|
||||
|
||||
void CHouses::OnEditchangeActslike()
|
||||
|
@ -655,15 +629,11 @@ void CHouses::OnEditchangeActslike()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_ActsLike.GetWindowText(t);
|
||||
TruncSpace(t);
|
||||
t=TranslateHouse(t);
|
||||
s.values["ActsLike"]=t;
|
||||
ini.SetString(name, "ActsLike", t);
|
||||
}
|
||||
|
||||
void CHouses::OnKillfocusNodecount()
|
||||
|
@ -680,11 +650,9 @@ void CHouses::OnKillfocusNodecount()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_Nodecount.GetWindowText(t);
|
||||
s.values["NodeCount"]=t;
|
||||
ini.SetString(name, "NodeCount", t);
|
||||
}
|
||||
|
||||
void CHouses::OnKillfocusTechlevel()
|
||||
|
@ -701,11 +669,9 @@ void CHouses::OnKillfocusTechlevel()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_TechLevel.GetWindowText(t);
|
||||
s.values["TechLevel"]=t;
|
||||
ini.SetString(name, "TechLevel", t);
|
||||
}
|
||||
|
||||
void CHouses::OnKillfocusPercentbuilt()
|
||||
|
@ -722,11 +688,9 @@ void CHouses::OnKillfocusPercentbuilt()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_PercentBuilt.GetWindowText(t);
|
||||
s.values["PercentBuilt"]=t;
|
||||
ini.SetString(name, "PercentBuilt", t);
|
||||
}
|
||||
|
||||
void CHouses::OnKillfocusPlayercontrol()
|
||||
|
@ -743,11 +707,9 @@ void CHouses::OnKillfocusPlayercontrol()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_PlayerControl.GetWindowText(t);
|
||||
s.values["PlayerControl"]=t;
|
||||
ini.SetString(name, "PlayerControl", t);
|
||||
}
|
||||
|
||||
void CHouses::OnSelchangeHumanplayer()
|
||||
|
@ -758,14 +720,12 @@ void CHouses::OnSelchangeHumanplayer()
|
|||
m_HumanPlayer.GetLBText(m_HumanPlayer.GetCurSel(),pl);
|
||||
pl=TranslateHouse(pl);
|
||||
|
||||
if(pl.GetLength()==0 || pl=="None")
|
||||
{
|
||||
ini.sections["Basic"].values.erase("Player");
|
||||
}
|
||||
else
|
||||
{
|
||||
ini.sections["Basic"].values["Player"]=(LPCTSTR)pl;
|
||||
if(pl.GetLength()==0 || pl=="None") {
|
||||
ini.RemoveValueByKey("Basic", "Player");
|
||||
return;
|
||||
}
|
||||
|
||||
ini.SetString("Basic", "Player", pl);
|
||||
}
|
||||
|
||||
void CHouses::OnSelchangeActslike()
|
||||
|
@ -780,15 +740,11 @@ void CHouses::OnSelchangeActslike()
|
|||
m_houses.GetLBText(cusel, name);
|
||||
name=TranslateHouse(name);
|
||||
|
||||
|
||||
|
||||
CIniFileSection& s=ini.sections[(LPCTSTR)name];
|
||||
|
||||
CString t;
|
||||
m_ActsLike.GetLBText(m_ActsLike.GetCurSel(),t);
|
||||
TruncSpace(t);
|
||||
t=TranslateHouse(t);
|
||||
s.values["ActsLike"]=t;
|
||||
ini.SetString(name, "ActsLike", t);
|
||||
}
|
||||
|
||||
void CHouses::UpdateStrings()
|
||||
|
|
|
@ -37,7 +37,7 @@ class CHouses : public CDialog
|
|||
// Konstruktion
|
||||
public:
|
||||
void UpdateStrings();
|
||||
void AddHouse(const char* name);
|
||||
void AddHouse(const CString& name);
|
||||
void UpdateDialog();
|
||||
CHouses();
|
||||
~CHouses();
|
||||
|
|
|
@ -90,15 +90,18 @@ BOOL CImportINI::OnInitDialog()
|
|||
CIniFile inifile;
|
||||
inifile.LoadFile(this->m_FileName);
|
||||
|
||||
if(inifile.sections.size()<1){MessageBox("File does not have any ini content, abort.","Error");EndDialog(IDCANCEL);return TRUE;}
|
||||
if (inifile.Size() < 1) {
|
||||
MessageBox("File does not have any ini content, abort.", "Error");
|
||||
EndDialog(IDCANCEL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
m_inicount=inifile.sections.size();
|
||||
m_inicount = inifile.Size();
|
||||
|
||||
int i;
|
||||
for(i=0;i<inifile.sections.size();i++)
|
||||
{
|
||||
if(!Map->IsMapSection(*inifile.GetSectionName(i)))
|
||||
m_Available.InsertString(-1, *inifile.GetSectionName(i));
|
||||
for (auto const& [secName, _] : inifile) {
|
||||
if (!Map->IsMapSection(secName)) {
|
||||
m_Available.InsertString(-1, secName);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
|
|
@ -38,18 +38,8 @@ static char THIS_FILE[] = __FILE__;
|
|||
|
||||
using namespace std;
|
||||
|
||||
bool SortDummy::operator()(const CString& x, const CString& y) const
|
||||
{
|
||||
// the length is more important than spelling (numbers!!!)...
|
||||
if (x.GetLength() < y.GetLength()) return true;
|
||||
if (x.GetLength() == y.GetLength())
|
||||
{
|
||||
if (x < y) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
const CIniFileSection CIniFile::EmptySection;
|
||||
const CString CIniFileSection::EmptyValue;
|
||||
|
||||
typedef map<CString, CIniFileSection>::iterator CIniI;
|
||||
typedef map<CString, CString, SortDummy>::iterator SI;
|
||||
|
@ -95,14 +85,12 @@ void CIniFile::Clear()
|
|||
|
||||
CIniFileSection::CIniFileSection()
|
||||
{
|
||||
values.clear();
|
||||
value_orig_pos.clear();
|
||||
};
|
||||
|
||||
CIniFileSection::~CIniFileSection()
|
||||
{
|
||||
values.clear();
|
||||
value_orig_pos.clear();
|
||||
value_pos.clear();
|
||||
value_pairs.clear();
|
||||
};
|
||||
|
||||
WORD CIniFile::InsertFile(const CString& filename, const char* Section, BOOL bNoSpaces)
|
||||
|
@ -158,16 +146,12 @@ WORD CIniFile::InsertFile(const std::string& filename, const char* Section, BOOL
|
|||
CString name = cLine.substr(0, equals).c_str();
|
||||
CString value = cLine.substr(equals + 1, cLine.size() - equals - 1).c_str();
|
||||
|
||||
int cuValueIndex = sections[cSec].values.size();
|
||||
|
||||
if (bNoSpaces)
|
||||
{
|
||||
name.Trim();
|
||||
value.Trim();
|
||||
}
|
||||
|
||||
sections[cSec].values[name] = value;
|
||||
sections[cSec].value_orig_pos[name] = cuValueIndex;
|
||||
sections[cSec].SetString(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,83 +164,6 @@ WORD CIniFile::InsertFile(const std::string& filename, const char* Section, BOOL
|
|||
return 0;
|
||||
}
|
||||
|
||||
const CIniFileSection* CIniFile::GetSection(std::size_t index) const
|
||||
{
|
||||
if (index > sections.size() - 1)
|
||||
return NULL;
|
||||
|
||||
auto i = sections.cbegin();
|
||||
for (auto e = 0;e < index;e++)
|
||||
i++;
|
||||
|
||||
return &i->second;
|
||||
}
|
||||
|
||||
CIniFileSection* CIniFile::GetSection(std::size_t index)
|
||||
{
|
||||
if (index > sections.size() - 1)
|
||||
return NULL;
|
||||
|
||||
CIniI i = sections.begin();
|
||||
for (auto e = 0;e < index;e++)
|
||||
i++;
|
||||
|
||||
return &i->second;
|
||||
}
|
||||
|
||||
const CIniFileSection* CIniFile::GetSection(const CString& section) const
|
||||
{
|
||||
auto it = sections.find(section);
|
||||
if (it == sections.end())
|
||||
return nullptr;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
CIniFileSection* CIniFile::GetSection(const CString& section)
|
||||
{
|
||||
auto it = sections.find(section);
|
||||
if (it == sections.end())
|
||||
return nullptr;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
const CString* CIniFileSection::GetValue(std::size_t index) const noexcept
|
||||
{
|
||||
if (index > values.size() - 1)
|
||||
return NULL;
|
||||
|
||||
auto i = values.begin();
|
||||
for (auto e = 0;e < index;e++)
|
||||
i++;
|
||||
|
||||
return &i->second;
|
||||
}
|
||||
|
||||
CString* CIniFileSection::GetValue(std::size_t index) noexcept
|
||||
{
|
||||
if (index > values.size() - 1)
|
||||
return NULL;
|
||||
|
||||
auto i = values.begin();
|
||||
for (auto e = 0; e < index; e++) {
|
||||
if (i == values.end()) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (i == values.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &i->second;
|
||||
}
|
||||
|
||||
CString CIniFileSection::GetValueByName(const CString& valueName, const CString& defaultValue) const
|
||||
{
|
||||
auto it = values.find(valueName);
|
||||
return (it == values.end()) ? defaultValue : it->second;
|
||||
}
|
||||
|
||||
const CString* CIniFile::GetSectionName(std::size_t index) const noexcept
|
||||
{
|
||||
if (index > sections.size() - 1)
|
||||
|
@ -269,24 +176,6 @@ const CString* CIniFile::GetSectionName(std::size_t index) const noexcept
|
|||
return &(i->first);
|
||||
}
|
||||
|
||||
CString& CIniFileSection::AccessValueByName(const CString& valueName)
|
||||
{
|
||||
return values[valueName];
|
||||
}
|
||||
|
||||
const CString* CIniFileSection::GetValueName(std::size_t index) const noexcept
|
||||
{
|
||||
if (index > values.size() - 1)
|
||||
return NULL;
|
||||
|
||||
auto i = values.begin();
|
||||
for (auto e = 0; e < index; ++e)
|
||||
i++;
|
||||
|
||||
|
||||
return &(i->first);
|
||||
}
|
||||
|
||||
BOOL CIniFile::SaveFile(const CString& filename) const
|
||||
{
|
||||
return SaveFile(std::string(filename.GetString()));
|
||||
|
@ -298,14 +187,10 @@ BOOL CIniFile::SaveFile(const std::string& Filename) const
|
|||
|
||||
file.open(Filename, ios::out | ios::trunc);
|
||||
|
||||
int i;
|
||||
for (i = 0;i < sections.size();i++)
|
||||
{
|
||||
file << "[" << (LPCTSTR)*GetSectionName(i) << "]" << endl;
|
||||
int e;
|
||||
for (e = 0;e < GetSection(i)->values.size();e++)
|
||||
{
|
||||
file << (LPCTSTR) * (GetSection(i)->GetValueName(e)) << "=" << (LPCTSTR)*GetSection(i)->GetValue(e) << endl;
|
||||
for (auto const& sec : sections) {
|
||||
file << "[" << sec.first << "]" << endl;
|
||||
for (auto const& pair : sec.second) {
|
||||
file << pair.first << "=" << pair.second << endl;
|
||||
}
|
||||
file << endl;
|
||||
}
|
||||
|
@ -316,97 +201,32 @@ BOOL CIniFile::SaveFile(const std::string& Filename) const
|
|||
}
|
||||
|
||||
|
||||
int CIniFileSection::FindValue(CString sval) const noexcept
|
||||
int64_t CIniFileSection::FindValue(CString val) const noexcept
|
||||
{
|
||||
int i;
|
||||
auto it = values.cbegin();
|
||||
for (i = 0;i < values.size();i++)
|
||||
{
|
||||
if (sval == it->second)
|
||||
return i;
|
||||
it++;
|
||||
for (size_t idx = 0;
|
||||
idx < this->value_pairs.size();
|
||||
++idx) {
|
||||
if (this->value_pairs[idx].second == val) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CIniFileSection::FindName(CString sval) const noexcept
|
||||
int64_t CIniFileSection::FindIndex(const CString& key) const noexcept
|
||||
{
|
||||
int i;
|
||||
auto it = values.cbegin();
|
||||
for (i = 0;i < values.size();i++)
|
||||
{
|
||||
if (sval == it->first)
|
||||
return i;
|
||||
it++;
|
||||
auto const it = this->value_pos.find(key);
|
||||
if (it != this->value_pos.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CIniFile::DeleteLeadingSpaces(BOOL bValueNames, BOOL bValues)
|
||||
{
|
||||
int i;
|
||||
for (i = 0;i < sections.size();i++)
|
||||
{
|
||||
CIniFileSection& sec = *GetSection(i);
|
||||
int e;
|
||||
for (e = 0;e < sec.values.size();e++)
|
||||
{
|
||||
if (bValues) sec.GetValue(e)->TrimLeft();
|
||||
if (bValueNames)
|
||||
{
|
||||
CString value = *sec.GetValue(e);
|
||||
CString name = *sec.GetValueName(e);
|
||||
|
||||
sec.values.erase(name);
|
||||
name.TrimLeft();
|
||||
sec.values[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CIniFile::DeleteEndingSpaces(BOOL bValueNames, BOOL bValues)
|
||||
{
|
||||
int i;
|
||||
for (i = 0;i < sections.size();i++)
|
||||
{
|
||||
CIniFileSection& sec = *GetSection(i);
|
||||
int e;
|
||||
for (e = 0;e < sec.values.size();e++)
|
||||
{
|
||||
if (bValues) sec.GetValue(e)->TrimRight();
|
||||
if (bValueNames)
|
||||
{
|
||||
//CString& name=(CString&)*sec.GetValueName(e);
|
||||
//name.TrimRight();
|
||||
CString value = *sec.GetValue(e);
|
||||
CString name = *sec.GetValueName(e);
|
||||
|
||||
sec.values.erase(name);
|
||||
name.TrimRight();
|
||||
sec.values[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CString CIniFile::GetValueByName(const CString& sectionName, const CString& valueName, const CString& defaultValue) const
|
||||
{
|
||||
auto section = GetSection(sectionName);
|
||||
if (!section)
|
||||
auto section = TryGetSection(sectionName);
|
||||
if (!section) {
|
||||
return defaultValue;
|
||||
return section->GetValueByName(valueName, defaultValue);
|
||||
}
|
||||
return section->GetStringOr(valueName, defaultValue);
|
||||
}
|
||||
|
||||
int CIniFileSection::GetValueOrigPos(int index) const noexcept
|
||||
{
|
||||
if (index > value_orig_pos.size() - 1)
|
||||
return -1;
|
||||
|
||||
auto i = value_orig_pos.cbegin();
|
||||
for (int e = 0;e < index;e++)
|
||||
i++;
|
||||
|
||||
return i->second;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,82 +33,220 @@
|
|||
#include <map>
|
||||
#include <CString>
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <ios>
|
||||
|
||||
#include "IniHelper.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class SortDummy
|
||||
{
|
||||
public:
|
||||
bool operator() (const CString&, const CString&) const;
|
||||
bool operator()(const CString& x, const CString& y) const
|
||||
{
|
||||
// the length is more important than spelling (numbers!!!)...
|
||||
if (x.GetLength() < y.GetLength()) {
|
||||
return true;
|
||||
}
|
||||
if (x.GetLength() == y.GetLength()) {
|
||||
if (x < y) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class CIniFileSection
|
||||
{
|
||||
static const CString EmptyValue;
|
||||
public:
|
||||
|
||||
CIniFileSection();
|
||||
virtual ~CIniFileSection();
|
||||
|
||||
CString GetValueByName(const CString& name, const CString& defaultValue = CString()) const;
|
||||
CString& AccessValueByName(const CString& name);
|
||||
[[deprecated("instead use GetString or TryGetString")]]
|
||||
const CString& AccessValueByName(const CString& name) const {
|
||||
return GetString(name);
|
||||
}
|
||||
|
||||
auto begin() noexcept
|
||||
{
|
||||
return values.begin();
|
||||
auto const& Nth(size_t index) const {
|
||||
ASSERT(index < value_pairs.size());
|
||||
return this->value_pairs[index];
|
||||
}
|
||||
int64_t FindIndex(const CString& key) const noexcept;
|
||||
int64_t FindValue(CString val) const noexcept;
|
||||
|
||||
const CString& operator[](const CString& key) const {
|
||||
return this->GetString(key);
|
||||
}
|
||||
|
||||
const CString* TryGetString(const CString& key) const {
|
||||
auto const it = value_pos.find(key);
|
||||
if (it != value_pos.end()) {
|
||||
return &this->value_pairs[it->second].second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::pair<int, bool> TryGetInteger(const CString& key) const {
|
||||
auto const got = this->TryGetString(key);
|
||||
if (!got) {
|
||||
return {};
|
||||
}
|
||||
return { INIHelper::StringToInteger(*got, 0), true };
|
||||
}
|
||||
|
||||
const CString& GetString(const CString& key) const {
|
||||
if (auto const ret = TryGetString(key)) {
|
||||
return *ret;
|
||||
}
|
||||
return EmptyValue;
|
||||
}
|
||||
CString GetStringOr(const CString& key, const CString& defaultValue) const {
|
||||
auto const it = value_pos.find(key);
|
||||
if (it != value_pos.end()) {
|
||||
return this->value_pairs[it->second].second;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
int GetInteger(const CString& key, int def = 0) const {
|
||||
return INIHelper::StringToInteger(this->GetString(key), def);
|
||||
}
|
||||
|
||||
float GetFloat(const CString& key, float def = 0.0) const {
|
||||
return INIHelper::StringToFloat(this->GetString(key), def);
|
||||
}
|
||||
|
||||
bool GetBool(const CString& key, bool def = false) const {
|
||||
auto const& str = this->GetString(key);
|
||||
return INIHelper::StringToBool(str, def);
|
||||
}
|
||||
|
||||
size_t Size() const { return value_pos.size(); }
|
||||
|
||||
bool Exists(const CString& key) const {
|
||||
auto const it = value_pos.find(key);
|
||||
return it != value_pos.end();
|
||||
}
|
||||
bool HasValue(const CString& val) const {
|
||||
return this->FindValue(val) >= 0;
|
||||
}
|
||||
|
||||
void SetString(const CString& key, const CString& value) {
|
||||
return this->SetString(key, CString(value));
|
||||
}
|
||||
|
||||
void SetString(const CString& key, CString&& value) {
|
||||
auto const it = value_pos.find(key);
|
||||
// new, never had one
|
||||
if (it == value_pos.end()) {
|
||||
this->Insert(key, std::move(value));
|
||||
return;
|
||||
}
|
||||
value_pairs[it->second].second = std::move(value);
|
||||
}
|
||||
|
||||
void SetInteger(const CString& key, const int val) {
|
||||
this->SetString(key, INIHelper::ToString(val));
|
||||
}
|
||||
|
||||
void SetBool(const CString& key, const bool val) {
|
||||
this->SetString(key, INIHelper::ToString(val));
|
||||
}
|
||||
|
||||
void Insert(const CString& key, const CString& value) {
|
||||
this->Insert(key, CString(value));
|
||||
}
|
||||
|
||||
void Insert(const CString& key, CString&& value) {
|
||||
value_pairs.push_back({ key, value });
|
||||
value_pos.insert_or_assign(key, value_pairs.size() - 1);
|
||||
}
|
||||
|
||||
// ==================== Delete
|
||||
|
||||
void RemoveAt(size_t idx) {
|
||||
ASSERT(idx < value_pairs.size());
|
||||
// delete from record first;
|
||||
auto const& pair = value_pairs.at(idx);
|
||||
ASSERT(value_pos.erase(pair.first) == 1);
|
||||
value_pairs.erase(value_pairs.begin() + idx);
|
||||
// now update all key-pos indexing, dec 1
|
||||
for (auto affectedIdx = idx; affectedIdx < value_pairs.size(); ++affectedIdx) {
|
||||
auto const& kvPair = value_pairs[affectedIdx];
|
||||
auto const it = value_pos.find(kvPair.first);
|
||||
ASSERT(it != value_pos.end());
|
||||
it->second--;
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveByKey(const CString& key) {
|
||||
auto const idx = this->FindIndex(key);
|
||||
if (idx >= 0) {
|
||||
RemoveAt(idx);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveValue(const CString& val) {
|
||||
auto const idx = this->FindValue(val);
|
||||
if (idx >= 0) {
|
||||
RemoveAt(idx);
|
||||
}
|
||||
}
|
||||
|
||||
auto begin() const noexcept
|
||||
{
|
||||
return values.begin();
|
||||
}
|
||||
|
||||
auto end() noexcept
|
||||
{
|
||||
return values.end();
|
||||
return value_pairs.begin();
|
||||
}
|
||||
|
||||
auto end() const noexcept
|
||||
{
|
||||
return values.end();
|
||||
return value_pairs.end();
|
||||
}
|
||||
|
||||
[[deprecated("instead use iterators or for_each")]]
|
||||
int GetValueOrigPos(int index) const noexcept;
|
||||
// get key
|
||||
const CString* GetValueName(std::size_t index) const noexcept {
|
||||
return &Nth(index).first;
|
||||
}
|
||||
|
||||
[[deprecated("instead use iterators or for_each")]]
|
||||
int FindName(CString sval) const noexcept;
|
||||
|
||||
[[deprecated("instead use iterators or for_each")]]
|
||||
int FindValue(CString sval) const noexcept;
|
||||
|
||||
[[deprecated("instead use iterators or for_each")]]
|
||||
const CString* GetValueName(std::size_t index) const noexcept;
|
||||
|
||||
[[deprecated("instead use iterators or for_each")]]
|
||||
const CString* GetValue(std::size_t index) const noexcept;
|
||||
|
||||
[[deprecated("instead use iterators or for_each")]]
|
||||
CString* GetValue(std::size_t index) noexcept;
|
||||
|
||||
public:
|
||||
map<CString, CString, SortDummy> values;
|
||||
map<CString, int, SortDummy> value_orig_pos;
|
||||
private:
|
||||
map<CString, int64_t, SortDummy> value_pos{};
|
||||
vector<std::pair<CString, CString>> value_pairs{};// sequenced
|
||||
mutable bool isRegistry{false};
|
||||
};
|
||||
|
||||
class CIniFile
|
||||
{
|
||||
using StorageMap = map<CString, CIniFileSection>;
|
||||
|
||||
static const CIniFileSection EmptySection;
|
||||
|
||||
public:
|
||||
void DeleteEndingSpaces(BOOL bValueNames, BOOL bValues);
|
||||
void DeleteLeadingSpaces(BOOL bValueNames, BOOL bValues);
|
||||
|
||||
const CString* GetSectionName(std::size_t Index) const noexcept;
|
||||
const CIniFileSection* GetSection(std::size_t index) const;
|
||||
CIniFileSection* GetSection(std::size_t index);
|
||||
const CIniFileSection* GetSection(const CString& section) const;
|
||||
CIniFileSection* GetSection(const CString& section);
|
||||
CIniFile(CIniFile&& rhs) noexcept :
|
||||
m_filename(std::move(rhs.m_filename)),
|
||||
sections(std::move(rhs.sections))
|
||||
{}
|
||||
CIniFile(const CIniFile& rhs) noexcept :
|
||||
m_filename(rhs.m_filename),
|
||||
sections(rhs.sections)
|
||||
{}
|
||||
|
||||
CIniFile& operator=(CIniFile&& rhs) noexcept {
|
||||
new (this)CIniFile(std::move(rhs));
|
||||
return *this;
|
||||
}
|
||||
CIniFile& operator=(const CIniFile& rhs) noexcept {
|
||||
new (this)CIniFile(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
[[deprecated("instead use GetString")]]
|
||||
CString GetValueByName(const CString& sectionName, const CString& valueName, const CString& defaultValue) const;
|
||||
void Clear();
|
||||
WORD InsertFile(const CString& filename, const char* Section, BOOL bNoSpaces = FALSE);
|
||||
|
@ -118,6 +256,104 @@ public:
|
|||
WORD LoadFile(const CString& filename, BOOL bNoSpaces = FALSE);
|
||||
WORD LoadFile(const std::string& filename, BOOL bNoSpaces = FALSE);
|
||||
|
||||
// ================ Section interfaces ================
|
||||
|
||||
const CString* GetSectionName(std::size_t Index) const noexcept;
|
||||
const CIniFileSection* TryGetSection(const CString& section) const
|
||||
{
|
||||
auto pMutThis = const_cast<std::remove_cv_t<std::remove_pointer_t<decltype(this)>>*>(this);
|
||||
return pMutThis->TryGetSection(section);
|
||||
}
|
||||
|
||||
CIniFileSection* TryGetSection(const CString& section)
|
||||
{
|
||||
auto it = sections.find(section);
|
||||
if (it != sections.end()) {
|
||||
return &it->second;
|
||||
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const CIniFileSection& GetSection(const CString& section) const {
|
||||
if (auto found = this->TryGetSection(section)) {
|
||||
return *found;
|
||||
}
|
||||
return EmptySection;
|
||||
}
|
||||
|
||||
const CIniFileSection& operator[](const CString& section) const {
|
||||
return this->GetSection(section);
|
||||
}
|
||||
|
||||
bool DeleteSection(const CString& section) {
|
||||
return sections.erase(section) > 0;
|
||||
}
|
||||
|
||||
typename StorageMap::iterator DeleteAt(const StorageMap::iterator pos) {
|
||||
return sections.erase(pos);
|
||||
}
|
||||
|
||||
// ============= Reader and Helper converter ============================
|
||||
const CString& GetString(const CString& section, const CString& key) const {
|
||||
return GetSection(section).GetString(key);
|
||||
}
|
||||
const CString GetStringOr(const CString& section, const CString& key, const CString& def) const {
|
||||
return GetSection(section).GetStringOr(key, def);
|
||||
}
|
||||
const bool GetBool(const CString& section, const CString& key, bool def = false) const {
|
||||
return this->GetSection(section).GetBool(key, def);
|
||||
}
|
||||
const int GetInteger(const CString& section, const CString& key, int def = 0) const {
|
||||
return GetSection(section).GetInteger(key, def);
|
||||
}
|
||||
|
||||
// ============== Writer and Helper converter ============================
|
||||
CIniFileSection& AddSection(CString&& sectionName) {
|
||||
auto const ret = this->sections.insert({ std::move(sectionName), {}});
|
||||
return ret.first->second;
|
||||
}
|
||||
CIniFileSection& AddSection(const CString& sectionName) {
|
||||
return this->AddSection(CString(sectionName));
|
||||
}
|
||||
|
||||
void SetSection(const CString& sectionName, const CIniFileSection& sec) {
|
||||
sections.insert_or_assign(sectionName, sec);
|
||||
}
|
||||
|
||||
void SetString(const CString& section, const CString& key, CString&& value) {
|
||||
auto const it = sections.find(section);
|
||||
if (it != sections.end()) {
|
||||
it->second.SetString(key, value);
|
||||
return;
|
||||
}
|
||||
auto&& newSec = CIniFileSection{};
|
||||
newSec.SetString(key, value);
|
||||
ASSERT(sections.insert({ section, std::move(newSec) }).second == true);
|
||||
}
|
||||
|
||||
void SetString(const CString& section, const CString& key, const CString& value) {
|
||||
return this->SetString(section, key, CString(value));
|
||||
}
|
||||
|
||||
void SetBool(const CString& section, const CString& key, const bool value) {
|
||||
this->SetString(section, key, INIHelper::ToString(value));
|
||||
}
|
||||
void SetInteger(const CString& section, const CString& key, const int value) {
|
||||
this->SetString(section, key, INIHelper::ToString(value));
|
||||
}
|
||||
|
||||
void RemoveValueByKey(const CString& section, const CString& key) {
|
||||
if (auto pSec = this->TryGetSection(section)) {
|
||||
pSec->RemoveByKey(key);
|
||||
}
|
||||
}
|
||||
|
||||
// ================= Iterator Related =============================
|
||||
|
||||
auto Size() const noexcept {
|
||||
return this->sections.size();
|
||||
}
|
||||
|
||||
auto begin() noexcept
|
||||
{
|
||||
|
@ -139,12 +375,12 @@ public:
|
|||
return sections.end();
|
||||
}
|
||||
|
||||
map<CString, CIniFileSection> sections;
|
||||
CIniFile();
|
||||
virtual ~CIniFile();
|
||||
|
||||
private:
|
||||
std::string m_filename;
|
||||
StorageMap sections;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_INIFILE_H__96455620_6528_11D3_99E0_DB2A1EF71411__INCLUDED_)
|
||||
|
|
65
MissionEditor/IniHelper.h
Normal file
65
MissionEditor/IniHelper.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
#pragma once
|
||||
#include <CString>
|
||||
#include <ctype.h>
|
||||
|
||||
class INIHelper
|
||||
{
|
||||
public:
|
||||
static bool StringToBool(const CString& str, bool def)
|
||||
{
|
||||
switch (toupper(static_cast<unsigned char>(*str))) {
|
||||
case '1':
|
||||
case 'T':
|
||||
case 'Y':
|
||||
return true;
|
||||
case '0':
|
||||
case 'F':
|
||||
case 'N':
|
||||
return false;
|
||||
default:
|
||||
return def;
|
||||
}
|
||||
}
|
||||
static int StringToInteger(const CString& str, int def)
|
||||
{
|
||||
int ret = 0;
|
||||
if (sscanf_s(str, "%d", &ret) == 1) {
|
||||
return ret;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
static double StringToDouble(const CString& str, double def)
|
||||
{
|
||||
double ret = 0;
|
||||
if (sscanf_s(str, "%lf", &ret) == 1) {
|
||||
if (strchr(str, '%')) {
|
||||
ret *= 0.01;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
static float StringToFloat(const CString& str, float def)
|
||||
{
|
||||
return static_cast<float>(StringToDouble(str, def));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static CString ToString(const T& origin);// { static_assert(false, "T must have specialized implementations!"); }
|
||||
|
||||
template<>
|
||||
static CString ToString<bool>(const bool& origin)
|
||||
{
|
||||
static CString result[] = { "no", "yes" };
|
||||
return result[origin];
|
||||
}
|
||||
|
||||
template<>
|
||||
static CString ToString<int>(const int& origin)
|
||||
{
|
||||
char buffer[0x100];
|
||||
_itoa_s(origin, buffer, 10);
|
||||
buffer[sizeof buffer - 1] = '\0';
|
||||
return buffer;
|
||||
}
|
||||
};
|
|
@ -44,10 +44,11 @@ CString InputBox(const char* Sentence, const char* Caption)
|
|||
CInputBox inp;
|
||||
inp.SetCaption(Caption);
|
||||
inp.SetSentence(Sentence);
|
||||
char* res=(char*) inp.DoModal();
|
||||
CString cstr=res;
|
||||
|
||||
return cstr;
|
||||
if (inp.DoModal()) {
|
||||
return inp.GetResult();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
CInputBox::CInputBox(CWnd* pParent /*=NULL*/)
|
||||
|
@ -75,22 +76,22 @@ END_MESSAGE_MAP()
|
|||
|
||||
|
||||
|
||||
void CInputBox::OnOK()
|
||||
void CInputBox::OnOK()
|
||||
{
|
||||
CString text;
|
||||
GetDlgItem(IDC_VAL)->GetWindowText(text);
|
||||
|
||||
if(text.GetLength()==0){EndDialog(NULL);};
|
||||
if (text.GetLength() == 0)
|
||||
EndDialog(false);
|
||||
|
||||
char* str;
|
||||
str=new(char[text.GetLength()]);
|
||||
strcpy(str, (LPCTSTR)text);
|
||||
EndDialog((int)str);
|
||||
m_Result = text;
|
||||
|
||||
EndDialog(true);
|
||||
}
|
||||
|
||||
void CInputBox::OnCancel()
|
||||
{
|
||||
EndDialog(NULL);
|
||||
EndDialog(false);
|
||||
}
|
||||
|
||||
void CInputBox::SetCaption(CString Caption)
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
enum { IDD = IDD_INPUTBOX };
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
const CString& GetResult() const { return m_Result; }
|
||||
// Überschreibungen
|
||||
// Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen
|
||||
//{{AFX_VIRTUAL(CInputBox)
|
||||
|
@ -68,6 +68,7 @@ protected:
|
|||
private:
|
||||
CString m_Text;
|
||||
CString m_Caption;
|
||||
CString m_Result;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
|
|
@ -2859,7 +2859,7 @@ void CIsoView::OnLButtonDown(UINT nFlags, CPoint point)
|
|||
|
||||
dlg.m_tag = tag;
|
||||
dlg.m_tag += " (";
|
||||
dlg.m_tag += GetParam(Map->GetIniFile().sections["Tags"].values[(LPCTSTR)tag], 1);
|
||||
dlg.m_tag += GetParam(Map->GetIniFile().GetString("Tags", tag), 1);
|
||||
dlg.m_tag += ")";
|
||||
|
||||
if (dlg.DoModal() == IDCANCEL) return;
|
||||
|
@ -3499,28 +3499,20 @@ COLORREF CIsoView::GetColor(const char* house, const char* vcolor)
|
|||
CIniFile& ini = Map->GetIniFile();
|
||||
if (house && strlen(house))
|
||||
{
|
||||
if (ini.sections.find(house) != ini.sections.end())
|
||||
{
|
||||
color = ini.sections[house].values["Color"];
|
||||
auto const& localColorDef = ini.GetString(house, "Color");
|
||||
if (!localColorDef.IsEmpty()) {
|
||||
color = localColorDef;
|
||||
} else {
|
||||
color = rules.GetString(house, "Color");
|
||||
}
|
||||
else
|
||||
color = rules.sections[house].values["Color"];
|
||||
}
|
||||
|
||||
if (vcolor)
|
||||
color = vcolor;
|
||||
|
||||
if (color)
|
||||
{
|
||||
if (color) {
|
||||
CString colorValues;
|
||||
if (ini.sections.contains("Colors"))
|
||||
{
|
||||
colorValues = ini.sections["Colors"].GetValueByName(color);
|
||||
}
|
||||
if (colorValues.IsEmpty() && rules.sections.contains("Colors"))
|
||||
{
|
||||
colorValues = rules.sections["Colors"].GetValueByName(color);
|
||||
}
|
||||
colorValues = ini.GetStringOr("Colors", color, rules.GetString("Colors", color));
|
||||
auto colorArray = SplitParams(colorValues);
|
||||
if (colorArray.size() == 3)
|
||||
{
|
||||
|
@ -4335,8 +4327,10 @@ void CIsoView::UpdateStatusBar(int x, int y)
|
|||
DWORD pos;
|
||||
Map->GetCelltagData(n, &type, &pos);
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
if (ini.sections["Tags"].values.find(type) != ini.sections["Tags"].values.end())
|
||||
name = GetParam(ini.sections["Tags"].values[type], 1);
|
||||
auto const tagStr = ini.GetString("Tags", type);
|
||||
if (!tagStr.IsEmpty()) {
|
||||
name = GetParam(tagStr, 1);
|
||||
}
|
||||
|
||||
statusbar += GetLanguageStringACP("CellTagStatus");
|
||||
statusbar += name;
|
||||
|
@ -5222,7 +5216,7 @@ void CIsoView::PlaceCurrentObjectAt(int x, int y)
|
|||
|
||||
}
|
||||
|
||||
void CIsoView::OnTimer(UINT nIDEvent)
|
||||
void CIsoView::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// theApp.m_loading->FreeAll();
|
||||
// theApp.m_loading->InitPics();
|
||||
|
@ -5681,7 +5675,7 @@ void CIsoView::DrawMap()
|
|||
|
||||
// Now left, right, top & bottom contain the needed values
|
||||
|
||||
DWORD MM_heightstart = tilesets_start[atoi((*tiles).sections["General"].values["HeightBase"])];
|
||||
DWORD MM_heightstart = tilesets_start[atoi((*tiles).GetString("General", "HeightBase"))];
|
||||
|
||||
// now draw everything
|
||||
int u, v, z;
|
||||
|
@ -5911,9 +5905,10 @@ void CIsoView::DrawMap()
|
|||
{
|
||||
if (!pic.bTried)
|
||||
{
|
||||
if (auto const pOverlayId = rules.sections["OverlayTypes"].GetValue(m.overlay)) {
|
||||
auto const& overlayId = rules.GetSection("OverlayTypes").Nth(m.overlay).second;
|
||||
if (!overlayId.IsEmpty()) {
|
||||
SetError("Loading graphics");
|
||||
theApp.m_loading->LoadOverlayGraphic(*pOverlayId, m.overlay);
|
||||
theApp.m_loading->LoadOverlayGraphic(overlayId, m.overlay);
|
||||
UpdateOverlayPictures(m.overlay);
|
||||
if (ovrlpics[m.overlay][m.overlaydata] != NULL) {
|
||||
pic = *ovrlpics[m.overlay][m.overlaydata];
|
||||
|
@ -6040,7 +6035,7 @@ void CIsoView::DrawMap()
|
|||
{
|
||||
SetError("Loading graphics");
|
||||
theApp.m_loading->LoadUnitGraphic(objp.type);
|
||||
::Map->UpdateBuildingInfo(objp.type);
|
||||
::Map->UpdateBuildingInfo(&objp.type);
|
||||
int dir = (7 - objp.direction / 32) % 8;
|
||||
pic = buildinginfo[id].pic[dir];
|
||||
if (pic.pic == NULL) pic = buildinginfo[id].pic[0];
|
||||
|
@ -6080,7 +6075,7 @@ void CIsoView::DrawMap()
|
|||
{
|
||||
SetError("Loading graphics");
|
||||
theApp.m_loading->LoadUnitGraphic(upg);
|
||||
::Map->UpdateBuildingInfo(upg);
|
||||
::Map->UpdateBuildingInfo(&upg);
|
||||
pic = pics[GetUnitPictureFilename(upg, dir)];
|
||||
if (pic.pic == NULL) missingimages[upg] = TRUE;
|
||||
}
|
||||
|
@ -6089,8 +6084,8 @@ void CIsoView::DrawMap()
|
|||
{
|
||||
static const CString LocLookup[3][2] = { {"PowerUp1LocXX", "PowerUp1LocYY"}, {"PowerUp2LocXX", "PowerUp2LocYY"}, {"PowerUp3LocXX", "PowerUp3LocYY"} };
|
||||
const auto drawCoordsPowerUp = drawCoordsBldShp + ProjectedVec(
|
||||
atoi(art.sections[objp.type].values[LocLookup[upgrade][0]]),
|
||||
atoi(art.sections[objp.type].values[LocLookup[upgrade][1]])
|
||||
atoi(art.GetString(objp.type, LocLookup[upgrade][0])),
|
||||
atoi(art.GetString(objp.type, LocLookup[upgrade][1]))
|
||||
);
|
||||
// py-=atoi(art.sections[obj.type].values["PowerUp1LocZZ"]);
|
||||
#ifndef NOSURFACES
|
||||
|
@ -6150,19 +6145,18 @@ void CIsoView::DrawMap()
|
|||
|
||||
if (pic.pic == NULL)
|
||||
{
|
||||
if (!missingimages[*rules.sections["BuildingTypes"].GetValue(m.node.type)])
|
||||
{
|
||||
auto const& buildingId = rules.GetSection("BuildingTypes").Nth(m.node.type).second;
|
||||
if (!buildingId.IsEmpty() && !missingimages[buildingId]) {
|
||||
SetError("Loading graphics");
|
||||
theApp.m_loading->LoadUnitGraphic(*rules.sections["BuildingTypes"].GetValue(m.node.type));
|
||||
::Map->UpdateBuildingInfo(*rules.sections["BuildingTypes"].GetValue(m.node.type));
|
||||
theApp.m_loading->LoadUnitGraphic(buildingId);
|
||||
::Map->UpdateBuildingInfo(&buildingId);
|
||||
pic = buildinginfo[id].pic[0];
|
||||
}
|
||||
if (pic.pic == NULL);
|
||||
{
|
||||
if (pic.pic == NULL) {
|
||||
#ifndef NOSURFACES
|
||||
Blit(pics["HOUSE"].pic, drawCoordsBld.x, drawCoordsBld.y - 19);
|
||||
#endif
|
||||
missingimages[*rules.sections["BuildingTypes"].GetValue(m.node.type)] = TRUE;
|
||||
missingimages[buildingId] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6374,7 +6368,7 @@ void CIsoView::DrawMap()
|
|||
{
|
||||
SetError("Loading graphics");
|
||||
theApp.m_loading->LoadUnitGraphic(type);
|
||||
::Map->UpdateTreeInfo(type);
|
||||
::Map->UpdateTreeInfo(&type);
|
||||
pic = treeinfo[id].pic;
|
||||
}
|
||||
if (pic.pic == NULL)
|
||||
|
|
|
@ -137,7 +137,7 @@ protected:
|
|||
afx_msg void OnDeadChar(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnKillFocus(CWnd* pNewWnd);
|
||||
//}}AFX_MSG
|
||||
|
|
|
@ -89,17 +89,17 @@ void CLighting::UpdateDialog()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
m_Ambient.SetWindowText(ini.sections["Lighting"].values["Ambient"]);
|
||||
m_Ambient2.SetWindowText(ini.sections["Lighting"].values["IonAmbient"]);
|
||||
m_Level.SetWindowText(ini.sections["Lighting"].values["Level"]);
|
||||
m_Level2.SetWindowText(ini.sections["Lighting"].values["IonLevel"]);
|
||||
m_Red.SetWindowText(ini.sections["Lighting"].values["Red"]);
|
||||
m_Red2.SetWindowText(ini.sections["Lighting"].values["IonRed"]);
|
||||
m_Green.SetWindowText(ini.sections["Lighting"].values["Green"]);
|
||||
m_Green2.SetWindowText(ini.sections["Lighting"].values["IonGreen"]);
|
||||
m_Blue.SetWindowText(ini.sections["Lighting"].values["Blue"]);
|
||||
m_Blue2.SetWindowText(ini.sections["Lighting"].values["IonBlue"]);
|
||||
//MessageBox(ini.sections["Lightning"].values["Ambient"]);
|
||||
m_Ambient.SetWindowText(ini.GetString("Lighting", "Ambient"));
|
||||
m_Ambient2.SetWindowText(ini.GetString("Lighting", "IonAmbient"));
|
||||
m_Level.SetWindowText(ini.GetString("Lighting", "Level"));
|
||||
m_Level2.SetWindowText(ini.GetString("Lighting", "IonLevel"));
|
||||
m_Red.SetWindowText(ini.GetString("Lighting", "Red"));
|
||||
m_Red2.SetWindowText(ini.GetString("Lighting", "IonRed"));
|
||||
m_Green.SetWindowText(ini.GetString("Lighting", "Green"));
|
||||
m_Green2.SetWindowText(ini.GetString("Lighting", "IonGreen"));
|
||||
m_Blue.SetWindowText(ini.GetString("Lighting", "Blue"));
|
||||
m_Blue2.SetWindowText(ini.GetString("Lighting", "IonBlue"));
|
||||
//MessageBox(ini.GetString("Lightning", "Ambient"));
|
||||
}
|
||||
|
||||
BOOL CLighting::OnInitDialog()
|
||||
|
@ -125,8 +125,7 @@ void CLighting::OnChangeAmbient()
|
|||
CString ctext;
|
||||
m_Ambient.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["Ambient"]=text;
|
||||
|
||||
ini.SetString("Lighting", "Ambient", text);
|
||||
}
|
||||
|
||||
void CLighting::OnChangeLevel()
|
||||
|
@ -136,8 +135,7 @@ void CLighting::OnChangeLevel()
|
|||
CString ctext;
|
||||
m_Level.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["Level"]=text;
|
||||
|
||||
ini.SetString("Lighting", "Level", text);
|
||||
}
|
||||
|
||||
void CLighting::OnKillfocusAmbient()
|
||||
|
@ -152,7 +150,7 @@ void CLighting::OnChangeRed()
|
|||
CString ctext;
|
||||
m_Red.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["Red"]=text;
|
||||
ini.SetString("Lighting", "Red", text);
|
||||
}
|
||||
|
||||
void CLighting::OnChangeGreen()
|
||||
|
@ -162,7 +160,7 @@ void CLighting::OnChangeGreen()
|
|||
CString ctext;
|
||||
m_Green.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["Green"]=text;
|
||||
ini.SetString("Lighting", "Green", text);
|
||||
}
|
||||
|
||||
void CLighting::OnChangeBlue()
|
||||
|
@ -172,7 +170,7 @@ void CLighting::OnChangeBlue()
|
|||
CString ctext;
|
||||
m_Blue.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["Blue"]=text;
|
||||
ini.SetString("Lighting", "Blue", text);
|
||||
}
|
||||
|
||||
void CLighting::OnChangeAmbient2()
|
||||
|
@ -182,7 +180,7 @@ void CLighting::OnChangeAmbient2()
|
|||
CString ctext;
|
||||
m_Ambient2.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["IonAmbient"]=text;
|
||||
ini.SetString("Lighting", "IonAmbient", text);
|
||||
}
|
||||
|
||||
void CLighting::OnChangeLevel2()
|
||||
|
@ -192,7 +190,7 @@ void CLighting::OnChangeLevel2()
|
|||
CString ctext;
|
||||
m_Level2.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["IonLevel"]=text;
|
||||
ini.SetString("Lighting", "IonLevel", text);
|
||||
}
|
||||
|
||||
void CLighting::OnChangeRed2()
|
||||
|
@ -202,7 +200,7 @@ void CLighting::OnChangeRed2()
|
|||
CString ctext;
|
||||
m_Red2.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["IonRed"]=text;
|
||||
ini.SetString("Lighting", "IonRed", text);
|
||||
}
|
||||
|
||||
void CLighting::OnChangeGreen2()
|
||||
|
@ -212,7 +210,7 @@ void CLighting::OnChangeGreen2()
|
|||
CString ctext;
|
||||
m_Green2.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["IonGreen"]=text;
|
||||
ini.SetString("Lighting", "IonGreen", text);
|
||||
}
|
||||
|
||||
void CLighting::OnChangeBlue2()
|
||||
|
@ -222,5 +220,5 @@ void CLighting::OnChangeBlue2()
|
|||
CString ctext;
|
||||
m_Blue2.GetWindowText(ctext);
|
||||
CString text=(char*)(LPCTSTR)ctext;
|
||||
ini.sections["Lighting"].values["IonBlue"]=text;
|
||||
ini.SetString("Lighting", "IonBlue", text);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -110,9 +110,9 @@ public:
|
|||
CLoading(CWnd* pParent = NULL); // Standardconstructor
|
||||
void InitPics(CProgressCtrl* prog=NULL);
|
||||
void Load();
|
||||
BOOL LoadUnitGraphic(LPCTSTR lpUnittype);
|
||||
BOOL LoadUnitGraphic(const CString& lpUnittype);
|
||||
void LoadBuildingSubGraphic(const CString& subkey, const CIniFileSection& artSection, BOOL bAlwaysSetChar, char theat, HMIXFILE hShpMix, SHPHEADER& shp_h, BYTE*& shp);
|
||||
void LoadOverlayGraphic(LPCTSTR lpOvrlName, int iOvrlNum);
|
||||
void LoadOverlayGraphic(const CString& lpOvrlName, int iOvrlNum);
|
||||
void InitVoxelNormalTables();
|
||||
HTSPALETTE GetIsoPalette(char theat);
|
||||
HTSPALETTE GetUnitPalette(char theat);
|
||||
|
|
BIN
MissionEditor/Loading_old.cpp
Normal file
BIN
MissionEditor/Loading_old.cpp
Normal file
Binary file not shown.
|
@ -53,7 +53,7 @@ CMMXSavingOptionsDlg::CMMXSavingOptionsDlg(CWnd* pParent /*=NULL*/)
|
|||
m_Standard = TRUE;
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_Description=Map->GetIniFile().sections["Basic"].values["Name"];
|
||||
m_Description = Map->GetIniFile().GetString("Basic", "Name");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -82,9 +82,9 @@ void CMapD::UpdateDialog()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
m_LocalSize.SetWindowText( ini.sections["Map"].values["LocalSize"] );
|
||||
m_LocalSize.SetWindowText(ini.GetString("Map", "LocalSize"));
|
||||
//m_Size.SetWindowText( ini.sections["Map"].values["Size"] );
|
||||
m_Theater.SetWindowText( ini.sections["Map"].values["Theater"] );
|
||||
m_Theater.SetWindowText(ini.GetString("Map", "Theater"));
|
||||
|
||||
char c[50];
|
||||
itoa(Map->GetWidth(), c, 10);
|
||||
|
@ -108,7 +108,7 @@ void CMapD::OnChangeUsesize()
|
|||
void CMapD::OnEditchangeTheater()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Map"].values["Theater"]=GetText(&m_Theater);
|
||||
ini.SetString("Map", "Theater", GetText(&m_Theater));
|
||||
}
|
||||
|
||||
void CMapD::UpdateStrings()
|
||||
|
@ -125,7 +125,7 @@ void CMapD::UpdateStrings()
|
|||
void CMapD::OnChangelocal()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Map"].values["LocalSize"]=GetText(&m_LocalSize);
|
||||
ini.SetString("Map", "LocalSize", GetText(&m_LocalSize));
|
||||
|
||||
Map->CalcMapRect();
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -316,7 +316,7 @@ public:
|
|||
|
||||
|
||||
int rampbase = rampset_start;//atoi((*tiles).sections["General"].values["RampBase"]);
|
||||
int rampsmooth = atoi((*tiles).sections["General"].AccessValueByName("RampSmooth"));
|
||||
int rampsmooth = tiles->GetInteger("General", "RampSmooth");
|
||||
|
||||
if (ns == -1 && (d.wTileSet == rampset || d.wTileSet == rampsmooth) && d.bMorphable)
|
||||
{
|
||||
|
@ -360,8 +360,7 @@ public:
|
|||
if (dwPos > fielddata_size) return FALSE;
|
||||
|
||||
int replacement = 0; // MW fix: ignore for bridges
|
||||
if ((*tiledata)[dwID].bReplacementCount && atoi((*tiles).sections["General"].AccessValueByName("BridgeSet")) != (*tiledata)[dwID].wTileSet)
|
||||
{
|
||||
if ((*tiledata)[dwID].bReplacementCount && tiles->GetInteger("General", "BridgeSet") != (*tiledata)[dwID].wTileSet) {
|
||||
replacement = rand() * (1 + (*tiledata)[dwID].bReplacementCount) / RAND_MAX;
|
||||
}
|
||||
|
||||
|
@ -400,7 +399,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
int GetBuildingID(LPCSTR lpBuildingName);
|
||||
int GetBuildingID(const CString& lpBuildingName);
|
||||
void ImportRUL(LPCTSTR lpFilename);
|
||||
void ExportRulesChanges(const char* filename);
|
||||
void DeleteRulesSections();
|
||||
|
@ -609,8 +608,8 @@ public:
|
|||
virtual ~CMapData();
|
||||
void Pack(BOOL bCreatePreview = FALSE, BOOL bCompression = FALSE);
|
||||
void Unpack();
|
||||
void UpdateTreeInfo(LPCSTR lpTreeType = NULL);
|
||||
void UpdateBuildingInfo(LPCSTR lpUnitType = NULL);
|
||||
void UpdateTreeInfo(const CString* lpTreeType = NULL);
|
||||
void UpdateBuildingInfo(const CString* lpUnitType = NULL);
|
||||
void CalcMapRect();
|
||||
|
||||
// MW change: UpdateStructures() public, so that houses dialog can access it
|
||||
|
@ -1000,7 +999,7 @@ public:
|
|||
#endif
|
||||
|
||||
BOOL IsYRMap();
|
||||
BOOL IsMapSection(LPCSTR lpSectionName);
|
||||
bool IsMapSection(const CString& sectionName);
|
||||
void ResizeMap(int iLeft, int iTop, DWORD dwNewWidth, DWORD dwNewHeight);
|
||||
void SmoothTiberium(DWORD dwPos);
|
||||
int GetPowerOfHouse(LPCTSTR lpHouse);
|
||||
|
|
|
@ -35,7 +35,7 @@ static char THIS_FILE[] = __FILE__;
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMapOpenDialog
|
||||
|
||||
UINT CALLBACK OFNHookProc(
|
||||
UINT_PTR CALLBACK OFNHookProc(
|
||||
HWND hdlg, // handle to child dialog window
|
||||
UINT uiMsg, // message identifier
|
||||
WPARAM wParam, // message parameter
|
||||
|
@ -56,7 +56,7 @@ UINT CALLBACK OFNHookProc(
|
|||
CIniFile CurMap;
|
||||
CurMap.InsertFile(utf16ToUtf8(psz),"Basic");
|
||||
|
||||
SetDlgItemText(hdlg, IDC_MAPNAME, CurMap.sections["Basic"].values["Name"]);
|
||||
SetDlgItemText(hdlg, IDC_MAPNAME, CurMap.GetString("Basic", "Name"));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -132,36 +132,30 @@ BOOL CMapValidator::CheckMap()
|
|||
Map->UpdateIniFile(MAPDATA_UPDATE_TO_INI);
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections.find("Map")==ini.sections.end() )
|
||||
{
|
||||
bAllow=FALSE;
|
||||
if (!ini.TryGetSection("Map")) {
|
||||
bAllow = FALSE;
|
||||
AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_NoMap"), 0);
|
||||
}
|
||||
if(ini.sections.find("Basic")==ini.sections.end() || ini.sections["Basic"].values.size()==0)
|
||||
{
|
||||
bAllow=FALSE;
|
||||
if (ini["Basic"].Size() == 0) {
|
||||
bAllow = FALSE;
|
||||
AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_NoBasic"), 0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ini.sections["Basic"].values["Name"].GetLength()==0)
|
||||
} else {
|
||||
if (ini.GetString("Basic","Name").IsEmpty()) {
|
||||
AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_NoName"), 1);
|
||||
}
|
||||
|
||||
if(ini.sections["Basic"].values.find("Player")==ini.sections["Basic"].values.end())
|
||||
{
|
||||
#ifdef TS_MODE
|
||||
if (ini.GetString("Basic", "Player").IsEmpty()) {
|
||||
if(ini.sections.find(MAPHOUSES)!=ini.sections.end() && ini.sections["Houses"].values.size()>0)
|
||||
{
|
||||
AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_HousesButNoPlayer"), 1);
|
||||
AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_HousesInMultiplayer"), 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if(ini.sections.find(MAPHOUSES)==ini.sections.end())
|
||||
{
|
||||
int d=Map->GetWaypointCount();
|
||||
#endif
|
||||
|
||||
if (!ini.TryGetSection(MAPHOUSES)) {
|
||||
int d = Map->GetWaypointCount();
|
||||
int below8found=0;
|
||||
int i;
|
||||
for(i=0;i<d;i++)
|
||||
|
@ -175,102 +169,90 @@ BOOL CMapValidator::CheckMap()
|
|||
}
|
||||
}
|
||||
|
||||
if(below8found<8)
|
||||
{
|
||||
if(isFalse(ini.sections["Basic"].values["Official"]))
|
||||
{
|
||||
if (below8found < 8) {
|
||||
if(!ini.GetBool("Basic", "Official")) {
|
||||
AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_Not8Waypoints"), 1);
|
||||
}
|
||||
|
||||
if(below8found<2)
|
||||
if (below8found < 2) {
|
||||
AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_HousesNoWaypoints"), 1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef RA2_MODE
|
||||
if(isTrue(ini.sections["Basic"].values["Official"]))
|
||||
if (ini.GetBool("Basic", "Official")) {
|
||||
AddItemWithNewLine(m_MapProblemList, GetLanguageStringACP("MV_OfficialYes"), 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int i;
|
||||
for(i=0;i<ini.sections["Tags"].values.size();i++)
|
||||
{
|
||||
CString trigger=GetParam(*ini.sections["Tags"].GetValue(i),2);
|
||||
if(ini.sections["Triggers"].FindName(trigger)<0)
|
||||
{
|
||||
|
||||
for (auto const& [id, def] : ini["Tags"]) {
|
||||
CString trigger = GetParam(def, 2);
|
||||
if (!ini["Triggers"].Exists(trigger)) {
|
||||
CString error;
|
||||
error=GetLanguageStringACP("MV_TriggerMissing");
|
||||
error=TranslateStringVariables(1, error, trigger);
|
||||
error=TranslateStringVariables(2, error, "Tag");
|
||||
error=TranslateStringVariables(3, error, *ini.sections["Tags"].GetValueName(i));
|
||||
AddItemWithNewLine(m_MapProblemList, error, 1);
|
||||
}
|
||||
}
|
||||
// repair triggers
|
||||
for(i=0;i<ini.sections["Triggers"].values.size();i++)
|
||||
{
|
||||
RepairTrigger(ini.sections["Triggers"].values[*ini.sections["Triggers"].GetValueName(i)]);
|
||||
}
|
||||
for(i=0;i<ini.sections["Triggers"].values.size();i++)
|
||||
{
|
||||
CString trigger=GetParam(*ini.sections["Triggers"].GetValue(i),1);
|
||||
if(ini.sections["Triggers"].FindName(trigger)<0 && trigger!="<none>")
|
||||
{
|
||||
CString error;
|
||||
error=GetLanguageStringACP("MV_TriggerMissing");
|
||||
error=TranslateStringVariables(1, error, trigger);
|
||||
error=TranslateStringVariables(2, error, "Trigger");
|
||||
error=TranslateStringVariables(3, error, *ini.sections["Triggers"].GetValueName(i));
|
||||
error = GetLanguageStringACP("MV_TriggerMissing");
|
||||
error = TranslateStringVariables(1, error, trigger);
|
||||
error = TranslateStringVariables(2, error, "Tag");
|
||||
error = TranslateStringVariables(3, error, id);
|
||||
AddItemWithNewLine(m_MapProblemList, error, 1);
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<ini.sections["TeamTypes"].values.size();i++)
|
||||
{
|
||||
CIniFileSection& sec=ini.sections[*ini.sections["TeamTypes"].GetValue(i)];
|
||||
CString taskforce=sec.values["TaskForce"];
|
||||
if(taskforce.GetLength()>0 && ini.sections["TaskForces"].FindValue(taskforce)<0)
|
||||
{
|
||||
CString error;
|
||||
error=GetLanguageStringACP("MV_TaskForceMissing");
|
||||
error=TranslateStringVariables(1, error, taskforce);
|
||||
error=TranslateStringVariables(2, error, *ini.sections["TeamTypes"].GetValue(i));
|
||||
AddItemWithNewLine(m_MapProblemList, error, 1);
|
||||
}
|
||||
}
|
||||
for(i=0;i<ini.sections["TeamTypes"].values.size();i++)
|
||||
{
|
||||
CIniFileSection& sec=ini.sections[*ini.sections["TeamTypes"].GetValue(i)];
|
||||
CString scripttype=sec.values["Script"];
|
||||
if(scripttype.GetLength()>0 && ini.sections["ScriptTypes"].FindValue(scripttype)<0)
|
||||
{
|
||||
CString error;
|
||||
error=GetLanguageStringACP("MV_ScripttypeMissing");
|
||||
error=TranslateStringVariables(1, error, scripttype);
|
||||
error=TranslateStringVariables(2, error, *ini.sections["TeamTypes"].GetValue(i));
|
||||
AddItemWithNewLine(m_MapProblemList, error, 1);
|
||||
}
|
||||
}
|
||||
for(i=0;i<ini.sections["TeamTypes"].values.size();i++)
|
||||
{
|
||||
CIniFileSection& sec=ini.sections[*ini.sections["TeamTypes"].GetValue(i)];
|
||||
if(sec.FindName("Tag")>=0)
|
||||
{
|
||||
CString tag=sec.values["Tag"];
|
||||
if(ini.sections["Tags"].FindName(tag)<0)
|
||||
{
|
||||
if (auto pTriggerSec = ini.TryGetSection("Triggers")) {
|
||||
for (auto& [id, def] : *pTriggerSec) {
|
||||
auto defCopy = def;
|
||||
if (RepairTrigger(defCopy)) {
|
||||
pTriggerSec->SetString(id, defCopy);
|
||||
}
|
||||
// check linked trigger
|
||||
auto const trigger = GetParam(defCopy, 1);
|
||||
if (!pTriggerSec->Exists(trigger) && trigger != "<none>") {
|
||||
CString error;
|
||||
error=GetLanguageStringACP("MV_TagMissing");
|
||||
error=TranslateStringVariables(1, error, tag);
|
||||
error=TranslateStringVariables(2, error, "Teamtype");
|
||||
error=TranslateStringVariables(3, error, *ini.sections["TeamTypes"].GetValue(i));
|
||||
error = GetLanguageStringACP("MV_TriggerMissing");
|
||||
error = TranslateStringVariables(1, error, trigger);
|
||||
error = TranslateStringVariables(2, error, "Trigger");
|
||||
error = TranslateStringVariables(3, error, id);
|
||||
AddItemWithNewLine(m_MapProblemList, error, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i=0;i<Map->GetCelltagCount();i++)
|
||||
{
|
||||
|
||||
for (auto const& [seq, id] : ini["TeamTypes"]) {
|
||||
auto const& sec = ini[id];
|
||||
// check taskforce
|
||||
auto const taskforce = sec.GetString("TaskForce");
|
||||
if (!taskforce.IsEmpty() && !ini["TaskForces"].HasValue(taskforce)) {
|
||||
CString error;
|
||||
error = GetLanguageStringACP("MV_TaskForceMissing");
|
||||
error = TranslateStringVariables(1, error, taskforce);
|
||||
error = TranslateStringVariables(2, error, id);
|
||||
AddItemWithNewLine(m_MapProblemList, error, 1);
|
||||
}
|
||||
// check script
|
||||
CString scripttype = sec.GetString("Script");
|
||||
if (!scripttype.IsEmpty() && !ini["ScriptTypes"].HasValue(scripttype)) {
|
||||
CString error;
|
||||
error = GetLanguageStringACP("MV_ScripttypeMissing");
|
||||
error = TranslateStringVariables(1, error, scripttype);
|
||||
error = TranslateStringVariables(2, error, id);
|
||||
AddItemWithNewLine(m_MapProblemList, error, 1);
|
||||
}
|
||||
// check tag
|
||||
auto const& tag = sec.GetString("Tag");
|
||||
if (!tag.IsEmpty()) {
|
||||
if (!ini["Tags"].Exists(tag)) {
|
||||
CString error;
|
||||
error = GetLanguageStringACP("MV_TagMissing");
|
||||
error = TranslateStringVariables(1, error, tag);
|
||||
error = TranslateStringVariables(2, error, "Teamtype");
|
||||
error = TranslateStringVariables(3, error, id);
|
||||
AddItemWithNewLine(m_MapProblemList, error, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto i = 0; i < Map->GetCelltagCount(); i++) {
|
||||
CString tag;
|
||||
DWORD pos;
|
||||
Map->GetCelltagData(i, &tag, &pos);
|
||||
|
@ -283,8 +265,7 @@ BOOL CMapValidator::CheckMap()
|
|||
CString p=cx;
|
||||
p+="/";
|
||||
p+=cy;
|
||||
if(ini.sections["Tags"].FindName(tag)<0)
|
||||
{
|
||||
if (!ini["Tags"].Exists(tag)) {
|
||||
CString error;
|
||||
error=GetLanguageStringACP("MV_TagMissing");
|
||||
error=TranslateStringVariables(1, error, tag);
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="FinalAlertDebug YR|x64">
|
||||
<Configuration>FinalAlertDebug YR</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="FinalAlertDebug|x64">
|
||||
<Configuration>FinalAlertDebug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="FinalAlertRelease YR|x64">
|
||||
<Configuration>FinalAlertRelease YR</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="FinalAlertRelease|x64">
|
||||
<Configuration>FinalAlertRelease</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="FinalSunDebug|Win32">
|
||||
<Configuration>FinalSunDebug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
|
@ -21,18 +37,34 @@
|
|||
<Configuration>FinalAlertRelease</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="FinalSunDebug|x64">
|
||||
<Configuration>FinalSunDebug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="FinalSunRelease|Win32">
|
||||
<Configuration>FinalSunRelease</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="FinalSunRelease|x64">
|
||||
<Configuration>FinalSunRelease</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Template|Win32">
|
||||
<Configuration>Template</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Template|x64">
|
||||
<Configuration>Template</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Tests FinalAlertDebug YR|Win32">
|
||||
<Configuration>Tests FinalAlertDebug YR</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Tests FinalAlertDebug YR|x64">
|
||||
<Configuration>Tests FinalAlertDebug YR</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>MissionEditor</ProjectName>
|
||||
|
@ -50,54 +82,103 @@
|
|||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
|
@ -105,6 +186,13 @@
|
|||
<Import Project="PropertySheets\FinalSun.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
<Import Project="PropertySheets\Release.props" />
|
||||
<Import Project="PropertySheets\FinalSun.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
|
@ -112,6 +200,13 @@
|
|||
<Import Project="PropertySheets\FinalSun.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
<Import Project="PropertySheets\Debug.props" />
|
||||
<Import Project="PropertySheets\FinalSun.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
|
@ -119,6 +214,13 @@
|
|||
<Import Project="PropertySheets\FinalAlert2YR.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
<Import Project="PropertySheets\Release.props" />
|
||||
<Import Project="PropertySheets\FinalAlert2YR.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
|
@ -126,6 +228,13 @@
|
|||
<Import Project="PropertySheets\FinalAlert2.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
<Import Project="PropertySheets\Release.props" />
|
||||
<Import Project="PropertySheets\FinalAlert2.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
|
@ -133,6 +242,13 @@
|
|||
<Import Project="PropertySheets\FinalAlert2.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
<Import Project="PropertySheets\Debug.props" />
|
||||
<Import Project="PropertySheets\FinalAlert2.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
|
@ -140,6 +256,13 @@
|
|||
<Import Project="PropertySheets\FinalAlert2YR.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
<Import Project="PropertySheets\Debug.props" />
|
||||
<Import Project="PropertySheets\FinalAlert2YR.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
|
@ -148,35 +271,71 @@
|
|||
<Import Project="PropertySheets\Tests.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
<Import Project="PropertySheets\Debug.props" />
|
||||
<Import Project="PropertySheets\FinalAlert2YR.props" />
|
||||
<Import Project="PropertySheets\Tests.props" />
|
||||
<Import Project="PropertySheets\Distribution.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>FinalAlert2YR_D</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>FinalAlert2YR_D</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>FinalAlert2YRTestsd</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>FinalAlert2YRTestsd</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>FinalAlert2_D</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>FinalAlert2_D</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>FinalAlert2</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>FinalAlert2</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>FinalAlert2YR</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>FinalAlert2YR</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>FinalSun_D</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>FinalSun_D</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>FinalSun</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>FinalSun</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -186,6 +345,15 @@
|
|||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -195,6 +363,15 @@
|
|||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -204,6 +381,15 @@
|
|||
<PreprocessorDefinitions>RA2_MODE;RA2_MODE_ICON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;RA2_MODE_ICON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -213,6 +399,15 @@
|
|||
<PreprocessorDefinitions>RA2_MODE;RA2_MODE_ICON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;RA2_MODE_ICON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -222,6 +417,15 @@
|
|||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>RA2_MODE;YR_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>TS_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -231,6 +435,15 @@
|
|||
<PreprocessorDefinitions>TS_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>TS_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>TS_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>TS_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
@ -240,11 +453,25 @@
|
|||
<PreprocessorDefinitions>TS_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>TS_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>TS_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Template|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\MissionEditorPackLib</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Aircraft.cpp" />
|
||||
<ClCompile Include="AITriggerAddDlg.cpp" />
|
||||
|
@ -306,19 +533,33 @@
|
|||
<ClCompile Include="SpecialFlags.cpp" />
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|Win32'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug YR|x64'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|Win32'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Tests FinalAlertDebug YR|x64'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|Win32'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalAlertDebug|x64'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|Win32'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease|x64'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|Win32'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalAlertRelease YR|x64'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|Win32'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalSunDebug|x64'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|Win32'">stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='FinalSunRelease|x64'">stdafx.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="structs.cpp" />
|
||||
<ClCompile Include="Tags.cpp" />
|
||||
|
@ -367,6 +608,7 @@
|
|||
<ClInclude Include="CliffModifier.h" />
|
||||
<ClInclude Include="ComboUInputDlg.h" />
|
||||
<ClInclude Include="defines.h" />
|
||||
<ClInclude Include="IniHelper.h" />
|
||||
<ClInclude Include="LineDrawer.h" />
|
||||
<ClInclude Include="DynamicGraphDlg.h" />
|
||||
<ClInclude Include="FinalSun.h" />
|
||||
|
|
|
@ -565,6 +565,9 @@
|
|||
<ClInclude Include="TextDrawer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IniHelper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\clifftoo.bmp">
|
||||
|
|
|
@ -118,14 +118,13 @@ BOOL CNewMap::OnInitDialog()
|
|||
|
||||
CComboBox& house=*((CComboBox*)(GetDlgItem(IDC_HOUSE)));
|
||||
int i;
|
||||
for(i=0;i<rules.sections[HOUSES].values.size();i++)
|
||||
{
|
||||
house.AddString(*rules.sections[HOUSES].GetValue(i));
|
||||
for (auto const& [seq, id] : rules[HOUSES]) {
|
||||
house.AddString(id);
|
||||
}
|
||||
|
||||
m_House=rules.sections[HOUSES].values["0"];
|
||||
m_House = rules[HOUSES].Nth(0).second;
|
||||
|
||||
CComboBox& theater=*((CComboBox*)GetDlgItem(IDC_THEATER));
|
||||
CComboBox& theater = *((CComboBox*)GetDlgItem(IDC_THEATER));
|
||||
theater.AddString(THEATER0);
|
||||
theater.AddString(THEATER1);
|
||||
#ifdef RA2_MODE
|
||||
|
@ -265,8 +264,7 @@ void CNewMap::OnEditchangeImportfile()
|
|||
|
||||
cmap.InsertFile(m_MapToImport,"Map");
|
||||
|
||||
if(cmap.sections.find("Map")==cmap.sections.end())
|
||||
{
|
||||
if (!cmap.TryGetSection("Map")) {
|
||||
m_OK.EnableWindow(FALSE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -84,9 +84,8 @@ BOOL CNewMapSpDlg::OnInitDialog()
|
|||
|
||||
CComboBox& house=*((CComboBox*)(GetDlgItem(IDC_HOUSE)));
|
||||
int i;
|
||||
for(i=0;i<rules.sections[HOUSES].values.size();i++)
|
||||
{
|
||||
house.AddString(TranslateHouse(*rules.sections[HOUSES].GetValue(i), TRUE));
|
||||
for (auto const& [seq, id] : rules[HOUSES]) {
|
||||
house.AddString(TranslateHouse(id, TRUE));
|
||||
}
|
||||
|
||||
m_PrepareHouses=TRUE;
|
||||
|
|
|
@ -70,10 +70,8 @@ BOOL CNewRA2HouseDlg::OnInitDialog()
|
|||
|
||||
CComboBox* country=(CComboBox*)GetDlgItem(IDC_COUNTRY);
|
||||
|
||||
int i;
|
||||
for(i=0;i<rules.sections[HOUSES].values.size();i++)
|
||||
{
|
||||
country->AddString(TranslateHouse(*rules.sections[HOUSES].GetValue(i), TRUE));
|
||||
for (auto const& [seq, id] : rules[HOUSES]) {
|
||||
country->AddString(TranslateHouse(id, TRUE));
|
||||
}
|
||||
|
||||
country->SetCurSel(0);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Import Project="$(MSBuildThisFileDirectory)/Common.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<XccVcpkgDirTriplet>$(XccDir)\vcpkg_installed\x86-windows\x86-windows</XccVcpkgDirTriplet>
|
||||
<XccVcpkgDirTriplet>$(XccDir)\vcpkg_installed\$(Platform)-windows\$(Platform)-windows</XccVcpkgDirTriplet>
|
||||
<XccVcpkgDir>$(XccVcpkgDirTriplet)\debug</XccVcpkgDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Import Project="$(MSBuildThisFileDirectory)/Common.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup>
|
||||
<XccVcpkgDirTriplet>$(XccDir)\vcpkg_installed\x86-windows\x86-windows</XccVcpkgDirTriplet>
|
||||
<XccVcpkgDirTriplet>$(XccDir)\vcpkg_installed\$(Platform)-windows\$(Platform)-windows</XccVcpkgDirTriplet>
|
||||
<XccVcpkgDir>$(XccVcpkgDirTriplet)</XccVcpkgDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
|
|
|
@ -76,32 +76,29 @@ BOOL CRTPDlg::OnInitDialog()
|
|||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
int i;
|
||||
for(i=0;i<rules.sections["TerrainTypes"].values.size();i++)
|
||||
{
|
||||
CString unitname=*rules.sections["TerrainTypes"].GetValue(i);
|
||||
for (auto const& [seq, unitname] : rules["TerrainTypes"]) {
|
||||
CString addedString=unitname;
|
||||
|
||||
if(g_data.sections["IgnoreRA2"].FindValue(unitname)>=0) continue;
|
||||
|
||||
if (g_data["IgnoreRA2"].HasValue(unitname)) {
|
||||
continue;
|
||||
}
|
||||
addedString=TranslateStringACP(addedString);
|
||||
|
||||
|
||||
if(unitname.Find("TREE")>=0)
|
||||
{
|
||||
|
||||
|
||||
if (unitname.Find("TREE") >= 0) {
|
||||
if(unitname.GetLength()>0 && unitname!="VEINTREE") // out with it :-)
|
||||
{
|
||||
int TreeMin=atoi(g_data.sections[Map->GetTheater()+"Limits"].values["TreeMin"]);
|
||||
int TreeMax=atoi(g_data.sections[Map->GetTheater()+"Limits"].values["TreeMax"]);
|
||||
auto const& theaterType = Map->GetTheater();
|
||||
int TreeMin = g_data.GetInteger(theaterType + "Limits", "TreeMin");
|
||||
int TreeMax = g_data.GetInteger(theaterType + "Limits", "TreeMax");
|
||||
|
||||
CString id=unitname;
|
||||
id.Delete(0, 4);
|
||||
int n=atoi(id);
|
||||
|
||||
|
||||
if(n<TreeMin || n>TreeMax) continue;
|
||||
if (n<TreeMin || n>TreeMax) {
|
||||
continue;
|
||||
}
|
||||
|
||||
m_Available.AddString(unitname);
|
||||
}
|
||||
|
@ -237,7 +234,7 @@ void CRTPDlg::OnPaint()
|
|||
if(missingimages.find(type)==missingimages.end())
|
||||
{
|
||||
theApp.m_loading->LoadUnitGraphic(type);
|
||||
Map->UpdateTreeInfo(type);
|
||||
Map->UpdateTreeInfo(&type);
|
||||
p=&treeinfo[id].pic;
|
||||
}
|
||||
if(p->pic==NULL)
|
||||
|
|
|
@ -59,7 +59,7 @@ CSaveMapOptionsDlg::CSaveMapOptionsDlg(CWnd* pParent /*=NULL*/)
|
|||
if(!Map->IsMultiplayer())
|
||||
m_PreviewMode=1;
|
||||
|
||||
m_MapName=ini.sections["Basic"].values["Name"];
|
||||
m_MapName = ini.GetString("Basic", "Name");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -316,21 +316,18 @@ void CScriptTypes::UpdateDialog()
|
|||
|
||||
UpdateData(FALSE);
|
||||
|
||||
|
||||
int i;
|
||||
for(i=0;i<ini.sections["ScriptTypes"].values.size();i++)
|
||||
{
|
||||
CString type,s;
|
||||
type=*ini.sections["ScriptTypes"].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
s+=ini.sections[(LPCTSTR)type].values["Name"];
|
||||
s+=")";
|
||||
m_ScriptType.AddString(s);
|
||||
for (auto const& [seq, type] : ini["ScriptTypes"]) {
|
||||
CString desc = type;
|
||||
desc += " (";
|
||||
desc += ini.GetString(type, "Name");
|
||||
desc += ")";
|
||||
m_ScriptType.AddString(desc);
|
||||
}
|
||||
|
||||
m_ScriptType.SetCurSel(0);
|
||||
if(sel>=0) m_ScriptType.SetCurSel(sel);
|
||||
if (sel >= 0) {
|
||||
m_ScriptType.SetCurSel(sel);
|
||||
}
|
||||
OnSelchangeScripttype();
|
||||
|
||||
|
||||
|
@ -353,12 +350,11 @@ void CScriptTypes::OnSelchangeScripttype()
|
|||
m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype);
|
||||
TruncSpace(Scripttype);
|
||||
|
||||
m_Name=ini.sections[(LPCTSTR)Scripttype].values["Name"];
|
||||
m_Name = ini.GetString(Scripttype, "Name");
|
||||
|
||||
int count=ini.sections[(LPCTSTR)Scripttype].values.size()-1;
|
||||
int count = ini[Scripttype].Size() - 1;
|
||||
int i;
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
for (i = 0; i < count; i++) {
|
||||
char c[50];
|
||||
itoa(i,c,10);
|
||||
m_Action.AddString(c);
|
||||
|
@ -374,22 +370,26 @@ void CScriptTypes::OnSelchangeScripttype()
|
|||
|
||||
void CScriptTypes::OnSelchangeAction()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
CString Scripttype;
|
||||
char action[50];
|
||||
if(m_ScriptType.GetCurSel()<0) return;
|
||||
if(m_Action.GetCurSel()<0) return;
|
||||
if (m_ScriptType.GetCurSel() < 0) {
|
||||
return;
|
||||
}
|
||||
if (m_Action.GetCurSel() < 0) {
|
||||
return;
|
||||
}
|
||||
m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype);
|
||||
TruncSpace(Scripttype);
|
||||
|
||||
itoa(m_Action.GetCurSel(), action, 10);
|
||||
//m_Type.SetWindowText(GetParam(ini.sections[(LPCTSTR)Scripttype].values[action],0));
|
||||
m_Type.SetCurSel(atoi(GetParam(ini.sections[(LPCTSTR)Scripttype].values[action], 0)));
|
||||
m_Type.SetCurSel(atoi(GetParam(ini.GetString(Scripttype, action), 0)));
|
||||
|
||||
OnSelchangeType();
|
||||
|
||||
m_Param.SetWindowText(GetParam(ini.sections[(LPCTSTR)Scripttype].values[action],1));
|
||||
m_Param.SetWindowText(GetParam(ini.GetString(Scripttype, action), 1));
|
||||
|
||||
|
||||
}
|
||||
|
@ -404,13 +404,15 @@ void CScriptTypes::OnChangeName()
|
|||
|
||||
DWORD pos=n->GetSel();
|
||||
CString Scripttype;
|
||||
if(m_ScriptType.GetCurSel()<0) return;
|
||||
if (m_ScriptType.GetCurSel() < 0) {
|
||||
return;
|
||||
}
|
||||
m_ScriptType.GetLBText(m_ScriptType.GetCurSel(), Scripttype);
|
||||
TruncSpace(Scripttype);
|
||||
|
||||
|
||||
|
||||
ini.sections[(LPCTSTR)Scripttype].values["Name"]=m_Name;
|
||||
ini.SetString(Scripttype, "Name", m_Name);
|
||||
|
||||
UpdateDialog();
|
||||
n->SetSel(pos);
|
||||
|
@ -466,8 +468,9 @@ void CScriptTypes::OnEditchangeType()
|
|||
case 6:
|
||||
m_Desc.SetWindowText("Script action #:");
|
||||
while(m_Param.DeleteString(0)!=CB_ERR);
|
||||
for(i=1;i<=ini.sections[(LPCTSTR)Scripttype].values.size()-1;i++)
|
||||
m_Param.AddString(itoa(i,tmp,10));
|
||||
for (i = 1; i <= ini[Scripttype].Size() - 1; i++) {
|
||||
m_Param.AddString(itoa(i, tmp, 10));
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
m_Desc.SetWindowText("Split groups:");
|
||||
|
@ -501,19 +504,17 @@ void CScriptTypes::OnEditchangeType()
|
|||
case 47:
|
||||
{
|
||||
m_Desc.SetWindowText("Type to move/attack:");
|
||||
|
||||
for(i=0;i<rules.sections["BuildingTypes"].values.size();i++)
|
||||
{
|
||||
auto const& bldTypeSec = rules["BuildingTypes"];
|
||||
for (i = 0; i < bldTypeSec.Size(); i++) {
|
||||
char c[50];
|
||||
itoa(i,c,10);
|
||||
CString s=c;
|
||||
|
||||
s+=" ";
|
||||
//s+=rules.sections[*rules.sections["BuildingTypes"].GetValue(i)].values["Name"];
|
||||
s+=Map->GetUnitName(*rules.sections["BuildingTypes"].GetValue(i));
|
||||
s+=Map->GetUnitName(bldTypeSec.Nth(i).second);
|
||||
m_Param.AddString(s);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -525,10 +526,7 @@ void CScriptTypes::OnEditchangeType()
|
|||
|
||||
char types[50];
|
||||
itoa(type, types, 10);
|
||||
ini.sections[(LPCTSTR)Scripttype].values[action]=SetParam(ini.sections[(LPCTSTR)Scripttype].values[action], 0, (LPCTSTR)types);
|
||||
|
||||
|
||||
|
||||
ini.SetString(Scripttype, action, SetParam(ini.GetString(Scripttype, action), 0, types));
|
||||
}
|
||||
|
||||
void CScriptTypes::OnSelchangeType()
|
||||
|
@ -565,9 +563,7 @@ void CScriptTypes::OnEditchangeParam()
|
|||
param=TranslateHouse(param);
|
||||
|
||||
itoa(m_Action.GetCurSel(), action, 10);
|
||||
ini.sections[(LPCTSTR)Scripttype].values[action]=SetParam(ini.sections[(LPCTSTR)Scripttype].values[action], 1, (LPCTSTR)param);
|
||||
|
||||
|
||||
ini.SetString(Scripttype, action, SetParam(ini.GetString(Scripttype, action), 1, param));
|
||||
}
|
||||
|
||||
void CScriptTypes::OnSelchangeParam()
|
||||
|
@ -587,9 +583,9 @@ void CScriptTypes::OnAddaction()
|
|||
|
||||
|
||||
char action[20];
|
||||
int count=ini.sections[(LPCTSTR)Scripttype].values.size()-1;
|
||||
int count = ini[Scripttype].Size() - 1;
|
||||
itoa(count,action,10);
|
||||
ini.sections[(LPCTSTR)Scripttype].values[action]="0,0";
|
||||
ini.SetString(Scripttype, action, "0,0");
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
@ -616,11 +612,11 @@ void CScriptTypes::OnDeleteaction()
|
|||
itoa(i, current, 10);
|
||||
itoa(i+1, next, 10);
|
||||
|
||||
ini.sections[(LPCTSTR)Scripttype].values[current]=ini.sections[(LPCTSTR)Scripttype].values[next];
|
||||
ini.SetString(Scripttype, current, ini.GetString(Scripttype, next));
|
||||
}
|
||||
char last[50];
|
||||
itoa(m_Action.GetCount()-1, last, 10);
|
||||
ini.sections[(LPCTSTR)Scripttype].values.erase(last);
|
||||
ini.RemoveValueByKey(Scripttype, last);
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
@ -634,8 +630,8 @@ void CScriptTypes::OnAdd()
|
|||
CString ID=GetFreeID();
|
||||
|
||||
CString p=GetFree("ScriptTypes");
|
||||
ini.sections["ScriptTypes"].values[p]=ID;
|
||||
ini.sections[ID].values["Name"]="New script";
|
||||
ini.SetString("ScriptTypes", p, ID);
|
||||
ini.SetString(ID, "Name", "New script");
|
||||
|
||||
|
||||
|
||||
|
@ -668,10 +664,13 @@ void CScriptTypes::OnDelete()
|
|||
TruncSpace(Scripttype);
|
||||
|
||||
int res=MessageBox("Are you sure to delete this ScriptType? Don´t forget to delete any references to this ScriptType","Delete ScriptType", MB_YESNO | MB_ICONQUESTION);
|
||||
if(res!=IDYES) return;
|
||||
if (res != IDYES) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini.sections.erase((LPCTSTR)Scripttype);
|
||||
ini.sections["ScriptTypes"].values.erase(*ini.sections["ScriptTypes"].GetValueName(ini.sections["ScriptTypes"].FindValue((LPCTSTR)Scripttype)));
|
||||
ini.DeleteSection(Scripttype);
|
||||
auto const& id = ini["ScriptTypes"].Nth(ini["ScriptTypes"].FindValue(Scripttype)).first;
|
||||
ini.RemoveValueByKey("ScriptTypes", id);
|
||||
//UpdateDialog();
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE);
|
||||
}
|
||||
|
|
|
@ -92,31 +92,26 @@ void CSingleplayerSettings::UpdateDialog()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection& sec=ini.sections["Basic"];
|
||||
auto const& sec = ini["Basic"];
|
||||
|
||||
if(sec.values.find("Intro")!=sec.values.end())
|
||||
m_Intro.SetWindowText(sec.values["Intro"]);
|
||||
if(sec.values.find("Brief")!=sec.values.end())
|
||||
m_Brief.SetWindowText(sec.values["Brief"]);
|
||||
if(sec.values.find("Win")!=sec.values.end())
|
||||
m_Win.SetWindowText(sec.values["Win"]);
|
||||
if(sec.values.find("Lose")!=sec.values.end())
|
||||
m_Lose.SetWindowText(sec.values["Lose"]);
|
||||
if(sec.values.find("Action")!=sec.values.end())
|
||||
m_Action.SetWindowText(sec.values["Action"]);
|
||||
if(sec.values.find("PostScore")!=sec.values.end())
|
||||
m_PostScore.SetWindowText(sec.values["PostScore"]);
|
||||
if(sec.values.find("PreMapSelect")!=sec.values.end())
|
||||
m_PreMapSelect.SetWindowText(sec.values["PreMapSelect"]);
|
||||
auto setIfExists = [&sec](CWnd& wnd, const CString& key) {
|
||||
if (auto val = sec.TryGetString(key)) {
|
||||
wnd.SetWindowText(*val);
|
||||
}
|
||||
};
|
||||
|
||||
if(sec.values.find("StartingDropships")!=sec.values.end())
|
||||
m_StartingDropships.SetWindowText(sec.values["StartingDropships"]);
|
||||
if(sec.values.find("CarryOverMoney")!=sec.values.end())
|
||||
m_CarryOverMoney.SetWindowText(sec.values["CarryOverMoney"]);
|
||||
if(sec.values.find("TimerInherit")!=sec.values.end())
|
||||
m_TimerInherit.SetWindowText(sec.values["TimerInherit"]);
|
||||
if(sec.values.find("FillSilos")!=sec.values.end())
|
||||
m_FillSilos.SetWindowText(sec.values["FillSilos"]);
|
||||
setIfExists(m_Intro, "Intro");
|
||||
setIfExists(m_Brief, "Brief");
|
||||
setIfExists(m_Win, "Win");
|
||||
setIfExists(m_Lose, "Lose");
|
||||
setIfExists(m_Action, "Action");
|
||||
setIfExists(m_PostScore, "PostScore");
|
||||
setIfExists(m_PreMapSelect, "PreMapSelect");
|
||||
|
||||
setIfExists(m_StartingDropships, "StartingDropships");
|
||||
setIfExists(m_CarryOverMoney, "CarryOverMoney");
|
||||
setIfExists(m_TimerInherit, "TimerInherit");
|
||||
setIfExists(m_FillSilos, "FillSilos");
|
||||
|
||||
ListMovies(m_Intro, TRUE);
|
||||
ListMovies(m_Brief, TRUE);
|
||||
|
@ -130,70 +125,70 @@ void CSingleplayerSettings::UpdateDialog()
|
|||
UpdateStrings();
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangeIntro()
|
||||
void CSingleplayerSettings::OnEditchangeIntro()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["Intro"]=GetText(&m_Intro);
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
ini.SetString("Basic", "Intro", GetText(&m_Intro));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangeBrief()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["Brief"]=GetText(&m_Brief);
|
||||
ini.SetString("Basic", "Brief", GetText(&m_Brief));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangeWin()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["Win"]=GetText(&m_Win);
|
||||
ini.SetString("Basic", "Win", GetText(&m_Win));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangeLose()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["Lose"]=GetText(&m_Lose);
|
||||
ini.SetString("Basic", "Lose", GetText(&m_Lose));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangeAction()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["Action"]=GetText(&m_Action);
|
||||
ini.SetString("Basic", "Action", GetText(&m_Action));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangePostscore()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["PostScore"]=GetText(&m_PostScore);
|
||||
ini.SetString("Basic", "PostScore", GetText(&m_PostScore));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangePremapselect()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["PreMapSelect"]=GetText(&m_PreMapSelect);
|
||||
ini.SetString("Basic", "PreMapSelect", GetText(&m_PreMapSelect));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangeStartingdropships()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["StartingDropships"]=GetText(&m_StartingDropships);
|
||||
ini.SetString("Basic", "StartingDropships", GetText(&m_StartingDropships));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnChangeCarryovermoney()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["CarryOverMoney"]=GetText(&m_CarryOverMoney);
|
||||
ini.SetString("Basic", "CarryOverMoney", GetText(&m_CarryOverMoney));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangeTimerinherit()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["TimerInherit"]=GetText(&m_TimerInherit);
|
||||
ini.SetString("Basic", "TimerInherit", GetText(&m_TimerInherit));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::OnEditchangeFillsilos()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
ini.sections["Basic"].values["FillSilos"]=GetText(&m_FillSilos);
|
||||
ini.SetString("Basic", "FillSilos", GetText(&m_FillSilos));
|
||||
}
|
||||
|
||||
void CSingleplayerSettings::UpdateStrings()
|
||||
|
|
|
@ -105,21 +105,20 @@ void CSpecialFlags::UpdateDialog()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
m_DestroyableBridges.SetWindowText(sec->values["DestroyableBridges"]);
|
||||
m_FixedAlliance.SetWindowText(sec->values["FixedAlliance"]);
|
||||
m_FogOfWar.SetWindowText(sec->values["FogOfWar"]);
|
||||
m_HarvesterImmune.SetWindowText(sec->values["HarvesterImmune"]);
|
||||
m_Inert.SetWindowText(sec->values["Inert"]);
|
||||
m_InitialVeteran.SetWindowText(sec->values["InitialVeteran"]);
|
||||
m_IonStorms.SetWindowText(sec->values["IonStorms"]);
|
||||
m_MCVDeploy.SetWindowText(sec->values["MCVDeploy"]);
|
||||
m_Meteorites.SetWindowText(sec->values["Meteorites"]);
|
||||
m_TiberiumExplosive.SetWindowText(sec->values["TiberiumExplosive"]);
|
||||
m_TiberiumGrows.SetWindowText(sec->values["TiberiumGrows"]);
|
||||
m_TiberiumSpreads.SetWindowText(sec->values["TiberiumSpreads"]);
|
||||
m_Visceroids.SetWindowText(sec->values["Visceroids"]);
|
||||
auto const& sec = ini["SpecialFlags"];
|
||||
m_DestroyableBridges.SetWindowText(sec.GetString("DestroyableBridges"));
|
||||
m_FixedAlliance.SetWindowText(sec.GetString("FixedAlliance"));
|
||||
m_FogOfWar.SetWindowText(sec.GetString("FogOfWar"));
|
||||
m_HarvesterImmune.SetWindowText(sec.GetString("HarvesterImmune"));
|
||||
m_Inert.SetWindowText(sec.GetString("Inert"));
|
||||
m_InitialVeteran.SetWindowText(sec.GetString("InitialVeteran"));
|
||||
m_IonStorms.SetWindowText(sec.GetString("IonStorms"));
|
||||
m_MCVDeploy.SetWindowText(sec.GetString("MCVDeploy"));
|
||||
m_Meteorites.SetWindowText(sec.GetString("Meteorites"));
|
||||
m_TiberiumExplosive.SetWindowText(sec.GetString("TiberiumExplosive"));
|
||||
m_TiberiumGrows.SetWindowText(sec.GetString("TiberiumGrows"));
|
||||
m_TiberiumSpreads.SetWindowText(sec.GetString("TiberiumSpreads"));
|
||||
m_Visceroids.SetWindowText(sec.GetString("Visceroids"));
|
||||
|
||||
#ifdef RA2_MODE
|
||||
SetDlgItemText(IDC_LTIBERIUMGROWS,"Ore grows:");
|
||||
|
@ -144,168 +143,103 @@ void CSpecialFlags::UpdateDialog()
|
|||
void CSpecialFlags::OnEditchangeTiberiumgrows()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_TiberiumGrows);
|
||||
sec->values["TiberiumGrows"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "TiberiumGrows", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeTiberiumspreads()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_TiberiumSpreads);
|
||||
sec->values["TiberiumSpreads"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "TiberiumSpreads", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeTiberiumexplosive()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_TiberiumExplosive);
|
||||
sec->values["TiberiumExplosive"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "TiberiumExplosive", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeDestroyablebridges()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_DestroyableBridges);
|
||||
sec->values["DestroyableBridges"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "DestroyableBridges", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeMcvdeploy()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_MCVDeploy);
|
||||
sec->values["MCVDeploy"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "MCVDeploy", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeInitialveteran()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_InitialVeteran);
|
||||
sec->values["InitialVeteran"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "InitialVeteran", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeFixedalliance()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_FixedAlliance);
|
||||
sec->values["FixedAlliance"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "FixedAlliance", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeHarvesterimmune()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_HarvesterImmune);
|
||||
sec->values["HarvesterImmune"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "HarvesterImmune", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeFogofwar()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_FogOfWar);
|
||||
sec->values["FogOfWar"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "FogOfWar", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeInert()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_Inert);
|
||||
sec->values["Inert"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "Inert", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeIonstorms()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_IonStorms);
|
||||
sec->values["IonStorms"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "IonStorms", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeMeteorites()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_Meteorites);
|
||||
sec->values["Meteorites"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "Meteorites", str);
|
||||
}
|
||||
|
||||
void CSpecialFlags::OnEditchangeVisceroids()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CIniFileSection *sec;
|
||||
sec=&ini.sections["SpecialFlags"];
|
||||
CString str;
|
||||
|
||||
|
||||
str=GetText(&m_Visceroids);
|
||||
sec->values["Visceroids"]=(LPCTSTR)str;
|
||||
ini.SetString("SpecialFlags", "Visceroids", str);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ void CTSOptions::OnOK()
|
|||
this->GetDlgItem(IDC_EDIT1)->GetWindowText(m_TSEXE);
|
||||
int n=m_Language.GetItemData(m_Language.GetCurSel());
|
||||
|
||||
m_LanguageName=*language.sections["Languages"].GetValue(n);
|
||||
m_LanguageName = language["Languages"].Nth(n).second;
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
@ -110,19 +110,15 @@ BOOL CTSOptions::OnInitDialog()
|
|||
|
||||
UpdateData(FALSE);
|
||||
|
||||
int i;
|
||||
for(i=0;i<language.sections["Languages"].values.size();i++)
|
||||
{
|
||||
CString lang=*language.sections["Languages"].GetValue(i);
|
||||
lang=language.sections[lang+"Header"].values["Name"];
|
||||
|
||||
|
||||
|
||||
m_Language.SetItemData(m_Language.AddString(lang),i);
|
||||
if (lang=="English")
|
||||
auto const& languageSec = language["Languages"];
|
||||
for (auto i = 0; i < languageSec.Size(); i++) {
|
||||
auto const& def = languageSec.Nth(i).second;
|
||||
auto const& lang = language.GetString(def + "Header", "Name");
|
||||
m_Language.SetItemData(m_Language.AddString(lang), i);
|
||||
if (lang == "English") {
|
||||
m_Language.SetCurSel(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -89,25 +89,20 @@ void CTags::UpdateDialog()
|
|||
while(m_Trigger.DeleteString(0)!=CB_ERR);
|
||||
|
||||
int i;
|
||||
for(i=0;i<ini.sections["Tags"].values.size();i++)
|
||||
{
|
||||
CString type=*ini.sections["Tags"].GetValueName(i);
|
||||
CString s;
|
||||
s=type;
|
||||
s+=" (";
|
||||
s+=GetParam(*ini.sections["Tags"].GetValue(i), 1);
|
||||
s+=")";
|
||||
for (auto const& [type, def] : ini["Tags"]) {
|
||||
CString s = type;
|
||||
s += " (";
|
||||
s += GetParam(def, 1);
|
||||
s += ")";
|
||||
m_Tag.AddString(s);
|
||||
}
|
||||
|
||||
for(i=0;i<ini.sections["Triggers"].values.size();i++)
|
||||
{
|
||||
CString type=*ini.sections["Triggers"].GetValueName(i);
|
||||
for (auto const& [type, def] : ini["Triggers"]) {
|
||||
CString s;
|
||||
s=type;
|
||||
s+=" (";
|
||||
s+=GetParam(ini.sections["Triggers"].values[type], 2);
|
||||
s+=")";
|
||||
s = type;
|
||||
s += " (";
|
||||
s += GetParam(def, 2);
|
||||
s += ")";
|
||||
m_Trigger.AddString(s);
|
||||
}
|
||||
|
||||
|
@ -129,19 +124,25 @@ void CTags::OnSelchangeTag()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int index=m_Tag.GetCurSel();
|
||||
if(index<0) return;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
CString type;
|
||||
m_Tag.GetLBText(index, type);
|
||||
if(type.Find(" ")>=0) type.SetAt(type.Find(" "),0);
|
||||
if (type.Find(" ") >= 0) {
|
||||
type.SetAt(type.Find(" "), 0);
|
||||
}
|
||||
|
||||
CString data=ini.sections["Tags"].values[(LPCTSTR)type];
|
||||
CString data = ini.GetString("Tags", type);
|
||||
m_Name=GetParam(data,1);
|
||||
CString trigger=GetParam(data,2);
|
||||
CString typ=trigger;
|
||||
|
||||
trigger+=" (";
|
||||
if(ini.sections["Triggers"].values.find(typ)!=ini.sections["Triggers"].values.end())
|
||||
trigger+=GetParam(ini.sections["Triggers"].values[typ],2);
|
||||
auto const& def = ini.GetString("Triggers", typ);
|
||||
if(!def.IsEmpty()) {
|
||||
trigger += GetParam(def, 2);
|
||||
}
|
||||
trigger+=")";
|
||||
|
||||
m_Trigger.SetWindowText(trigger);
|
||||
|
@ -169,13 +170,13 @@ void CTags::OnChangeName()
|
|||
m_Tag.GetLBText(index, type);
|
||||
if(type.Find(" ")>=0) type.SetAt(type.Find(" "),0);
|
||||
|
||||
CString data=ini.sections["Tags"].values[(LPCTSTR)type];
|
||||
auto const& data = ini.GetString("Tags", type);
|
||||
|
||||
CString tag, repeat;
|
||||
tag=GetParam(data,2);
|
||||
repeat=GetParam(data,0);
|
||||
data=repeat+","+(LPCTSTR)m_Name+","+tag;
|
||||
ini.sections["Tags"].values[(LPCTSTR)type]=data;
|
||||
tag = GetParam(data, 2);
|
||||
repeat = GetParam(data, 0);
|
||||
auto const& constructed = repeat + "," + m_Name + "," + tag;
|
||||
ini.SetString("Tags", type, constructed);
|
||||
|
||||
UpdateDialog();
|
||||
name.SetSel(sel2);
|
||||
|
@ -186,22 +187,26 @@ void CTags::OnEditchangeRepeat()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int index=m_Tag.GetCurSel();
|
||||
if(index<0) return;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString str;
|
||||
m_Repeat.GetWindowText(str);
|
||||
|
||||
CString type;
|
||||
m_Tag.GetLBText(index, type);
|
||||
if(type.Find(" ")>=0) type.SetAt(type.Find(" "),0);
|
||||
if (type.Find(" ") >= 0) {
|
||||
type.SetAt(type.Find(" "), 0);
|
||||
}
|
||||
|
||||
CString data=ini.sections["Tags"].values[(LPCTSTR)type];
|
||||
auto const data=ini.GetString("Tags", type);
|
||||
|
||||
CString trigger, name;
|
||||
trigger=GetParam(data,2);
|
||||
name=GetParam(data,1);
|
||||
data=(CString)(LPCTSTR)str+","+name+","+trigger;
|
||||
ini.sections["Tags"].values[(LPCTSTR)type]=data;
|
||||
trigger = GetParam(data, 2);
|
||||
name = GetParam(data, 1);
|
||||
auto const constructed = str + "," + name + "," + trigger;
|
||||
ini.SetString("Tags", type, constructed);
|
||||
|
||||
|
||||
UpdateDialog();
|
||||
|
@ -228,13 +233,13 @@ void CTags::OnSelchangeRepeat()
|
|||
|
||||
TruncSpace(str);
|
||||
|
||||
CString data=ini.sections["Tags"].values[(LPCTSTR)type];
|
||||
|
||||
auto const data = ini.GetString("Tags", type);
|
||||
|
||||
CString trigger, name;
|
||||
trigger=GetParam(data,2);
|
||||
name=GetParam(data,1);
|
||||
data=(CString)(LPCTSTR)str+","+name+","+trigger;
|
||||
ini.sections["Tags"].values[(LPCTSTR)type]=data;
|
||||
trigger = GetParam(data, 2);
|
||||
name = GetParam(data, 1);
|
||||
auto const constructed = str + "," + name + "," + trigger;
|
||||
ini.SetString("Tags", type, constructed);
|
||||
|
||||
|
||||
UpdateDialog();
|
||||
|
@ -255,13 +260,13 @@ void CTags::OnEditchangeTrigger()
|
|||
m_Tag.GetLBText(index, type);
|
||||
if(type.Find(" ")>=0) type.SetAt(type.Find(" "),0);
|
||||
|
||||
CString data=ini.sections["Tags"].values[(LPCTSTR)type];
|
||||
auto const data = ini.GetString("Tags", type);
|
||||
|
||||
CString repeat, name;
|
||||
repeat=GetParam(data,0);
|
||||
name=GetParam(data,1);
|
||||
data=repeat+","+name+","+(LPCTSTR)str;
|
||||
ini.sections["Tags"].values[(LPCTSTR)type]=data;
|
||||
repeat = GetParam(data, 0);
|
||||
name = GetParam(data, 1);
|
||||
auto const constructed = repeat + "," + name + "," + (LPCTSTR)str;
|
||||
ini.SetString("Tags", type, constructed);
|
||||
|
||||
|
||||
//UpdateDialog();
|
||||
|
@ -273,7 +278,9 @@ void CTags::OnSelchangeTrigger()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int index=m_Tag.GetCurSel();
|
||||
if(index<0) return;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int v=m_Trigger.GetCurSel();
|
||||
CString str;
|
||||
|
@ -281,20 +288,23 @@ void CTags::OnSelchangeTrigger()
|
|||
|
||||
m_Trigger.GetLBText(v,str);
|
||||
|
||||
if(str.Find(" ")>=0) str.SetAt(str.Find(" "),0);
|
||||
if (str.Find(" ") >= 0) {
|
||||
str.SetAt(str.Find(" "), 0);
|
||||
}
|
||||
|
||||
CString type;
|
||||
m_Tag.GetLBText(index, type);
|
||||
if(type.Find(" ")>=0) type.SetAt(type.Find(" "),0);
|
||||
if (type.Find(" ") >= 0) {
|
||||
type.SetAt(type.Find(" "), 0);
|
||||
}
|
||||
|
||||
CString data=ini.sections["Tags"].values[(LPCTSTR)type];
|
||||
auto const data = ini.GetString("Tags", type);
|
||||
|
||||
CString repeat, name;
|
||||
repeat=GetParam(data,0);
|
||||
name=GetParam(data,1);
|
||||
data=repeat+","+name+","+(LPCTSTR)str;
|
||||
ini.sections["Tags"].values[(LPCTSTR)type]=data;
|
||||
|
||||
auto const constructed =repeat+","+name+","+(LPCTSTR)str;
|
||||
ini.SetString("Tags", type, constructed);
|
||||
|
||||
//UpdateDialog();
|
||||
}
|
||||
|
@ -304,16 +314,22 @@ void CTags::OnDelete()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int index=m_Tag.GetCurSel();
|
||||
if(index<0) return;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString type;
|
||||
m_Tag.GetLBText(index, type);
|
||||
if(type.Find(" ")>=0) type.SetAt(type.Find(" "),0);
|
||||
if (type.Find(" ") >= 0) {
|
||||
type.SetAt(type.Find(" "), 0);
|
||||
}
|
||||
|
||||
int res=MessageBox("Are you sure to delete the selected tag? This may cause the attached trigger to don´t work anymore, if no other tag has the trigger attached.","Delete tag", MB_YESNO);
|
||||
if(res==IDNO) return;
|
||||
if (res == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini.sections["Tags"].values.erase((LPCTSTR)type);
|
||||
ini.RemoveValueByKey("Tags", type);
|
||||
UpdateDialog();
|
||||
}
|
||||
|
||||
|
@ -323,16 +339,15 @@ void CTags::OnAdd()
|
|||
|
||||
CString ID=GetFreeID();
|
||||
|
||||
if(ini.sections["Triggers"].values.size()<1)
|
||||
{
|
||||
if (ini["Triggers"].Size() < 1) {
|
||||
MessageBox("Before creating tags, you need at least one trigger.","Error");
|
||||
return;
|
||||
};
|
||||
|
||||
CString data;
|
||||
data="0,New Tag,";
|
||||
data+=*ini.sections["Triggers"].GetValueName(0);
|
||||
ini.sections["Tags"].values[ID]=data;
|
||||
data = "0,New Tag,";
|
||||
data += ini["Triggers"].Nth(0).first;
|
||||
ini.SetString("Tags", ID, data);
|
||||
|
||||
|
||||
UpdateDialog();
|
||||
|
|
|
@ -106,134 +106,46 @@ void CTaskForce::UpdateDialog()
|
|||
UpdateData(FALSE);
|
||||
|
||||
int i;
|
||||
CIniFileSection& sec=ini.sections["TaskForces"];
|
||||
for(i=0;i<sec.values.size();i++)
|
||||
{
|
||||
auto const& sec=ini["TaskForces"];
|
||||
for (auto const& [seq, id] : sec) {
|
||||
CString s;
|
||||
s=*sec.GetValue(i);
|
||||
s= id;
|
||||
s+=" (";
|
||||
s+=ini.sections[*sec.GetValue(i)].values["Name"];
|
||||
s += ini[id].GetString("Name");
|
||||
s+=")";
|
||||
m_TaskForces.AddString(s);
|
||||
}
|
||||
|
||||
CString ss="InfantryTypes";
|
||||
for(i=0;i<rules.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*rules.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
|
||||
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
else
|
||||
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
*/
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
auto addIntoUnitTypeByIni = [this](const CIniFile& ini, const CString& section) {
|
||||
for (auto const& [seq, type] : ini[section]) {
|
||||
CString s;
|
||||
s = type;
|
||||
s += " (";
|
||||
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
|
||||
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
else
|
||||
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
*/
|
||||
s += Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
for(i=0;i<ini.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
|
||||
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
else
|
||||
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
*/
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
s += ")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
};
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
auto addIntoUnitType = [&addIntoUnitTypeByIni, &ini](const CString& section) {
|
||||
addIntoUnitTypeByIni(rules, section);
|
||||
addIntoUnitTypeByIni(ini, section);
|
||||
};
|
||||
addIntoUnitType("InfantryTypes");
|
||||
addIntoUnitType("VehicleTypes");
|
||||
addIntoUnitType("AircraftTypes");
|
||||
|
||||
ss="VehicleTypes";
|
||||
for(i=0;i<rules.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*rules.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
|
||||
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
else
|
||||
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
*/
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
for(i=0;i<ini.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
|
||||
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
else
|
||||
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
*/
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
|
||||
ss="AircraftTypes";
|
||||
for(i=0;i<rules.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*rules.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
|
||||
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
else
|
||||
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
*/
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
for(i=0;i<ini.sections[ss].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections[ss].GetValue(i);
|
||||
s=type;
|
||||
s+=" (";
|
||||
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
|
||||
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
else
|
||||
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
*/
|
||||
s+=Map->GetUnitName((char*)(LPCTSTR)type);
|
||||
|
||||
s+=")";
|
||||
m_UnitType.AddString(s);
|
||||
}
|
||||
|
||||
|
||||
if(sel<0)
|
||||
{
|
||||
if(m_TaskForces.SetCurSel(0)!=CB_ERR)
|
||||
if (sel < 0) {
|
||||
if (m_TaskForces.SetCurSel(0) != CB_ERR)
|
||||
OnSelchangeTaskforces();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_TaskForces.SetCurSel(sel)!=CB_ERR)
|
||||
} else {
|
||||
if (m_TaskForces.SetCurSel(sel) != CB_ERR)
|
||||
OnSelchangeTaskforces();
|
||||
}
|
||||
|
||||
|
@ -264,36 +176,33 @@ void CTaskForce::OnSelchangeTaskforces()
|
|||
tf=GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
m_Name=sec.values["Name"];
|
||||
m_Group=sec.values["Group"];
|
||||
auto const & sec=ini[tf];
|
||||
m_Name = sec.GetString("Name");
|
||||
m_Group = sec.GetString("Group");
|
||||
|
||||
int i;
|
||||
while(m_Units.DeleteString(0)!=LB_ERR);
|
||||
for(i=0;i<sec.values.size()-2;i++)
|
||||
{
|
||||
while (m_Units.DeleteString(0) != LB_ERR);
|
||||
for (i = 0; i < sec.Size() - 2; i++) {
|
||||
char p[50];
|
||||
itoa(i, p, 10);
|
||||
CString data=sec.values[p];
|
||||
CString type=GetParam(data, 1);
|
||||
CString s=GetParam(data, 0);
|
||||
s+=" ";
|
||||
auto const& data = sec.GetString(p);
|
||||
CString type = GetParam(data, 1);
|
||||
CString s = GetParam(data, 0);
|
||||
s += " ";
|
||||
/*if(ini.sections.find((char*)(LPCTSTR)type)!=ini.sections.end() && ini.sections[(char*)(LPCTSTR)type].values.find("Name")!=ini.sections[(char*)(LPCTSTR)type].values.end())
|
||||
s+=ini.sections[(char*)(LPCTSTR)type].values["Name"];
|
||||
else
|
||||
s+=rules.sections[(char*)(LPCTSTR)type].values["Name"];*/
|
||||
s+=Map->GetUnitName(type);
|
||||
s += Map->GetUnitName(type);
|
||||
//s+=")";
|
||||
|
||||
m_Units.SetItemData(m_Units.AddString(s), i);
|
||||
|
||||
|
||||
m_Units.SetItemData(m_Units.AddString(s), i);
|
||||
}
|
||||
UpdateData(FALSE);
|
||||
|
||||
if(m_Units.SetCurSel(0)!=LB_ERR) OnSelchangeUnits();
|
||||
|
||||
|
||||
if (m_Units.SetCurSel(0) != LB_ERR) {
|
||||
OnSelchangeUnits();
|
||||
}
|
||||
}
|
||||
|
||||
void CTaskForce::OnSelchangeUnits()
|
||||
|
@ -305,11 +214,8 @@ void CTaskForce::OnSelchangeUnits()
|
|||
CString tf;
|
||||
tf=GetText(&m_TaskForces);
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
|
||||
char k[50];
|
||||
itoa(u, k, 10);
|
||||
CString data=sec.values[k];
|
||||
auto const& sec = ini[tf];
|
||||
auto const& data=sec.Nth(u).second;
|
||||
CString c=GetParam(data, 0);
|
||||
|
||||
CString s;
|
||||
|
@ -331,31 +237,34 @@ void CTaskForce::OnDeleteunit()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Units.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
int u=m_Units.GetItemData(sel);
|
||||
CString tf;
|
||||
tf=GetText(&m_TaskForces);
|
||||
tf = GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
|
||||
auto sec = ini.TryGetSection(tf);
|
||||
ASSERT(sec != nullptr);
|
||||
char k[50];
|
||||
itoa(u, k, 10);
|
||||
if(sec.values.size()<4) {
|
||||
sec.values.erase(k);
|
||||
|
||||
if (sec->Size() < 4) {
|
||||
sec->RemoveByKey(k);
|
||||
m_Units.DeleteString(sel);
|
||||
m_UnitType.SetWindowText("");
|
||||
m_NumberOfUnits=atoi("0");
|
||||
m_NumberOfUnits = atoi("0");
|
||||
UpdateDialog();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int lastpos=sec.values.size()-3;
|
||||
int lastpos = sec->Size() - 3;
|
||||
char l[50];
|
||||
itoa(lastpos, l, 10);
|
||||
sec.values[k]=sec.values[l];
|
||||
sec.values.erase(l);
|
||||
sec->SetString(k, sec->GetString(l));
|
||||
sec->RemoveByKey(l);
|
||||
sec->RemoveAt(lastpos);
|
||||
m_Units.DeleteString(sel);
|
||||
|
||||
|
||||
|
@ -370,20 +279,22 @@ void CTaskForce::OnChangeNumberunits()
|
|||
UpdateData();
|
||||
|
||||
int sel=m_Units.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
int u=m_Units.GetItemData(sel);
|
||||
CString tf;
|
||||
tf=GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
auto sec = ini.TryGetSection(tf);
|
||||
|
||||
char k[50], n[50];;
|
||||
char k[50], n[50];
|
||||
itoa(u, k, 10);
|
||||
itoa(m_NumberOfUnits, n, 10);
|
||||
CString data=sec.values[k];
|
||||
auto const& data=sec->GetString(k);
|
||||
CString c=GetParam(data, 1);
|
||||
sec.values[k]=n+(CString)","+c;
|
||||
sec->SetString(k, n + (CString)"," + c);
|
||||
UpdateDialog();
|
||||
}
|
||||
|
||||
|
@ -396,14 +307,15 @@ void CTaskForce::OnChangeName()
|
|||
CEdit& n=*(CEdit*)GetDlgItem(IDC_NAME);
|
||||
DWORD pos=n.GetSel();
|
||||
|
||||
if(m_TaskForces.GetCurSel()<0) return;
|
||||
if (m_TaskForces.GetCurSel() < 0) {
|
||||
return;
|
||||
}
|
||||
CString tf;
|
||||
tf=GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
|
||||
sec.values["Name"]=m_Name;
|
||||
|
||||
ini.SetString(tf, "Name", m_Name);
|
||||
|
||||
UpdateDialog();
|
||||
n.SetSel(pos);
|
||||
|
@ -414,22 +326,24 @@ void CTaskForce::OnEditchangeUnittype()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Units.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
int u=m_Units.GetItemData(sel);
|
||||
CString tf;
|
||||
tf=GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
|
||||
auto sec = ini.TryGetSection(tf);
|
||||
ASSERT(sec != nullptr);
|
||||
char k[50];
|
||||
itoa(u, k, 10);
|
||||
|
||||
CString count=GetParam(sec.values[k],0);
|
||||
CString count = GetParam(sec->GetString(k), 0);
|
||||
CString type=GetText(&m_UnitType);
|
||||
TruncSpace(type);
|
||||
|
||||
sec.values[k]=count+","+(char*)(LPCTSTR)type;
|
||||
sec->SetString(k, count + "," + (char*)(LPCTSTR)type);
|
||||
|
||||
CString ut;
|
||||
m_UnitType.GetWindowText(ut);
|
||||
|
@ -444,23 +358,26 @@ void CTaskForce::OnSelchangeUnittype()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Units.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
int u=m_Units.GetItemData(sel);
|
||||
CString tf;
|
||||
tf=GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
|
||||
auto sec = ini.TryGetSection(tf);
|
||||
ASSERT(sec != nullptr);
|
||||
|
||||
char k[50];
|
||||
itoa(u, k, 10);
|
||||
|
||||
CString count=GetParam(sec.values[k],0);
|
||||
CString count=GetParam(sec->GetString(k), 0);
|
||||
CString type=GetText(&m_UnitType);
|
||||
|
||||
TruncSpace(type);
|
||||
|
||||
sec.values[k]=count+","+(char*)(LPCTSTR)type;
|
||||
sec->SetString(k, count + "," + type);
|
||||
|
||||
UpdateDialog();
|
||||
//m_UnitType.SetWindowText("H");
|
||||
|
@ -471,18 +388,23 @@ void CTaskForce::OnAddunit()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CString tf;
|
||||
if(m_TaskForces.GetCurSel()<0) return;
|
||||
if (m_TaskForces.GetCurSel() < 0) {
|
||||
return;
|
||||
}
|
||||
tf=GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
|
||||
auto sec = ini.TryGetSection(tf);
|
||||
ASSERT(sec != nullptr);
|
||||
|
||||
char k[50];
|
||||
int c=m_Units.GetCount();
|
||||
if(c==LB_ERR) c=0;
|
||||
if (c == LB_ERR) {
|
||||
c = 0;
|
||||
}
|
||||
itoa(c, k, 10);
|
||||
|
||||
sec.values[k]="1"+(CString)","+*rules.sections["InfantryTypes"].GetValue(0);
|
||||
sec->SetString(k, "1" + (CString)"," + rules["InfantryTypes"].Nth(0).second);
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
@ -492,21 +414,21 @@ void CTaskForce::OnDeletetaskforce()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CString tf;
|
||||
if(m_TaskForces.GetCurSel()<0) return;
|
||||
if (m_TaskForces.GetCurSel() < 0) {
|
||||
return;
|
||||
}
|
||||
tf=GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
|
||||
|
||||
int res;
|
||||
res=MessageBox("Are you sure to delete the selected task force? If you delete it, make sure to eliminate ANY references to this task force in team-types.","Delete task force",MB_YESNO);
|
||||
if(res==IDNO) return;
|
||||
if (res == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
int v=ini.sections["TaskForces"].FindValue((char*)(LPCTSTR)tf);
|
||||
if(v==-1) return; // SHOULD NEVER BE!!!! AND CANNOT BE!!! BUT MAYBE A BUG...
|
||||
|
||||
ini.sections["TaskForces"].values.erase(*ini.sections["TaskForces"].GetValueName(v));
|
||||
ini.sections.erase((char*)(LPCTSTR)tf);
|
||||
ini.RemoveValueByKey("TaskForces", tf);
|
||||
ini.DeleteSection(tf);
|
||||
while(m_Units.DeleteString(0)!=LB_ERR);
|
||||
//UpdateDialog();
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE);
|
||||
|
@ -519,10 +441,10 @@ void CTaskForce::OnAddtaskforce()
|
|||
|
||||
CString ID=GetFreeID();
|
||||
CString tf=GetFree("TaskForces");
|
||||
ini.sections["TaskForces"].values[tf]=ID;
|
||||
ini.SetString("TaskForces", tf, ID);
|
||||
|
||||
ini.sections[ID].values["Name"]="New task force";
|
||||
ini.sections[ID].values["Group"]="-1";
|
||||
ini.SetString(ID, "Name", "New task force");
|
||||
ini.SetString(ID, "Group", "-1");
|
||||
|
||||
//UpdateDialog();
|
||||
|
||||
|
@ -554,13 +476,14 @@ void CTaskForce::OnChangeGroup()
|
|||
UpdateData();
|
||||
|
||||
CString tf;
|
||||
if(m_TaskForces.GetCurSel()<0) return;
|
||||
if (m_TaskForces.GetCurSel() < 0) {
|
||||
return;
|
||||
}
|
||||
tf=GetText(&m_TaskForces);
|
||||
|
||||
TruncSpace(tf);
|
||||
CIniFileSection & sec=ini.sections[(char*)(LPCTSTR)tf];
|
||||
|
||||
sec.values["Group"]=m_Group;
|
||||
|
||||
ini.SetString(tf, "Group", m_Group);
|
||||
|
||||
UpdateDialog();
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -130,27 +130,31 @@ void CTerrainDlg::Update()
|
|||
{
|
||||
int i;
|
||||
int tilecount = 0;
|
||||
for (i = 0;i < 10000;i++)
|
||||
{
|
||||
for (i = 0;i < 10000;i++) {
|
||||
CString tset;
|
||||
char c[50];
|
||||
itoa(i, c, 10);
|
||||
int e;
|
||||
for (e = 0;e < 4 - strlen(c);e++)
|
||||
for (e = 0; e < 4 - strlen(c); e++) {
|
||||
tset += "0";
|
||||
}
|
||||
tset += c;
|
||||
CString sec = "TileSet";
|
||||
sec += tset;
|
||||
|
||||
if (tiles->sections.find(sec) == tiles->sections.end())
|
||||
auto const pSec = tiles->TryGetSection(sec);
|
||||
|
||||
if (!pSec) {
|
||||
break;
|
||||
if (atoi(tiles->sections[sec].values["TilesInSet"]) == 0)
|
||||
}
|
||||
if (pSec->GetInteger("TilesInSet") == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CString string;
|
||||
string = tset;
|
||||
string += " (";
|
||||
string += TranslateStringACP(tiles->sections[sec].values["SetName"]);
|
||||
string += TranslateStringACP(pSec->GetString("SetName"));
|
||||
string += ")";
|
||||
|
||||
BOOL bForced = FALSE;
|
||||
|
@ -158,22 +162,24 @@ void CTerrainDlg::Update()
|
|||
|
||||
|
||||
// force yes
|
||||
CString datsec = (CString)"UseSet" + Map->GetTheater();
|
||||
auto const& theaterType = Map->GetTheater();
|
||||
auto tsetc = CString(std::to_string(atoi(tset)).c_str());
|
||||
|
||||
if (g_data.sections[datsec].FindValue(tsetc) >= 0)
|
||||
if (g_data["UseSet" + theaterType].HasValue(tsetc)) {
|
||||
bForced = TRUE;
|
||||
}
|
||||
|
||||
// force no
|
||||
datsec = (CString)"IgnoreSet" + Map->GetTheater();
|
||||
if (g_data.sections[datsec].FindValue(tsetc) >= 0)
|
||||
if (g_data["IgnoreSet" + theaterType].HasValue(tsetc)) {
|
||||
bForcedNot = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (bForced || (!bForcedNot && (*tiledata)[tilecount].bAllowToPlace && !(*tiledata)[tilecount].bMarbleMadness))
|
||||
if (bForced || (!bForcedNot && (*tiledata)[tilecount].bAllowToPlace && !(*tiledata)[tilecount].bMarbleMadness)) {
|
||||
TileSet->SetItemData(TileSet->AddString(string), i);
|
||||
}
|
||||
|
||||
tilecount += atoi(tiles->sections[sec].values["TilesInSet"]);
|
||||
tilecount += tiles->GetInteger(sec, "TilesInSet");
|
||||
}
|
||||
|
||||
TileSet->SetCurSel(0);
|
||||
|
@ -185,36 +191,34 @@ void CTerrainDlg::Update()
|
|||
|
||||
while (Overlays->DeleteString(0) != CB_ERR);
|
||||
|
||||
int i;
|
||||
|
||||
int e = 0;
|
||||
for (i = 0;i < rules.sections["OverlayTypes"].values.size();i++)
|
||||
{
|
||||
CString id = *rules.sections["OverlayTypes"].GetValue(i);
|
||||
auto const& types = rules["OverlayTypes"];
|
||||
for (auto i = 0; i < types.Size(); i++) {
|
||||
CString id = types.Nth(i).second;
|
||||
id.TrimLeft();
|
||||
id.TrimRight();
|
||||
|
||||
if (id.GetLength() > 0)
|
||||
{
|
||||
if (id.GetLength() > 0) {
|
||||
|
||||
if (rules.sections.find(id) != rules.sections.end() && rules.sections[id].FindName("Name") >= 0)
|
||||
{
|
||||
if (rules[id].Exists("Name")) {
|
||||
int p;
|
||||
BOOL bListIt = TRUE;
|
||||
for (p = 0;p < max_ovrl_img;p++)
|
||||
if (ovrlpics[i][p] != NULL && ovrlpics[i][p]->pic != NULL)
|
||||
for (p = 0; p < max_ovrl_img; p++) {
|
||||
if (ovrlpics[i][p] != NULL && ovrlpics[i][p]->pic != NULL) {
|
||||
bListIt = TRUE;
|
||||
|
||||
}
|
||||
}
|
||||
#ifdef RA2_MODE
|
||||
if ((i >= 39 && i <= 60) || (i >= 180 && i <= 201) || i == 239 || i == 178 || i == 167 || i == 126
|
||||
|| (i >= 122 && i <= 125))
|
||||
|| (i >= 122 && i <= 125)) {
|
||||
bListIt = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bListIt)
|
||||
{
|
||||
if (bListIt) {
|
||||
CString str;
|
||||
str = TranslateStringACP(rules.sections[(*rules.sections["OverlayTypes"].GetValue(i))].values["Name"]);
|
||||
str = TranslateStringACP(rules.GetString(id, "Name"));
|
||||
Overlays->SetItemData(Overlays->AddString(str), e);
|
||||
}
|
||||
}
|
||||
|
@ -228,26 +232,29 @@ DWORD CTerrainDlg::GetTileID(DWORD dwTileSet, int iTile)
|
|||
{
|
||||
int i, e;
|
||||
DWORD tilecount = 0;
|
||||
for (i = 0;i < 10000;i++)
|
||||
for (i = 0; i < 10000; i++)
|
||||
{
|
||||
CString tset;
|
||||
char c[50];
|
||||
itoa(i, c, 10);
|
||||
int e;
|
||||
for (e = 0;e < 4 - strlen(c);e++)
|
||||
for (e = 0; e < 4 - strlen(c); e++) {
|
||||
tset += "0";
|
||||
}
|
||||
tset += c;
|
||||
CString sec = "TileSet";
|
||||
sec += tset;
|
||||
|
||||
if (tiles->sections.find(sec) == tiles->sections.end())
|
||||
auto const pSec = tiles->TryGetSection(sec);
|
||||
if (!pSec) {
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
|
||||
for (e = 0;e < atoi(tiles->sections[sec].values["TilesInSet"]);e++)
|
||||
{
|
||||
if (i == dwTileSet && e == iTile)
|
||||
auto const tilesInset = pSec->GetInteger("TilesInSet");
|
||||
for (e = 0; e < tilesInset; e++) {
|
||||
if (i == dwTileSet && e == iTile) {
|
||||
return tilecount;
|
||||
}
|
||||
tilecount++;
|
||||
|
||||
}
|
||||
|
|
|
@ -381,23 +381,25 @@ DWORD CTileSetBrowserView::GetTileID(DWORD dwTileSet, DWORD dwType)
|
|||
{
|
||||
int i, e;
|
||||
DWORD tilecount = 0;
|
||||
for (i = 0;i < 10000;i++)
|
||||
for (i = 0; i < 10000; i++)
|
||||
{
|
||||
CString tset;
|
||||
char c[50];
|
||||
itoa(i, c, 10);
|
||||
int e;
|
||||
for (e = 0;e < 4 - strlen(c);e++)
|
||||
for (e = 0; e < 4 - strlen(c); e++)
|
||||
tset += "0";
|
||||
tset += c;
|
||||
CString sec = "TileSet";
|
||||
sec += tset;
|
||||
|
||||
if (tiles->sections.find(sec) == tiles->sections.end())
|
||||
auto const pSec = tiles->TryGetSection(sec);
|
||||
if (!pSec) {
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
|
||||
for (e = 0;e < atoi(tiles->sections[sec].values["TilesInSet"]);e++)
|
||||
auto const tilesInSet = pSec->GetInteger("TilesInSet");
|
||||
for (e = 0; e < tilesInSet; e++)
|
||||
{
|
||||
if (i == dwTileSet && e == dwType)
|
||||
return tilecount;
|
||||
|
@ -421,8 +423,9 @@ void CTileSetBrowserView::SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw)
|
|||
CString tset;
|
||||
|
||||
int e;
|
||||
for (e = 0;e < 4 - strlen(currentTileSet);e++)
|
||||
for (e = 0; e < 4 - strlen(currentTileSet); e++) {
|
||||
tset += "0";
|
||||
}
|
||||
|
||||
tset += currentTileSet;
|
||||
|
||||
|
@ -430,7 +433,7 @@ void CTileSetBrowserView::SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw)
|
|||
m_tile_height = 0;
|
||||
|
||||
int i;
|
||||
int max = atoi(tiles->sections[(CString)"TileSet" + tset].values["TilesInSet"]);
|
||||
int max = tiles->GetInteger("TileSet" + tset, "TilesInSet");
|
||||
DWORD dwStartID = GetTileID(dwTileSet, 0);
|
||||
if ((*tiledata)[dwStartID].wTileCount && (*tiledata)[dwStartID].tiles[0].pic)
|
||||
{
|
||||
|
@ -447,16 +450,11 @@ void CTileSetBrowserView::SetTileSet(DWORD dwTileSet, BOOL bOnlyRedraw)
|
|||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x = 1;
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y = 1;
|
||||
|
||||
int i;
|
||||
for (i = 0;i < g_data.sections["StdBrushSize"].values.size();i++)
|
||||
{
|
||||
CString n = *g_data.sections["StdBrushSize"].GetValueName(i);
|
||||
if ((*tiles).sections["General"].FindName(n) >= 0)
|
||||
{
|
||||
int tset = atoi((*tiles).sections["General"].values[n]);
|
||||
if (tset == m_currentTileSet)
|
||||
{
|
||||
int bs = atoi(*g_data.sections["StdBrushSize"].GetValue(i));
|
||||
for (auto const& [n, val] : g_data["StdBrushSize"]) {
|
||||
if (tiles->GetSection("General").Exists(n)) {
|
||||
int tset = tiles->GetInteger("General", n);
|
||||
if (tset == m_currentTileSet) {
|
||||
int bs = atoi(val);
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.m_BrushSize = bs - 1;
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.UpdateData(FALSE);
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x = bs;
|
||||
|
@ -810,16 +808,11 @@ void CTileSetBrowserView::OnLButtonDown(UINT nFlags, CPoint point)
|
|||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x = 1;
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_y = 1;
|
||||
|
||||
int i;
|
||||
for (i = 0;i < g_data.sections["StdBrushSize"].values.size();i++)
|
||||
{
|
||||
CString n = *g_data.sections["StdBrushSize"].GetValueName(i);
|
||||
if ((*tiles).sections["General"].FindName(n) >= 0)
|
||||
{
|
||||
int tset = atoi((*tiles).sections["General"].values[n]);
|
||||
if (tset == m_currentTileSet)
|
||||
{
|
||||
int bs = atoi(*g_data.sections["StdBrushSize"].GetValue(i));
|
||||
for (auto const& [n, val] : g_data["StdBrushSize"]) {
|
||||
if (tiles->GetSection("General").Exists(n)) {
|
||||
int tset = tiles->GetInteger("General", n);
|
||||
if (tset == m_currentTileSet) {
|
||||
int bs = atoi(val);
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.m_BrushSize = bs - 1;
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_settingsbar.UpdateData(FALSE);
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->m_view.m_isoview->m_BrushSize_x = bs;
|
||||
|
@ -938,7 +931,7 @@ void CTileSetBrowserView::SetOverlay(DWORD dwID)
|
|||
}
|
||||
if (!bFound)
|
||||
{
|
||||
theApp.m_loading->LoadOverlayGraphic(*rules.sections["OverlayTypes"].GetValue(dwID), dwID);
|
||||
theApp.m_loading->LoadOverlayGraphic(rules["OverlayTypes"].Nth(dwID).second, dwID);
|
||||
((CFinalSunDlg*)(theApp.m_pMainWnd))->m_view.m_isoview->UpdateOverlayPictures();
|
||||
//p=ovrlpics[dwID][k];
|
||||
}
|
||||
|
|
|
@ -65,13 +65,13 @@ CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/)
|
|||
optini.LoadFile(iniFile);
|
||||
|
||||
CWinApp* pApp = AfxGetApp();
|
||||
m_bStartup = !atoi(optini.sections[szSection].values[szIntStartup]);
|
||||
UINT iFilePos = atoi(optini.sections[szSection].values[szIntFilePos]);
|
||||
m_bStartup = !optini.GetBool(szSection, szIntStartup);
|
||||
UINT iFilePos = optini.GetInteger(szSection, szIntFilePos);
|
||||
|
||||
// try top open the tips file
|
||||
CString tipsfile=AppPath;
|
||||
tipsfile+="\\tips.";
|
||||
tipsfile+=language.sections[theApp.m_Options.LanguageName+"Header"].values["ExtensionName"];
|
||||
tipsfile += language.GetString(theApp.m_Options.LanguageName + "Header", "ExtensionName");
|
||||
|
||||
m_pStream = fopen(tipsfile, "r");
|
||||
if (m_pStream == NULL)
|
||||
|
@ -85,20 +85,15 @@ CTipDlg::CTipDlg(CWnd* pParent /*=NULL*/)
|
|||
_fstat(_fileno(m_pStream), &buf);
|
||||
CString strCurrentTime = ctime(&buf.st_ctime);
|
||||
strCurrentTime.TrimRight();
|
||||
CString strStoredTime = optini.sections[szSection].values[szTimeStamp];
|
||||
if (strCurrentTime != strStoredTime)
|
||||
{
|
||||
auto const& strStoredTime = optini.GetString(szSection, szTimeStamp);
|
||||
if (strCurrentTime != strStoredTime) {
|
||||
iFilePos = 0;
|
||||
optini.sections[szSection].values[szTimeStamp]=(LPCTSTR)strCurrentTime;
|
||||
|
||||
optini.SetString(szSection, szTimeStamp, strCurrentTime);
|
||||
}
|
||||
|
||||
if (fseek(m_pStream, iFilePos, SEEK_SET) != 0)
|
||||
{
|
||||
if (fseek(m_pStream, iFilePos, SEEK_SET) != 0) {
|
||||
AfxMessageBox(GetLanguageStringACP("CG_IDP_FILE_CORRUPT"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GetNextTipString(m_strTip);
|
||||
}
|
||||
|
||||
|
@ -121,9 +116,7 @@ CTipDlg::~CTipDlg()
|
|||
#endif
|
||||
optini.LoadFile(iniFile);
|
||||
|
||||
char val[50];
|
||||
itoa(ftell(m_pStream),val, 10);
|
||||
optini.sections[szSection].values[szIntFilePos]=val;
|
||||
optini.SetInteger(szSection, szIntFilePos, ftell(m_pStream));
|
||||
optini.SaveFile(iniFile);
|
||||
fclose(m_pStream);
|
||||
}
|
||||
|
@ -203,10 +196,7 @@ void CTipDlg::OnOK()
|
|||
#endif
|
||||
|
||||
optini.LoadFile(iniFile);
|
||||
|
||||
char val[50];
|
||||
itoa(!m_bStartup,val, 10);
|
||||
optini.sections[szSection].values[szIntStartup]=val;
|
||||
optini.SetBool(szSection, szIntStartup, !m_bStartup);
|
||||
optini.SaveFile(iniFile);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ void CTriggerActionsDlg::OnSelchangeAction()
|
|||
int i;
|
||||
|
||||
CString ActionData;
|
||||
ActionData=ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger];
|
||||
ActionData = ini.GetString("Actions", m_currentTrigger);
|
||||
|
||||
int startpos=1+curev*8;
|
||||
CString ActionType=GetParam(ActionData,startpos);
|
||||
|
@ -153,15 +153,20 @@ void CTriggerActionsDlg::OnEditchangeActiontype()
|
|||
|
||||
int pos=1+8*curev;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos, (LPCTSTR)eventtype);
|
||||
ini.SetString("Actions",m_currentTrigger, SetParam(ini.GetString("Actions", m_currentTrigger), pos, (LPCTSTR)eventtype));
|
||||
|
||||
if(g_data.sections[acsec].FindName(eventtype)<0) return;
|
||||
auto const& eventDef = g_data[acsec][eventtype];
|
||||
if (eventDef.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
eventdata=g_data.sections[acsec].values[eventtype];
|
||||
eventdata = eventDef;
|
||||
|
||||
#ifdef RA2_MODE
|
||||
if(g_data.sections["ActionsRA2"].FindName(eventtype)>=0)
|
||||
eventdata=g_data.sections["ActionsRA2"].values[eventtype];
|
||||
auto const& ra2Def = g_data["ActionsRA2"][eventtype];
|
||||
if (!ra2Def.IsEmpty()) {
|
||||
eventdata = ra2Def;
|
||||
}
|
||||
#endif
|
||||
|
||||
CString desc=GetParam(eventdata,10);
|
||||
|
@ -179,57 +184,64 @@ void CTriggerActionsDlg::OnEditchangeActiontype()
|
|||
int pListType[6];
|
||||
memset(pListType, 0, 6*sizeof(int));
|
||||
|
||||
if(atoi(ptype[0])>=0) pListType[0]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[0]], 1));
|
||||
if(atoi(ptype[1])>=0) pListType[1]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[1]], 1));
|
||||
if(atoi(ptype[2])>=0) pListType[2]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[2]], 1));
|
||||
if(atoi(ptype[3])>=0) pListType[3]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[3]], 1));
|
||||
if(atoi(ptype[4])>=0) pListType[4]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[4]], 1));
|
||||
if(atoi(ptype[5])>=0) pListType[5]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[5]], 1));
|
||||
if (atoi(ptype[0]) >= 0) {
|
||||
pListType[0] = atoi(GetParam(g_data.GetString("ParamTypes", ptype[0]), 1));
|
||||
}
|
||||
if (atoi(ptype[1]) >= 0) {
|
||||
pListType[1] = atoi(GetParam(g_data.GetString("ParamTypes", ptype[1]), 1));
|
||||
}
|
||||
if (atoi(ptype[2]) >= 0) {
|
||||
pListType[2] = atoi(GetParam(g_data.GetString("ParamTypes", ptype[2]), 1));
|
||||
}
|
||||
if (atoi(ptype[3]) >= 0) {
|
||||
pListType[3] = atoi(GetParam(g_data.GetString("ParamTypes", ptype[3]), 1));
|
||||
}
|
||||
if (atoi(ptype[4]) >= 0) {
|
||||
pListType[4] = atoi(GetParam(g_data.GetString("ParamTypes", ptype[4]), 1));
|
||||
}
|
||||
if (atoi(ptype[5]) >= 0) {
|
||||
pListType[5] = atoi(GetParam(g_data.GetString("ParamTypes", ptype[5]), 1));
|
||||
}
|
||||
|
||||
int i;
|
||||
for(i=0;i<6;i++)
|
||||
{
|
||||
for (auto i = 0; i < 6; i++) {
|
||||
if (atoi(ptype[i]) > 0) {
|
||||
CString paramname = GetParam(g_data.GetString("ParamTypes", ptype[i]), 0);
|
||||
|
||||
if(atoi(ptype[i])>0)
|
||||
{
|
||||
CString paramname=GetParam(g_data.sections["ParamTypes"].values[ptype[i]], 0);
|
||||
|
||||
m_Parameter.SetItemData(m_Parameter.AddString(paramname), i);
|
||||
}
|
||||
else if(atoi(ptype[i])<0)
|
||||
{
|
||||
} else if (atoi(ptype[i]) < 0) {
|
||||
char c[50];
|
||||
itoa(-atoi(ptype[i]),c,10);
|
||||
ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+i+1,c );
|
||||
itoa(-atoi(ptype[i]), c, 10);
|
||||
ini.SetString("Actions", m_currentTrigger, SetParam(ini["Actions"][m_currentTrigger], pos + i + 1, c));
|
||||
} else {
|
||||
ini.SetString("Actions", m_currentTrigger, SetParam(ini["Actions"][m_currentTrigger], pos + i + 1, "0"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+i+1, "0");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MW fix for waypoint/number issue
|
||||
CString code;
|
||||
BOOL bNoWP=FALSE;
|
||||
code=GetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+1);
|
||||
if(g_data.sections["DontSaveAsWP"].FindValue(code)>=0) bNoWP=TRUE;
|
||||
code = GetParam(ini["Actions"][m_currentTrigger], pos + 1);
|
||||
if (g_data["DontSaveAsWP"].HasValue(code)) {
|
||||
bNoWP = TRUE;
|
||||
}
|
||||
|
||||
// conversion below:
|
||||
if(IsWaypointFormat(GetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+1+6)) && bNoWP)
|
||||
{
|
||||
int number=GetWaypoint(GetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+1+6));
|
||||
if (IsWaypointFormat(
|
||||
GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6)
|
||||
)
|
||||
&& bNoWP) {
|
||||
int number = GetWaypoint(GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6));
|
||||
char c[50];
|
||||
itoa(number, c, 10);
|
||||
ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+1+6, c);
|
||||
}
|
||||
else if(!IsWaypointFormat(GetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+1+6)) && !bNoWP)
|
||||
{
|
||||
int wp=atoi(GetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+1+6));
|
||||
CString s=GetWaypoint(wp);
|
||||
ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos+1+6, s);
|
||||
|
||||
}
|
||||
ini.SetString("Actions", m_currentTrigger, SetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6, c));
|
||||
} else if (!IsWaypointFormat(
|
||||
GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6)
|
||||
)
|
||||
&& !bNoWP) {
|
||||
int wp = atoi(GetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6));
|
||||
CString s = GetWaypoint(wp);
|
||||
ini.SetString("Actions", m_currentTrigger, SetParam(ini["Actions"][m_currentTrigger], pos + 1 + 6, s));
|
||||
};
|
||||
|
||||
|
||||
if(atoi(GetParam(eventdata, 7))==1)
|
||||
|
@ -269,8 +281,7 @@ void CTriggerActionsDlg::OnSelchangeParameter()
|
|||
|
||||
|
||||
|
||||
CString ActionData;
|
||||
ActionData=ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger];
|
||||
auto const& ActionData = ini["Actions"][m_currentTrigger];
|
||||
|
||||
|
||||
int startpos=1+curev*8;
|
||||
|
@ -278,37 +289,32 @@ void CTriggerActionsDlg::OnSelchangeParameter()
|
|||
CString code;
|
||||
BOOL bNoWP=FALSE;
|
||||
code=GetParam(ActionData, startpos+1);
|
||||
if(g_data.sections["DontSaveAsWP"].FindValue(code)>=0) bNoWP=TRUE;
|
||||
if (g_data["DontSaveAsWP"].HasValue(code)) {
|
||||
bNoWP = TRUE;
|
||||
}
|
||||
|
||||
if(curparam>=0 && curparam<6)
|
||||
{
|
||||
CString ParamType=GetParam(g_data.sections["Actions"].values[GetParam(ActionData,startpos)],1+curparam);
|
||||
if (curparam >= 0 && curparam < 6) {
|
||||
CString ParamType = GetParam(g_data["Actions"][GetParam(ActionData, startpos)], 1 + curparam);
|
||||
#ifdef RA2_MODE
|
||||
if(g_data.sections["ActionsRA2"].FindName(GetParam(ActionData, startpos))>=0)
|
||||
{
|
||||
ParamType=GetParam(g_data.sections["ActionsRA2"].values[GetParam(ActionData,startpos)],1+curparam);
|
||||
if (g_data["ActionsRA2"].Exists(GetParam(ActionData, startpos))) {
|
||||
ParamType = GetParam(g_data["ActionsRA2"][GetParam(ActionData, startpos)], 1 + curparam);
|
||||
}
|
||||
#endif
|
||||
if(atoi(ParamType)<0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
CString ListType=GetParam(g_data.sections["ParamTypes"].values[ParamType],1);
|
||||
if (atoi(ParamType) >= 0) {
|
||||
CString ListType = GetParam(g_data["ParamTypes"][ParamType], 1);
|
||||
HandleParamList(m_ParamValue, atoi(ListType));
|
||||
m_ParamValue.SetWindowText(GetParam(ActionData,startpos+1+curparam));
|
||||
|
||||
m_ParamValue.SetWindowText(GetParam(ActionData, startpos + 1 + curparam));
|
||||
|
||||
int i;
|
||||
BOOL bFound=FALSE;
|
||||
for(i=0;i<m_ParamValue.GetCount();i++)
|
||||
{
|
||||
BOOL bFound = FALSE;
|
||||
for (i = 0; i < m_ParamValue.GetCount(); i++) {
|
||||
CString tmp;
|
||||
m_ParamValue.GetLBText(i,tmp);
|
||||
m_ParamValue.GetLBText(i, tmp);
|
||||
TruncSpace(tmp);
|
||||
if(tmp==GetParam(ActionData,startpos+1+curparam))
|
||||
if (tmp == GetParam(ActionData, startpos + 1 + curparam))
|
||||
{
|
||||
m_ParamValue.SetCurSel(i);
|
||||
bFound=TRUE;
|
||||
bFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -316,7 +322,7 @@ void CTriggerActionsDlg::OnSelchangeParameter()
|
|||
/*if(!bFound)
|
||||
{
|
||||
// not found, change it...
|
||||
|
||||
|
||||
if(m_ParamValue.GetCount()) {
|
||||
m_ParamValue.SetCurSel(0);
|
||||
OnEditchangeParamvalue();
|
||||
|
@ -331,27 +337,25 @@ void CTriggerActionsDlg::OnSelchangeParameter()
|
|||
if(c!=p) {
|
||||
m_ParamValue.SetWindowText("0");
|
||||
OnEditchangeParamvalue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if(curparam==-1)
|
||||
{
|
||||
|
||||
if (curparam == -1) {
|
||||
char wayp[50];
|
||||
if(!bNoWP)
|
||||
{
|
||||
if (!bNoWP) {
|
||||
ListWaypoints(m_ParamValue);
|
||||
int iWayp=GetWaypoint(GetParam(ActionData,startpos+1+6));
|
||||
|
||||
int iWayp = GetWaypoint(GetParam(ActionData, startpos + 1 + 6));
|
||||
|
||||
itoa(iWayp, wayp, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(wayp, GetParam(ActionData, startpos+1+6));
|
||||
} else {
|
||||
strcpy(wayp, GetParam(ActionData, startpos + 1 + 6));
|
||||
HandleParamList(m_ParamValue, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
m_ParamValue.SetWindowText(wayp);
|
||||
}
|
||||
|
@ -375,8 +379,7 @@ void CTriggerActionsDlg::OnEditchangeParamvalue()
|
|||
|
||||
int curparam=m_Parameter.GetItemData(curselparam);
|
||||
|
||||
CString ActionData;
|
||||
ActionData=ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger];
|
||||
auto const& ActionData = ini["Actions"][m_currentTrigger];
|
||||
|
||||
int startpos=1+curev*8;
|
||||
|
||||
|
@ -384,7 +387,9 @@ void CTriggerActionsDlg::OnEditchangeParamvalue()
|
|||
CString code;
|
||||
BOOL bNoWP=FALSE;
|
||||
code=GetParam(ActionData, startpos+1);
|
||||
if(g_data.sections["DontSaveAsWP"].FindValue(code)>=0) bNoWP=TRUE;
|
||||
if (g_data["DontSaveAsWP"].HasValue(code)) {
|
||||
bNoWP = TRUE;
|
||||
}
|
||||
|
||||
CString newVal;
|
||||
m_ParamValue.GetWindowText(newVal);
|
||||
|
@ -393,20 +398,18 @@ void CTriggerActionsDlg::OnEditchangeParamvalue()
|
|||
|
||||
if(newVal.Find(",",0)>=0) newVal.SetAt(newVal.Find(",",0), 0);
|
||||
|
||||
if(curparam>=0)
|
||||
{
|
||||
ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger]=SetParam(ActionData, startpos+1+curparam, newVal);
|
||||
}
|
||||
else if(curparam==-1) // waypoint FIX MW: OR NUMBER!!!
|
||||
{
|
||||
int pos=1+8*curev+7;
|
||||
|
||||
if(curparam>=0) {
|
||||
ini.SetString("Actions", m_currentTrigger, SetParam(ActionData, startpos + 1 + curparam, newVal));
|
||||
// waypoint FIX MW: OR NUMBER!!!
|
||||
} else if (curparam == -1) {
|
||||
int pos = 1 + 8 * curev + 7;
|
||||
CString waypoint = newVal;
|
||||
|
||||
CString waypoint=newVal;
|
||||
|
||||
if(!bNoWP) waypoint=GetWaypoint(atoi(newVal));
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)m_currentTrigger], pos, (LPCTSTR)waypoint);
|
||||
if (!bNoWP) {
|
||||
waypoint = GetWaypoint(atoi(newVal));
|
||||
}
|
||||
|
||||
ini.SetString("Actions", m_currentTrigger, SetParam(ini["Actions"][m_currentTrigger], pos, (LPCTSTR)waypoint));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -415,19 +418,21 @@ void CTriggerActionsDlg::OnNewaction()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
if (m_currentTrigger.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: verify
|
||||
auto& sec = ini.AddSection("Actions");
|
||||
|
||||
CIniFileSection& sec=ini.sections["Actions"];
|
||||
|
||||
int cval=atoi(GetParam(sec.values[(LPCTSTR)m_currentTrigger],0));
|
||||
int cval = atoi(GetParam(sec.GetString(m_currentTrigger), 0));
|
||||
cval++;
|
||||
char c[50];
|
||||
itoa(cval,c,10);
|
||||
|
||||
sec.values[(LPCTSTR)m_currentTrigger]=SetParam(sec.values[(LPCTSTR)m_currentTrigger],0,c);
|
||||
sec.values[(LPCTSTR)m_currentTrigger]+=",0,0,0,0,0,0,0,A";
|
||||
|
||||
auto action = SetParam(sec.GetString(m_currentTrigger), 0, c);
|
||||
action += ",0,0,0,0,0,0,0,A";
|
||||
sec.SetString(m_currentTrigger, action);
|
||||
|
||||
UpdateDialog();
|
||||
|
||||
|
@ -446,10 +451,11 @@ void CTriggerActionsDlg::OnDeleteaction()
|
|||
if(MessageBox("Do you really want to delete this action?","Delete action", MB_YESNO)==IDNO) return;
|
||||
|
||||
|
||||
CIniFileSection& sec=ini.sections["Actions"];
|
||||
auto sec = ini.TryGetSection("Actions");
|
||||
ASSERT(sec != nullptr);
|
||||
|
||||
CString data;
|
||||
data=sec.values[(LPCTSTR)m_currentTrigger];
|
||||
data = sec->GetString(m_currentTrigger);
|
||||
|
||||
int v=atoi(GetParam(data,0));
|
||||
char c[50];
|
||||
|
@ -460,8 +466,9 @@ void CTriggerActionsDlg::OnDeleteaction()
|
|||
int pos=1+curev*8;
|
||||
int posc=1+v*8;
|
||||
int i;
|
||||
for(i=0;i<8;i++)
|
||||
data=SetParam(data,pos+i, GetParam(data,posc+i));
|
||||
for (i = 0; i < 8; i++) {
|
||||
data = SetParam(data, pos + i, GetParam(data, posc + i));
|
||||
}
|
||||
|
||||
// MW April 17th, 2002:
|
||||
// fixed: (char*)(LPCTSTR)data should not be modified directly,
|
||||
|
@ -480,7 +487,7 @@ void CTriggerActionsDlg::OnDeleteaction()
|
|||
}
|
||||
//MessageBox(str_act);
|
||||
|
||||
sec.values[(LPCTSTR)m_currentTrigger]=str_act;
|
||||
sec->SetString(m_currentTrigger, str_act);
|
||||
delete[] str_act;
|
||||
UpdateDialog();
|
||||
|
||||
|
@ -508,23 +515,19 @@ void CTriggerActionsDlg::UpdateDialog()
|
|||
|
||||
while(m_ActionType.DeleteString(0)!=CB_ERR);
|
||||
int i;
|
||||
for(i=0;i<g_data.sections[sec].values.size();i++)
|
||||
{
|
||||
CString eventid=*g_data.sections[sec].GetValueName(i); //GetParam(*g_data.sections["Actions"].GetValue(i),13);
|
||||
CString eventdata=*g_data.sections[sec].GetValue(i);
|
||||
for (auto const& [eventid, eventdata] : g_data[sec]) {
|
||||
//GetParam(*g_data.sections["Actions"].GetValue(i),13);
|
||||
/*#ifdef RA2_MODE
|
||||
if(g_data.sections["ActionsRA2"].FindName(eventid)>=0)
|
||||
if(g_data.sections["ActionsRA2"].FindIndex(eventid)>=0)
|
||||
eventdata=g_data.sections["ActionsRA2"].values[eventid];
|
||||
#endif*/
|
||||
CString text=eventid+" "+GetParam(eventdata,0);
|
||||
text.Replace("%1",",");
|
||||
CString text = eventid + " " + GetParam(eventdata, 0);
|
||||
text.Replace("%1", ",");
|
||||
|
||||
#ifdef RA2_MODE
|
||||
if(GetParam(eventdata,12)=="1" && (yuri_mode || !isTrue(GetParam(eventdata, 14))))
|
||||
{
|
||||
if (GetParam(eventdata, 12) == "1" && (yuri_mode || !isTrue(GetParam(eventdata, 14)))) {
|
||||
#else
|
||||
if(GetParam(eventdata,11)=="1")
|
||||
{
|
||||
if (GetParam(eventdata, 11) == "1") {
|
||||
#endif
|
||||
m_ActionType.AddString(text);
|
||||
}
|
||||
|
@ -533,17 +536,16 @@ void CTriggerActionsDlg::UpdateDialog()
|
|||
int cur_sel=m_Action.GetCurSel();
|
||||
while(m_Action.DeleteString(0)!=CB_ERR);
|
||||
|
||||
CString Data=ini.sections["Actions"].values[m_currentTrigger];
|
||||
int count=atoi(GetParam(Data,0));
|
||||
auto const& Data = ini["Actions"][m_currentTrigger];
|
||||
int count = atoi(GetParam(Data, 0));
|
||||
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
for (i = 0; i < count; i++) {
|
||||
char c[50];
|
||||
itoa(i,c,10);
|
||||
itoa(i, c, 10);
|
||||
|
||||
CString s=TranslateStringACP("Action");
|
||||
s+=" ";
|
||||
s+=c;
|
||||
CString s = TranslateStringACP("Action");
|
||||
s += " ";
|
||||
s += c;
|
||||
|
||||
m_Action.SetItemData(m_Action.AddString(s), i);
|
||||
}
|
||||
|
|
|
@ -128,24 +128,31 @@ void CTriggerEditorDlg::UpdateDialog()
|
|||
while(m_Trigger.DeleteString(0)!=CB_ERR);
|
||||
m_Trigger.SetWindowText("");
|
||||
|
||||
for(i=0;i<ini.sections["Triggers"].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections["Triggers"].GetValueName(i);
|
||||
|
||||
s=GetParam(ini.sections["Triggers"].values[type], 2);
|
||||
|
||||
if(ini.sections["Triggers"].values[type].GetLength()==0) continue;
|
||||
auto const& triggersSec = ini["Triggers"];
|
||||
for (i = 0; i < triggersSec.Size(); i++) {
|
||||
auto const& [type, params] = triggersSec.Nth(i);
|
||||
|
||||
int id=m_Trigger.AddString(s);
|
||||
m_Trigger.SetItemData(id, i);
|
||||
auto s = GetParam(params, 2);
|
||||
|
||||
if (params.IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int id = m_Trigger.AddString(s);
|
||||
m_Trigger.SetItemData(id, i);
|
||||
}
|
||||
|
||||
if(curData<0) curData=0;
|
||||
if(curData>=m_Trigger.GetCount()) curData=m_Trigger.GetCount()-1;
|
||||
if (curData < 0) {
|
||||
curData = 0;
|
||||
}
|
||||
if (curData >= m_Trigger.GetCount()) {
|
||||
curData = m_Trigger.GetCount() - 1;
|
||||
}
|
||||
|
||||
if(ini.sections["Triggers"].values.size()) m_Trigger.SetCurSel(0);
|
||||
if (ini["Triggers"].Size()) {
|
||||
m_Trigger.SetCurSel(0);
|
||||
}
|
||||
|
||||
for(i=0;i<m_Trigger.GetCount();i++)
|
||||
if(m_Trigger.GetItemData(i)==curData)
|
||||
|
@ -162,24 +169,22 @@ void CTriggerEditorDlg::OnNewtrigger()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
CString ID_T=GetFreeID();
|
||||
ini.sections["Triggers"].values[ID_T]=Map->GetHouseID(0, TRUE)+",<none>,New trigger,0,1,1,1,0";
|
||||
ini.sections["Events"].values[ID_T]="0";
|
||||
ini.sections["Actions"].values[ID_T]="0";
|
||||
ini.SetString("Triggers", ID_T, Map->GetHouseID(0, TRUE) + ",<none>,New trigger,0,1,1,1,0");
|
||||
ini.SetString("Events", ID_T, "0");
|
||||
ini.SetString("Actions", ID_T, "0");
|
||||
|
||||
//if(MessageBox("Trigger created. If you want to create a simple tag now, press Yes. The tag will be called ""New tag"", you should name it like the trigger (after you have set up the trigger).","Trigger created",MB_YESNO))
|
||||
{
|
||||
CString ID_TAG=GetFreeID();
|
||||
ini.sections["Tags"].values[ID_TAG]="0,New tag,";
|
||||
ini.sections["Tags"].values[ID_TAG]+=ID_T;
|
||||
ini.SetString("Tags",ID_TAG, "0,New tag," + ID_T);
|
||||
}
|
||||
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE);
|
||||
|
||||
int i;
|
||||
for(i=0;i<m_Trigger.GetCount();i++)
|
||||
{
|
||||
if(m_Trigger.GetItemData(i)==ini.sections["Triggers"].FindName(ID_T))
|
||||
for (auto i = 0; i < m_Trigger.GetCount(); i++) {
|
||||
if (m_Trigger.GetItemData(i) == ini["Triggers"].FindIndex(ID_T)) {
|
||||
m_Trigger.SetCurSel(i);
|
||||
}
|
||||
}
|
||||
OnSelchangeTrigger();
|
||||
|
||||
|
@ -196,28 +201,24 @@ void CTriggerEditorDlg::OnDeletetrigger()
|
|||
int res=MessageBox("If you want to delete all attached tags, too, press 'Yes'.\nIf you don´t want to delete these tags, press 'No'.\nIf you want to cancel deletion of the trigger, press 'Cancel'.\n\nNote: CellTags will never be deleted using this function","Delete trigger", MB_YESNOCANCEL);
|
||||
if(res==IDCANCEL) return;
|
||||
|
||||
CString trigger=*ini.sections["Triggers"].GetValueName(curtrig);
|
||||
auto const& triggerId = ini["Triggers"].Nth(curtrig).first;
|
||||
|
||||
if(res==IDYES)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<ini.sections["Tags"].values.size();i++)
|
||||
{
|
||||
CString type=*ini.sections["Tags"].GetValueName(i);
|
||||
|
||||
CString attTrigg=GetParam(ini.sections["Tags"].values[type], 2);
|
||||
|
||||
if(trigger==attTrigg)
|
||||
{
|
||||
ini.sections["Tags"].values.erase(type);
|
||||
if (res == IDYES) {
|
||||
std::vector<CString> keysToDelete;
|
||||
for (auto const& [type, def] : ini["Tags"]) {
|
||||
auto const attTrigg = GetParam(def, 2);
|
||||
if (triggerId == attTrigg) {
|
||||
keysToDelete.push_back(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto const& keyToDelete : keysToDelete) {
|
||||
ini.RemoveValueByKey("Tags", keyToDelete);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ini.sections["Triggers"].values.erase((LPCTSTR)trigger);
|
||||
ini.sections["Events"].values.erase((LPCTSTR)trigger);
|
||||
ini.sections["Actions"].values.erase((LPCTSTR)trigger);
|
||||
ini.RemoveValueByKey("Triggers", triggerId);
|
||||
ini.RemoveValueByKey("Events", triggerId);
|
||||
ini.RemoveValueByKey("Actions", triggerId);
|
||||
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE);
|
||||
|
||||
|
@ -235,27 +236,38 @@ void CTriggerEditorDlg::OnEditchangeTrigger()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int curSel=m_Trigger.GetCurSel();
|
||||
if(curSel<0)
|
||||
{
|
||||
m_TriggerOptions.m_currentTrigger="";
|
||||
if(m_TriggerOptions.m_hWnd) m_TriggerOptions.UpdateDialog();
|
||||
m_TriggerEvents.m_currentTrigger="";
|
||||
if(m_TriggerEvents.m_hWnd) m_TriggerEvents.UpdateDialog();
|
||||
m_TriggerActions.m_currentTrigger="";
|
||||
if(m_TriggerActions.m_hWnd) m_TriggerActions.UpdateDialog();
|
||||
if (curSel < 0) {
|
||||
m_TriggerOptions.m_currentTrigger = "";
|
||||
if (m_TriggerOptions.m_hWnd) {
|
||||
m_TriggerOptions.UpdateDialog();
|
||||
}
|
||||
m_TriggerEvents.m_currentTrigger = "";
|
||||
if (m_TriggerEvents.m_hWnd) {
|
||||
m_TriggerEvents.UpdateDialog();
|
||||
}
|
||||
m_TriggerActions.m_currentTrigger = "";
|
||||
if (m_TriggerActions.m_hWnd) {
|
||||
m_TriggerActions.UpdateDialog();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int curInd=m_Trigger.GetItemData(curSel);
|
||||
|
||||
CString Trigger=*ini.sections["Triggers"].GetValueName(curInd);
|
||||
auto const triggerId=ini["Triggers"].Nth(curInd).first;
|
||||
|
||||
m_TriggerOptions.m_currentTrigger=Trigger;
|
||||
if(m_TriggerOptions.m_hWnd) m_TriggerOptions.UpdateDialog();
|
||||
m_TriggerEvents.m_currentTrigger=Trigger;
|
||||
if(m_TriggerEvents.m_hWnd) m_TriggerEvents.UpdateDialog();
|
||||
m_TriggerActions.m_currentTrigger=Trigger;
|
||||
if(m_TriggerActions.m_hWnd) m_TriggerActions.UpdateDialog();
|
||||
m_TriggerOptions.m_currentTrigger=triggerId;
|
||||
if (m_TriggerOptions.m_hWnd) {
|
||||
m_TriggerOptions.UpdateDialog();
|
||||
}
|
||||
m_TriggerEvents.m_currentTrigger = triggerId;
|
||||
if (m_TriggerEvents.m_hWnd) {
|
||||
m_TriggerEvents.UpdateDialog();
|
||||
}
|
||||
m_TriggerActions.m_currentTrigger = triggerId;
|
||||
if (m_TriggerActions.m_hWnd) {
|
||||
m_TriggerActions.UpdateDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void CTriggerEditorDlg::OnSelchangeTriggertab(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
|
@ -288,25 +300,21 @@ void CTriggerEditorDlg::OnPlaceonmap()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int curtrig=m_Trigger.GetItemData(sel);
|
||||
|
||||
CString trigger=*ini.sections["Triggers"].GetValueName(curtrig);
|
||||
|
||||
int i;
|
||||
auto const triggerId = ini["Triggers"].Nth(curtrig).first;
|
||||
CString tag;
|
||||
for(i=0;i<ini.sections["Tags"].values.size();i++)
|
||||
{
|
||||
CString type=*ini.sections["Tags"].GetValueName(i);
|
||||
|
||||
CString attTrigg=GetParam(ini.sections["Tags"].values[type], 2);
|
||||
|
||||
if(trigger==attTrigg)
|
||||
{
|
||||
tag=type;
|
||||
for (auto const& [type, def] : ini["Tags"]) {
|
||||
CString attTrigg = GetParam(def, 2);
|
||||
if (triggerId == attTrigg) {
|
||||
tag = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AD.mode=ACTIONMODE_CELLTAG;
|
||||
|
@ -319,31 +327,32 @@ void CTriggerEditorDlg::OnClone()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
int curtrig=m_Trigger.GetItemData(sel);
|
||||
|
||||
CString trigger=*ini.sections["Triggers"].GetValueName(curtrig);
|
||||
auto const& triggerId = ini["Triggers"].Nth(curtrig).first;
|
||||
|
||||
CString ID_T=GetFreeID();
|
||||
ini.sections["Triggers"].values[ID_T]=ini.sections["Triggers"].values[trigger];
|
||||
ini.sections["Events"].values[ID_T]=ini.sections["Events"].values[trigger];
|
||||
ini.sections["Actions"].values[ID_T]=ini.sections["Actions"].values[trigger];
|
||||
CString newId = GetFreeID();
|
||||
ini.SetString("Triggers", newId, ini["Triggers"][triggerId]);
|
||||
ini.SetString("Events", newId, ini["Events"][triggerId]);
|
||||
ini.SetString("Actions", newId, ini["Actions"][triggerId]);
|
||||
|
||||
ini.sections["Triggers"].values[ID_T]=SetParam(ini.sections["Triggers"].values[ID_T], 2, GetParam(ini.sections["Triggers"].values[ID_T], 2) + " Clone");
|
||||
ini.SetString("Triggers", newId, SetParam(ini["Triggers"][newId], 2, GetParam(ini["Triggers"][newId], 2) + " Clone"));
|
||||
|
||||
{
|
||||
CString ID_TAG=GetFreeID();
|
||||
ini.sections["Tags"].values[ID_TAG]=(CString)"0,"+GetParam(ini.sections["Triggers"].values[ID_T], 2)+",";
|
||||
ini.sections["Tags"].values[ID_TAG]+=ID_T;
|
||||
CString newTagId = GetFreeID();
|
||||
ini.SetString("Tags", newTagId, "0," + GetParam(ini["Triggers"][newId], 2) + ",");
|
||||
ini.SetString("Tags", newTagId, newId);
|
||||
}
|
||||
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE);
|
||||
|
||||
int i;
|
||||
for(i=0;i<m_Trigger.GetCount();i++)
|
||||
{
|
||||
if(m_Trigger.GetItemData(i)==ini.sections["Triggers"].FindName(ID_T))
|
||||
for (auto i = 0; i < m_Trigger.GetCount(); i++) {
|
||||
if (m_Trigger.GetItemData(i) == ini["Triggers"].FindIndex(newId)) {
|
||||
m_Trigger.SetCurSel(i);
|
||||
}
|
||||
}
|
||||
OnSelchangeTrigger();
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ END_MESSAGE_MAP()
|
|||
// Behandlungsroutinen für Nachrichten CTriggerEventsDlg
|
||||
|
||||
// MW 07/23/01: Added this because startpos=1+curev*3 isn´t anymore valid for calculating the next event
|
||||
int GetEventParamStart(CString& EventData, int param)
|
||||
int GetEventParamStart(const CString& EventData, int param)
|
||||
{
|
||||
int count=atoi(GetParam(EventData, 0));
|
||||
if(param>=count) return -1;
|
||||
|
@ -102,18 +102,20 @@ void CTriggerEventsDlg::OnNewevent()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
if (m_currentTrigger.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CIniFileSection& sec=ini.sections["Events"];
|
||||
CIniFileSection& sec=ini.AddSection("Events");
|
||||
|
||||
int cval=atoi(GetParam(sec.values[(LPCTSTR)m_currentTrigger],0));
|
||||
int cval = atoi(GetParam(sec.GetString(m_currentTrigger), 0));
|
||||
cval++;
|
||||
char c[50];
|
||||
itoa(cval,c,10);
|
||||
|
||||
sec.values[(LPCTSTR)m_currentTrigger]=SetParam(sec.values[(LPCTSTR)m_currentTrigger],0,c);
|
||||
sec.values[(LPCTSTR)m_currentTrigger]+=",0,0,0";
|
||||
sec.SetString(m_currentTrigger, SetParam(sec[m_currentTrigger], 0, c));
|
||||
sec.SetString(m_currentTrigger, ",0,0,0");
|
||||
|
||||
|
||||
UpdateDialog();
|
||||
|
@ -152,20 +154,21 @@ void CTriggerEventsDlg::OnDeleteevent()
|
|||
//MessageBox(d);
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
if (m_currentTrigger.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int sel2=m_Event.GetCurSel();
|
||||
if(sel2<0) return;
|
||||
if (sel2 < 0) {
|
||||
return;
|
||||
}
|
||||
int curev=m_Event.GetItemData(sel2);
|
||||
if(MessageBox("Do you really want to delete this event?","Delete event", MB_YESNO)==IDNO) return;
|
||||
if (MessageBox("Do you really want to delete this event?", "Delete event", MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CIniFileSection& sec=ini.sections["Events"];
|
||||
|
||||
CString data;
|
||||
data=sec.values[(LPCTSTR)m_currentTrigger];
|
||||
|
||||
CString orig_data=data;
|
||||
auto const & orig_data = ini["Events"][m_currentTrigger];
|
||||
CString data = orig_data;
|
||||
|
||||
int v=atoi(GetParam(data,0));
|
||||
char c[50];
|
||||
|
@ -183,15 +186,18 @@ void CTriggerEventsDlg::OnDeleteevent()
|
|||
BOOL bEvent1Needs4=FALSE;
|
||||
|
||||
|
||||
if(GetParam(data, pos+1)=="2") bEvent1Needs4=TRUE;
|
||||
if (GetParam(data, pos + 1) == "2") {
|
||||
bEvent1Needs4 = TRUE;
|
||||
}
|
||||
|
||||
int count=3;
|
||||
if(bEvent1Needs4) count=4;
|
||||
if (bEvent1Needs4) {
|
||||
count = 4;
|
||||
}
|
||||
|
||||
int del_start=FindTokenX(data, ',', pos);
|
||||
int del_end=FindTokenX(data, ',', pos+count);
|
||||
if(del_end<0)
|
||||
{
|
||||
if (del_end < 0) {
|
||||
// beyond end, so delete all...
|
||||
del_end=data.GetLength();
|
||||
|
||||
|
@ -216,7 +222,7 @@ void CTriggerEventsDlg::OnDeleteevent()
|
|||
}
|
||||
}*/
|
||||
|
||||
sec.values[(LPCTSTR)m_currentTrigger]=data;
|
||||
ini.SetString("Events", m_currentTrigger, data);
|
||||
UpdateDialog();
|
||||
|
||||
}
|
||||
|
@ -225,27 +231,30 @@ void CTriggerEventsDlg::OnSelchangeEvent()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
if (m_currentTrigger.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
int selev=m_Event.GetCurSel();
|
||||
if(selev<0) return;
|
||||
if (selev < 0) {
|
||||
return;
|
||||
}
|
||||
int curev=m_Event.GetItemData(selev);
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
CString EventData;
|
||||
EventData=ini.sections["Events"].values[(LPCTSTR)m_currentTrigger];
|
||||
auto const& EventData = ini["Events"][m_currentTrigger];
|
||||
|
||||
int startpos=GetEventParamStart(EventData, curev); //1+curev*3;
|
||||
CString EventType=GetParam(EventData,startpos);
|
||||
m_EventType.SetWindowText(EventType);
|
||||
for(i=0;i<m_EventType.GetCount();i++)
|
||||
{
|
||||
for (i = 0; i < m_EventType.GetCount(); i++) {
|
||||
CString tmp;
|
||||
m_EventType.GetLBText(i,tmp);
|
||||
TruncSpace(tmp);
|
||||
if(tmp==EventType)
|
||||
if (tmp == EventType) {
|
||||
m_EventType.SetCurSel(i);
|
||||
}
|
||||
}
|
||||
|
||||
OnEditchangeEventtype();
|
||||
|
@ -255,9 +264,13 @@ void CTriggerEventsDlg::OnEditchangeEventtype()
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
if (m_currentTrigger.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
int selev=m_Event.GetCurSel();
|
||||
if(selev<0) return;
|
||||
if (selev < 0) {
|
||||
return;
|
||||
}
|
||||
int curev=m_Event.GetItemData(selev);
|
||||
|
||||
CString e1,e2;
|
||||
|
@ -268,19 +281,19 @@ void CTriggerEventsDlg::OnEditchangeEventtype()
|
|||
m_EventType.GetWindowText(eventtype);
|
||||
TruncSpace(eventtype);
|
||||
|
||||
if(eventtype.GetLength()==0)
|
||||
{
|
||||
eventtype="0";
|
||||
if (eventtype.GetLength() == 0) {
|
||||
eventtype = "0";
|
||||
m_EventType.SetWindowText(eventtype);
|
||||
}
|
||||
|
||||
int pos=GetEventParamStart(ini.sections["Events"].values[(LPCTSTR)m_currentTrigger], curev); //1+3*curev;
|
||||
int pos = GetEventParamStart(ini["Events"][m_currentTrigger], curev); //1+3*curev;
|
||||
|
||||
BOOL bAlready4=FALSE;
|
||||
if(atoi(GetParam(ini.sections["Events"].values[(LPCTSTR)m_currentTrigger], pos+1))==2)
|
||||
bAlready4=TRUE;
|
||||
BOOL bAlready4 = FALSE;
|
||||
if (atoi(GetParam(ini["Events"][m_currentTrigger], pos + 1)) == 2) {
|
||||
bAlready4 = TRUE;
|
||||
}
|
||||
|
||||
ini.sections["Events"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Events"].values[(LPCTSTR)m_currentTrigger], pos, (LPCTSTR)eventtype);
|
||||
ini.SetString("Events", m_currentTrigger, SetParam(ini["Events"][m_currentTrigger], pos, eventtype));
|
||||
|
||||
|
||||
CString evsec="Events";
|
||||
|
@ -289,12 +302,16 @@ void CTriggerEventsDlg::OnEditchangeEventtype()
|
|||
#endif
|
||||
|
||||
|
||||
if(g_data.sections[evsec].FindName(eventtype)<0) return;
|
||||
eventdata=g_data.sections[evsec].values[eventtype];
|
||||
if (!g_data[evsec].Exists(eventtype)) {
|
||||
return;
|
||||
}
|
||||
eventdata = g_data[evsec][eventtype];
|
||||
|
||||
#ifdef RA2_MODE
|
||||
if(g_data.sections["EventsRA2"].FindName(eventtype)>=0)
|
||||
eventdata=g_data.sections["EventsRA2"].values[eventtype];
|
||||
auto const ra2EventConf = g_data.GetString("EventsRA2", eventtype);
|
||||
if (!ra2EventConf.IsEmpty()) {
|
||||
eventdata = ra2EventConf;
|
||||
}
|
||||
#endif
|
||||
|
||||
CString desc=GetParam(eventdata,5);
|
||||
|
@ -307,59 +324,51 @@ void CTriggerEventsDlg::OnEditchangeEventtype()
|
|||
|
||||
|
||||
int pListType[2];
|
||||
pListType[0]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[0]], 1));
|
||||
pListType[1]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[1]], 1));
|
||||
pListType[0]=atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1));
|
||||
pListType[1]=atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1));
|
||||
|
||||
int code=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[0]], 2)); // usually 0
|
||||
int code = atoi(GetParam(g_data["ParamTypes"][ptype[0]], 2)); // usually 0
|
||||
|
||||
// **************************************
|
||||
// MW ADD SUPPORT FOR 2 PARAMS+CODE
|
||||
if(code==2)
|
||||
{
|
||||
if (code == 2) {
|
||||
// add code + event 0 ONLY IF THEY DO NOT ALREADY EXIST
|
||||
if(!bAlready4) ini.sections["Events"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Events"].values[(LPCTSTR)m_currentTrigger], pos+1, "2,0");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!bAlready4) {
|
||||
ini.SetString("Events", m_currentTrigger, SetParam(ini["Events"][m_currentTrigger], pos + 1, "2,0"));
|
||||
}
|
||||
} else {
|
||||
// remove code + event 0
|
||||
char c[50];
|
||||
itoa(code, c, 10);
|
||||
ini.sections["Events"].values[(LPCTSTR)m_currentTrigger]=SetParam(ini.sections["Events"].values[(LPCTSTR)m_currentTrigger], pos+1, c);
|
||||
ini.SetString("Events", m_currentTrigger, SetParam(ini["Events"][m_currentTrigger], pos + 1, c));
|
||||
|
||||
if(bAlready4)
|
||||
{
|
||||
|
||||
CString& data=ini.sections["Events"].values[(LPCTSTR)m_currentTrigger];
|
||||
|
||||
int del_start=FindTokenX(data, ',', pos+2);
|
||||
int del_end=FindTokenX(data, ',', pos+3);
|
||||
if(del_end<0)
|
||||
{
|
||||
if (bAlready4) {
|
||||
CString data = ini["Events"][m_currentTrigger];
|
||||
int del_start = FindTokenX(data, ',', pos + 2);
|
||||
int del_end = FindTokenX(data, ',', pos + 3);
|
||||
if (del_end < 0) {
|
||||
// beyond end, so delete all...
|
||||
del_end=data.GetLength();
|
||||
del_end = data.GetLength();
|
||||
|
||||
}
|
||||
data.Delete(del_start, del_end-del_start);
|
||||
data.Delete(del_start, del_end - del_start);
|
||||
ini.SetString("Events", m_currentTrigger, data);
|
||||
}
|
||||
|
||||
}
|
||||
// **************************************
|
||||
|
||||
int i;
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
int add=0;
|
||||
if(code==2) add=1;
|
||||
|
||||
if(atoi(ptype[i])!=0 && atoi(ptype[i])>0 && atoi(ptype[i])!=47)
|
||||
{
|
||||
CString paramname=GetParam(g_data.sections["ParamTypes"].values[ptype[i]], 0);
|
||||
|
||||
m_Parameter.SetItemData(m_Parameter.AddString(paramname), i+add);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
int add = 0;
|
||||
if (code == 2) {
|
||||
add = 1;
|
||||
}
|
||||
if (atoi(ptype[i]) != 0 && atoi(ptype[i]) > 0 && atoi(ptype[i]) != 47) {
|
||||
CString paramname = GetParam(g_data["ParamTypes"][ptype[i]], 0);
|
||||
|
||||
m_Parameter.SetItemData(m_Parameter.AddString(paramname), i + add);
|
||||
}
|
||||
}
|
||||
|
||||
m_ParamValue.SetWindowText("");
|
||||
|
@ -369,126 +378,127 @@ void CTriggerEventsDlg::OnEditchangeEventtype()
|
|||
}
|
||||
|
||||
|
||||
|
||||
RepairTrigger(ini.sections["Triggers"].values[m_currentTrigger]);
|
||||
|
||||
auto triggerInfoCopy = ini["Triggers"][m_currentTrigger];
|
||||
if (RepairTrigger(triggerInfoCopy)) {
|
||||
ini.SetString("Triggers", m_currentTrigger, triggerInfoCopy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CTriggerEventsDlg::OnSelchangeParameter()
|
||||
void CTriggerEventsDlg::OnSelchangeParameter()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
int selev=m_Event.GetCurSel();
|
||||
if(selev<0) return;
|
||||
int curev=m_Event.GetItemData(selev);
|
||||
if (m_currentTrigger.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
int selev = m_Event.GetCurSel();
|
||||
if (selev < 0) {
|
||||
return;
|
||||
}
|
||||
int curev = m_Event.GetItemData(selev);
|
||||
|
||||
int curselparam=m_Parameter.GetCurSel();
|
||||
if(curselparam<0)
|
||||
{
|
||||
int curselparam = m_Parameter.GetCurSel();
|
||||
if (curselparam < 0) {
|
||||
m_ParamValue.SetWindowText("");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int curparam = m_Parameter.GetItemData(curselparam);
|
||||
auto const EventData = ini["Events"][m_currentTrigger];
|
||||
int startpos = GetEventParamStart(EventData, curev);//1+curev*3;
|
||||
|
||||
int curparam=m_Parameter.GetItemData(curselparam);
|
||||
|
||||
|
||||
CString EventData;
|
||||
EventData=ini.sections["Events"].values[(LPCTSTR)m_currentTrigger];
|
||||
|
||||
int startpos=GetEventParamStart(EventData, curev);//1+curev*3;
|
||||
|
||||
|
||||
// MW FIX FOR CODE!=0
|
||||
int original_cuparam=curparam;
|
||||
int original_cuparam = curparam;
|
||||
#ifdef RA2_MODE
|
||||
CString Param1=GetParam(g_data.sections["EventsRA2"].values[GetParam(EventData,startpos)],1);
|
||||
CString Code=GetParam(g_data.sections["ParamTypes"].values[Param1],2);
|
||||
CString Param1 = GetParam(g_data["EventsRA2"][GetParam(EventData, startpos)], 1);
|
||||
CString Code = GetParam(g_data["ParamTypes"][Param1], 2);
|
||||
//MessageBox(Param1, Code);
|
||||
if(atoi(Code)!=0) curparam--;
|
||||
if (atoi(Code) != 0) curparam--;
|
||||
#endif
|
||||
// END FIx
|
||||
|
||||
CString ParamType=GetParam(g_data.sections["Events"].values[GetParam(EventData,startpos)],1+curparam);
|
||||
CString ParamType = GetParam(g_data["Events"][GetParam(EventData, startpos)], 1 + curparam);
|
||||
#ifdef RA2_MODE
|
||||
if(g_data.sections["EventsRA2"].FindName(GetParam(EventData, startpos))>=0) ParamType=GetParam(g_data.sections["EventsRA2"].values[GetParam(EventData,startpos)],1+curparam);
|
||||
if (g_data["EventsRA2"].FindIndex(GetParam(EventData, startpos)) >= 0) {
|
||||
ParamType = GetParam(g_data["EventsRA2"][GetParam(EventData, startpos)], 1 + curparam);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(atoi(ParamType)<0)
|
||||
{
|
||||
if (atoi(ParamType) < 0) {
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
CString ListType = GetParam(g_data["ParamTypes"][ParamType], 1);
|
||||
|
||||
HandleParamList(m_ParamValue, atoi(ListType));
|
||||
m_ParamValue.SetWindowText(GetParam(EventData, startpos + 1 + original_cuparam));
|
||||
|
||||
int i;
|
||||
BOOL bFound = FALSE;
|
||||
for (i = 0; i < m_ParamValue.GetCount(); i++)
|
||||
{
|
||||
CString ListType=GetParam(g_data.sections["ParamTypes"].values[ParamType],1);
|
||||
|
||||
HandleParamList(m_ParamValue, atoi(ListType));
|
||||
m_ParamValue.SetWindowText(GetParam(EventData,startpos+1+original_cuparam));
|
||||
|
||||
int i;
|
||||
BOOL bFound=FALSE;
|
||||
for(i=0;i<m_ParamValue.GetCount();i++)
|
||||
CString tmp;
|
||||
m_ParamValue.GetLBText(i, tmp);
|
||||
TruncSpace(tmp);
|
||||
if (tmp == GetParam(EventData, startpos + 1 + original_cuparam))
|
||||
{
|
||||
CString tmp;
|
||||
m_ParamValue.GetLBText(i,tmp);
|
||||
TruncSpace(tmp);
|
||||
if(tmp==GetParam(EventData,startpos+1+original_cuparam))
|
||||
{
|
||||
m_ParamValue.SetCurSel(i);
|
||||
bFound=TRUE;
|
||||
break;
|
||||
}
|
||||
m_ParamValue.SetCurSel(i);
|
||||
bFound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/*if(!bFound)
|
||||
}
|
||||
|
||||
/*if(!bFound)
|
||||
{
|
||||
// not found, change it...
|
||||
|
||||
if(m_ParamValue.GetCount()) {
|
||||
m_ParamValue.SetCurSel(0);
|
||||
OnEditchangeParamvalue();
|
||||
}
|
||||
else
|
||||
{
|
||||
// not found, change it...
|
||||
|
||||
if(m_ParamValue.GetCount()) {
|
||||
m_ParamValue.SetCurSel(0);
|
||||
// not numeric value?
|
||||
|
||||
CString p=GetParam(EventData,startpos+1+original_cuparam);
|
||||
char c[50];
|
||||
itoa(atoi(p), c, 10);
|
||||
if(c!=p) {
|
||||
m_ParamValue.SetWindowText("0");
|
||||
OnEditchangeParamvalue();
|
||||
}
|
||||
else
|
||||
{
|
||||
// not numeric value?
|
||||
|
||||
CString p=GetParam(EventData,startpos+1+original_cuparam);
|
||||
char c[50];
|
||||
itoa(atoi(p), c, 10);
|
||||
if(c!=p) {
|
||||
m_ParamValue.SetWindowText("0");
|
||||
OnEditchangeParamvalue();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void CTriggerEventsDlg::OnEditchangeParamvalue()
|
||||
void CTriggerEventsDlg::OnEditchangeParamvalue()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
int selev=m_Event.GetCurSel();
|
||||
if(selev<0) return;
|
||||
int curev=m_Event.GetItemData(selev);
|
||||
if (m_currentTrigger.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
int selev = m_Event.GetCurSel();
|
||||
if (selev < 0) {
|
||||
return;
|
||||
}
|
||||
int curev = m_Event.GetItemData(selev);
|
||||
|
||||
int curselparam=m_Parameter.GetCurSel();
|
||||
if(curselparam<0)
|
||||
int curselparam = m_Parameter.GetCurSel();
|
||||
if (curselparam < 0)
|
||||
{
|
||||
m_ParamValue.SetWindowText("");
|
||||
return;
|
||||
}
|
||||
|
||||
int curparam=m_Parameter.GetItemData(curselparam);
|
||||
|
||||
CString EventData;
|
||||
EventData=ini.sections["Events"].values[(LPCTSTR)m_currentTrigger];
|
||||
|
||||
int startpos=GetEventParamStart(EventData, curev);// 1+curev*3;
|
||||
int curparam = m_Parameter.GetItemData(curselparam);
|
||||
|
||||
auto const& eventData = ini["Events"][m_currentTrigger];
|
||||
|
||||
int startpos = GetEventParamStart(eventData, curev);// 1+curev*3;
|
||||
|
||||
|
||||
CString newVal;
|
||||
|
@ -496,9 +506,11 @@ void CTriggerEventsDlg::OnEditchangeParamvalue()
|
|||
TruncSpace(newVal);
|
||||
newVal.TrimLeft();
|
||||
|
||||
if(newVal.Find(",",0)>=0) newVal.SetAt(newVal.Find(",",0), 0);
|
||||
if (newVal.Find(",", 0) >= 0) {
|
||||
newVal.SetAt(newVal.Find(",", 0), 0);
|
||||
}
|
||||
|
||||
ini.sections["Events"].values[(LPCTSTR)m_currentTrigger]=SetParam(EventData, startpos+1+curparam, newVal);
|
||||
ini.SetString("Events", m_currentTrigger, SetParam(eventData, startpos + 1 + curparam, newVal));
|
||||
}
|
||||
|
||||
void CTriggerEventsDlg::UpdateDialog()
|
||||
|
@ -523,26 +535,23 @@ void CTriggerEventsDlg::UpdateDialog()
|
|||
CString sec="EventsRA2";
|
||||
#endif
|
||||
|
||||
for(i=0;i<g_data.sections[sec].values.size();i++)
|
||||
{
|
||||
CString eventid = *g_data.sections[sec].GetValueName(i); //GetParam(*g_data.sections["Events"].GetValue(i),8);
|
||||
CString eventdata=*g_data.sections[sec].GetValue(i);
|
||||
for (auto const& [eventid, eventdata] : g_data[sec]) {
|
||||
//GetParam(*g_data.sections["Events"].GetValue(i),8);
|
||||
/*#ifdef RA2_MODE
|
||||
if(g_data.sections["EventsRA2"].FindName(eventid)>=0)
|
||||
if(g_data.sections["EventsRA2"].FindIndex(eventid)>=0)
|
||||
eventdata=g_data.sections["EventsRA2"].values[eventid];
|
||||
#endif*/
|
||||
|
||||
CString text=eventid+" "+GetParam(eventdata,0);
|
||||
text.Replace("%1",",");
|
||||
CString text = eventid + " " + GetParam(eventdata, 0);
|
||||
text.Replace("%1", ",");
|
||||
#ifdef RA2_MODE
|
||||
// MW 07/18/01
|
||||
// for yuri mode, only check if it´s for RA2, else support it only if YR isnt´needed...
|
||||
if(GetParam(eventdata, 7)=="1" && ( yuri_mode || !atoi(GetParam(eventdata,9)) ) )
|
||||
{
|
||||
if (GetParam(eventdata, 7) == "1" && (yuri_mode || !atoi(GetParam(eventdata, 9)))) {
|
||||
|
||||
|
||||
#else
|
||||
if(GetParam(eventdata, 6)=="1")
|
||||
if (GetParam(eventdata, 6) == "1")
|
||||
{
|
||||
#endif
|
||||
m_EventType.AddString(text);
|
||||
|
@ -554,8 +563,8 @@ void CTriggerEventsDlg::UpdateDialog()
|
|||
int cur_sel=m_Event.GetCurSel();
|
||||
while(m_Event.DeleteString(0)!=CB_ERR);
|
||||
|
||||
CString Data=ini.sections["Events"].values[m_currentTrigger];
|
||||
int count=atoi(GetParam(Data,0));
|
||||
auto const& data = ini["Events"][m_currentTrigger];
|
||||
int count = atoi(GetParam(data, 0));
|
||||
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
|
@ -569,8 +578,12 @@ void CTriggerEventsDlg::UpdateDialog()
|
|||
m_Event.SetItemData(m_Event.AddString(s), i);
|
||||
}
|
||||
|
||||
if(cur_sel<0) cur_sel=0;
|
||||
if(cur_sel>=count) cur_sel=count-1;
|
||||
if (cur_sel < 0) {
|
||||
cur_sel = 0;
|
||||
}
|
||||
if (cur_sel >= count) {
|
||||
cur_sel = count - 1;
|
||||
}
|
||||
|
||||
m_Event.SetCurSel(cur_sel);
|
||||
|
||||
|
|
|
@ -85,99 +85,105 @@ void CTriggerOptionsDlg::UpdateDialog()
|
|||
{
|
||||
// MW 07/20/01
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
if (m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ListHouses(m_House, FALSE, TRUE, FALSE);
|
||||
ListTriggers(m_AttachedTrigger);
|
||||
m_AttachedTrigger.InsertString(0, "<none>");
|
||||
|
||||
RepairTrigger(ini.sections["Triggers"].values[m_currentTrigger]);
|
||||
|
||||
m_Name.SetWindowText(GetParam(ini.sections["Triggers"].values[m_currentTrigger],2));
|
||||
m_House.SetWindowText(TranslateHouse(GetParam(ini.sections["Triggers"].values[m_currentTrigger],0), TRUE));
|
||||
CString attachedTrigger=GetParam(ini.sections["Triggers"].values[m_currentTrigger],1);
|
||||
m_AttachedTrigger.SetWindowText(attachedTrigger);
|
||||
|
||||
m_Disabled.SetCheck((atoi(GetParam(ini.sections["Triggers"].values[m_currentTrigger],3))));
|
||||
m_Easy.SetCheck((atoi(GetParam(ini.sections["Triggers"].values[m_currentTrigger],4))));
|
||||
m_Medium.SetCheck((atoi(GetParam(ini.sections["Triggers"].values[m_currentTrigger],5))));
|
||||
m_Hard.SetCheck((atoi(GetParam(ini.sections["Triggers"].values[m_currentTrigger],6))));
|
||||
|
||||
int i;
|
||||
for(i=0;i<m_AttachedTrigger.GetCount();i++)
|
||||
{
|
||||
CString tmp;
|
||||
m_AttachedTrigger.GetLBText(i,tmp);
|
||||
TruncSpace(tmp);
|
||||
if(tmp==attachedTrigger)
|
||||
m_AttachedTrigger.SetCurSel(i);
|
||||
auto triggerCopy = ini["Triggers"][m_currentTrigger];
|
||||
if (RepairTrigger(triggerCopy)) {
|
||||
ini.SetString("Triggers", m_currentTrigger, triggerCopy);
|
||||
}
|
||||
|
||||
for(i=0;i<ini.sections["Tags"].values.size();i++)
|
||||
{
|
||||
CString type=*ini.sections["Tags"].GetValueName(i);
|
||||
m_Name.SetWindowText(GetParam(triggerCopy, 2));
|
||||
m_House.SetWindowText(TranslateHouse(GetParam(triggerCopy, 0), TRUE));
|
||||
CString attachedTrigger = GetParam(triggerCopy, 1);
|
||||
m_AttachedTrigger.SetWindowText(attachedTrigger);
|
||||
|
||||
CString attTrigg=GetParam(ini.sections["Tags"].values[type], 2);
|
||||
if(attTrigg==m_currentTrigger)
|
||||
{
|
||||
m_TriggerType.SetWindowText(GetParam(ini.sections["Tags"].values[type], 0));
|
||||
m_Disabled.SetCheck((atoi(GetParam(triggerCopy, 3))));
|
||||
m_Easy.SetCheck((atoi(GetParam(triggerCopy, 4))));
|
||||
m_Medium.SetCheck((atoi(GetParam(triggerCopy, 5))));
|
||||
m_Hard.SetCheck((atoi(GetParam(triggerCopy, 6))));
|
||||
|
||||
for (auto i = 0; i < m_AttachedTrigger.GetCount(); i++) {
|
||||
CString tmp;
|
||||
m_AttachedTrigger.GetLBText(i, tmp);
|
||||
TruncSpace(tmp);
|
||||
if (tmp == attachedTrigger) {
|
||||
m_AttachedTrigger.SetCurSel(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto const& [type, def] : ini["Tags"]) {
|
||||
CString attTrigg = GetParam(def, 2);
|
||||
if (attTrigg == m_currentTrigger) {
|
||||
m_TriggerType.SetWindowText(GetParam(def, 0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CTriggerOptionsDlg::OnChangeName()
|
||||
void CTriggerOptionsDlg::OnChangeName()
|
||||
{
|
||||
if(m_currentTrigger.GetLength()==0) return;
|
||||
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections["Triggers"].FindName(m_currentTrigger)<0 || m_currentTrigger.GetLength()==0) return;
|
||||
|
||||
if (m_currentTrigger.GetLength() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString newName;
|
||||
m_Name.GetWindowText(newName);
|
||||
|
||||
if(newName.GetLength()==0) newName=" ";
|
||||
if (newName.GetLength() == 0) {
|
||||
newName = " ";
|
||||
}
|
||||
|
||||
if(newName.Find(",",0)>=0)
|
||||
if (newName.Find(",", 0) >= 0)
|
||||
{//newName.SetAt(newName.Find(",",0), 0);
|
||||
newName=newName.Left(newName.Find(",",0));
|
||||
newName = newName.Left(newName.Find(",", 0));
|
||||
|
||||
m_Name.SetWindowText(newName);}
|
||||
m_Name.SetWindowText(newName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 2, newName);
|
||||
|
||||
ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 2, newName));
|
||||
|
||||
int i;
|
||||
int p=0;
|
||||
for(i=0;i<ini.sections["Tags"].values.size();i++)
|
||||
{
|
||||
CString type=*ini.sections["Tags"].GetValueName(i);
|
||||
|
||||
CString attTrigg=GetParam(ini.sections["Tags"].values[type], 2);
|
||||
if(attTrigg==m_currentTrigger)
|
||||
{
|
||||
int p = 0;
|
||||
for (auto const& [type, def] : ini["Tags"]) {
|
||||
CString attTrigg = GetParam(def, 2);
|
||||
if (attTrigg == m_currentTrigger) {
|
||||
p++;
|
||||
char c[50];
|
||||
itoa(p,c,10);
|
||||
CString newVal=newName+" ";
|
||||
newVal+=c;
|
||||
ini.sections["Tags"].values[type]=SetParam(ini.sections["Tags"].values[type], 1, newVal);
|
||||
|
||||
itoa(p, c, 10);
|
||||
CString newVal = newName + " ";
|
||||
newVal += c;
|
||||
ini.SetString("Tags", type, SetParam(ini.GetString("Tags", type), 1, newVal));
|
||||
}
|
||||
}
|
||||
//MessageBox(ini.sections["Triggers"].values[m_currentTrigger],newName);
|
||||
RepairTrigger(ini.sections["Triggers"].values[m_currentTrigger]);
|
||||
|
||||
auto triggerCopy = ini["Triggers"][m_currentTrigger];
|
||||
if (RepairTrigger(triggerCopy)) {
|
||||
ini.SetString("Triggers", m_currentTrigger, triggerCopy);
|
||||
}
|
||||
}
|
||||
|
||||
void CTriggerOptionsDlg::OnEditchangeHouse()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections["Triggers"].FindName(m_currentTrigger)<0 || m_currentTrigger.GetLength()==0) return;
|
||||
if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString newHouse;
|
||||
m_House.GetWindowText(newHouse);
|
||||
|
@ -188,31 +194,37 @@ void CTriggerOptionsDlg::OnEditchangeHouse()
|
|||
|
||||
newHouse.TrimLeft();
|
||||
TruncSpace(newHouse);
|
||||
if(newHouse.Find(",",0)>=0) newHouse.SetAt(newHouse.Find(",",0), 0);
|
||||
if (newHouse.Find(",", 0) >= 0) {
|
||||
newHouse.SetAt(newHouse.Find(",", 0), 0);
|
||||
}
|
||||
|
||||
ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 0, newHouse));
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 0, newHouse);
|
||||
|
||||
RepairTrigger(ini.sections["Triggers"].values[m_currentTrigger]);
|
||||
|
||||
auto triggerCopy = ini["Triggers"][m_currentTrigger];
|
||||
if (RepairTrigger(triggerCopy)) {
|
||||
ini.SetString("Triggers", m_currentTrigger, triggerCopy);
|
||||
}
|
||||
}
|
||||
|
||||
void CTriggerOptionsDlg::OnEditchangeAttachedtrigger()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections["Triggers"].FindName(m_currentTrigger)<0 || m_currentTrigger.GetLength()==0) return;
|
||||
if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString newTrigger;
|
||||
m_AttachedTrigger.GetWindowText(newTrigger);
|
||||
newTrigger.TrimLeft();
|
||||
TruncSpace(newTrigger);
|
||||
|
||||
if(newTrigger.Find(",",0)>=0) newTrigger.SetAt(newTrigger.Find(",",0), 0);
|
||||
if (newTrigger.Find(",", 0) >= 0) {
|
||||
newTrigger.SetAt(newTrigger.Find(",", 0), 0);
|
||||
}
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 1, newTrigger);
|
||||
ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 1, newTrigger));
|
||||
|
||||
|
||||
|
||||
|
@ -230,11 +242,13 @@ void CTriggerOptionsDlg::OnKillFocus(CWnd* pNewWnd)
|
|||
((CTriggerEditorDlg*)(this->GetOwner()->GetOwner()))->UpdateDialog();
|
||||
}
|
||||
|
||||
void CTriggerOptionsDlg::OnEditchangeTriggertype()
|
||||
void CTriggerOptionsDlg::OnEditchangeTriggertype()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections["Triggers"].FindName(m_currentTrigger)<0 || m_currentTrigger.GetLength()==0) return;
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CString newType;
|
||||
|
@ -242,18 +256,17 @@ void CTriggerOptionsDlg::OnEditchangeTriggertype()
|
|||
TruncSpace(newType);
|
||||
|
||||
int i;
|
||||
for(i=0;i<ini.sections["Tags"].values.size();i++)
|
||||
{
|
||||
CString type=*ini.sections["Tags"].GetValueName(i);
|
||||
|
||||
CString attTrigg=GetParam(ini.sections["Tags"].values[type], 2);
|
||||
if(attTrigg==m_currentTrigger)
|
||||
{
|
||||
ini.sections["Tags"].values[type]=SetParam(ini.sections["Tags"].values[type], 0, newType);
|
||||
for (auto const& [type, def] : ini["Tags"]) {
|
||||
CString attTrigg = GetParam(def, 2);
|
||||
if (attTrigg == m_currentTrigger) {
|
||||
ini.SetString("Tags", type, SetParam(ini["Tags"][type], 0, newType));
|
||||
}
|
||||
}
|
||||
|
||||
RepairTrigger(ini.sections["Triggers"].values[m_currentTrigger]);
|
||||
}
|
||||
|
||||
auto trigger = ini["Triggers"][m_currentTrigger];
|
||||
if (RepairTrigger(trigger)) {
|
||||
ini.SetString("Triggers", m_currentTrigger, trigger);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CTriggerOptionsDlg::PreTranslateMessage(MSG* pMsg)
|
||||
|
@ -275,79 +288,80 @@ BOOL CTriggerOptionsDlg::OnInitDialog()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void CTriggerOptionsDlg::OnDisabled()
|
||||
void CTriggerOptionsDlg::OnDisabled()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections["Triggers"].FindName(m_currentTrigger)<0 || m_currentTrigger.GetLength()==0) return;
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
BOOL bDisabled=FALSE;
|
||||
if(m_Disabled.GetCheck()==0) bDisabled=FALSE;
|
||||
else
|
||||
bDisabled=TRUE;
|
||||
|
||||
if(bDisabled)
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 3, "1");
|
||||
else
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 3, "0");
|
||||
if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL bDisabled = FALSE;
|
||||
if (m_Disabled.GetCheck() == 0) {
|
||||
bDisabled = FALSE;
|
||||
} else {
|
||||
bDisabled = TRUE;
|
||||
}
|
||||
|
||||
|
||||
auto const param = bDisabled ? "1" : "0";
|
||||
ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 3, param));
|
||||
}
|
||||
|
||||
void CTriggerOptionsDlg::OnEasy()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections["Triggers"].FindName(m_currentTrigger)<0 || m_currentTrigger.GetLength()==0) return;
|
||||
if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL bEasy=FALSE;
|
||||
if(m_Easy.GetCheck()==0) bEasy=FALSE;
|
||||
else
|
||||
bEasy=TRUE;
|
||||
|
||||
if(bEasy)
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 4, "1");
|
||||
else
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 4, "0");
|
||||
|
||||
if (m_Easy.GetCheck() == 0) {
|
||||
bEasy = FALSE;
|
||||
} else {
|
||||
bEasy = TRUE;
|
||||
}
|
||||
|
||||
auto const param = bEasy ? "1" : "0";
|
||||
ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 4, param));
|
||||
}
|
||||
|
||||
void CTriggerOptionsDlg::OnMedium()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections["Triggers"].FindName(m_currentTrigger)<0 || m_currentTrigger.GetLength()==0) return;
|
||||
if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL bMedium=FALSE;
|
||||
if(m_Medium.GetCheck()==0) bMedium=FALSE;
|
||||
else
|
||||
bMedium=TRUE;
|
||||
|
||||
if(bMedium)
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 5, "1");
|
||||
else
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 5, "0");
|
||||
if (m_Medium.GetCheck() == 0) {
|
||||
bMedium = FALSE;
|
||||
} else {
|
||||
bMedium = TRUE;
|
||||
}
|
||||
|
||||
auto const param = bMedium ? "1" : "0";
|
||||
ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 5, param));
|
||||
}
|
||||
|
||||
void CTriggerOptionsDlg::OnHard()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(ini.sections["Triggers"].FindName(m_currentTrigger)<0 || m_currentTrigger.GetLength()==0) return;
|
||||
if (!ini["Triggers"].Exists(m_currentTrigger) || m_currentTrigger.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL bHard=FALSE;
|
||||
if(m_Hard.GetCheck()==0) bHard=FALSE;
|
||||
else
|
||||
bHard=TRUE;
|
||||
|
||||
if(bHard)
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 6, "1");
|
||||
else
|
||||
ini.sections["Triggers"].values[m_currentTrigger]=SetParam(ini.sections["Triggers"].values[m_currentTrigger], 6, "0");
|
||||
if (m_Hard.GetCheck() == 0) {
|
||||
bHard = FALSE;
|
||||
} else {
|
||||
bHard = TRUE;
|
||||
}
|
||||
|
||||
auto const param = bHard ? "1" : "0";
|
||||
ini.SetString("Triggers", m_currentTrigger, SetParam(ini["Triggers"][m_currentTrigger], 6, param));
|
||||
}
|
||||
|
||||
//MW 07/20/01
|
||||
|
|
|
@ -189,35 +189,23 @@ void CTriggers::UpdateDialog()
|
|||
int i;
|
||||
|
||||
m_Trigger2.AddString("<none>");
|
||||
for(i=0;i<ini.sections["Triggers"].values.size();i++)
|
||||
{
|
||||
CString type;
|
||||
CString s;
|
||||
type=*ini.sections["Triggers"].GetValueName(i);
|
||||
|
||||
s=type;
|
||||
s+=" (";
|
||||
s+=GetParam(ini.sections["Triggers"].values[type], 2);
|
||||
s+=")";
|
||||
for (auto const& [type, def] : ini["Triggers"]) {
|
||||
auto s = type;
|
||||
s += " (";
|
||||
s += GetParam(def, 2);
|
||||
s += ")";
|
||||
|
||||
m_Trigger.AddString(s);
|
||||
m_Trigger2.AddString(s);
|
||||
|
||||
}
|
||||
|
||||
for(i=0;i<g_data.sections["Events"].values.size();i++)
|
||||
{
|
||||
CString eventid=*g_data.sections["Events"].GetValueName(i);
|
||||
CString eventdata=*g_data.sections["Events"].GetValue(i);
|
||||
CString text=eventid+" "+GetParam(eventdata,0);
|
||||
for (auto const& [eventid, eventdata] : g_data["Events"]) {
|
||||
CString text = eventid + " " + GetParam(eventdata, 0);
|
||||
m_EventType.AddString(text);
|
||||
}
|
||||
|
||||
for(i=0;i<g_data.sections["Actions"].values.size();i++)
|
||||
{
|
||||
CString actionid=*g_data.sections["Actions"].GetValueName(i);
|
||||
CString actiondata=*g_data.sections["Actions"].GetValue(i);
|
||||
CString text=actionid+" "+GetParam(actiondata,0);
|
||||
for (auto const& [actionid, actiondata] : g_data["Actions"]) {
|
||||
CString text = actionid + " " + GetParam(actiondata, 0);
|
||||
m_ActionType.AddString(text);
|
||||
}
|
||||
|
||||
|
@ -227,25 +215,18 @@ void CTriggers::UpdateDialog()
|
|||
CComboBox* wayp;
|
||||
wayp=(CComboBox*)GetDlgItem(IDC_ACTIONWAYPOINT);
|
||||
while(wayp->DeleteString(0)!=CB_ERR);
|
||||
if(ini.sections.find("Waypoints")!=ini.sections.end())
|
||||
{
|
||||
for(i=0;i<ini.sections["Waypoints"].values.size();i++)
|
||||
{
|
||||
wayp->AddString(*ini.sections["Waypoints"].GetValueName(i));
|
||||
}
|
||||
|
||||
for (auto const& [num, coord] : ini["Waypoints"]) {
|
||||
wayp->AddString(num);
|
||||
}
|
||||
|
||||
|
||||
if(sel==-1 || m_Trigger.SetCurSel(sel)==FALSE)
|
||||
{
|
||||
if(sel==-1 || m_Trigger.SetCurSel(sel)==FALSE) {
|
||||
m_Trigger.SetCurSel(0);
|
||||
}
|
||||
if(selat==-1 || m_Trigger.SetCurSel(selat)==FALSE)
|
||||
{
|
||||
if(selat==-1 || m_Trigger.SetCurSel(selat)==FALSE) {
|
||||
m_Action.SetCurSel(0);
|
||||
}
|
||||
if(selev==-1 || m_Trigger.SetCurSel(selev)==FALSE)
|
||||
{
|
||||
if(selev==-1 || m_Trigger.SetCurSel(selev)==FALSE) {
|
||||
m_Event.SetCurSel(0);
|
||||
}
|
||||
|
||||
|
@ -269,20 +250,19 @@ void CTriggers::OnSelchangeTrigger()
|
|||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
TriggerData=ini.sections["Triggers"].values[CurrentTrigger];
|
||||
EventData=ini.sections["Events"].values[CurrentTrigger];
|
||||
ActionData=ini.sections["Actions"].values[CurrentTrigger];
|
||||
TriggerData = ini.GetString("Triggers", CurrentTrigger);
|
||||
EventData = ini.GetString("Events", CurrentTrigger);
|
||||
ActionData = ini.GetString("Actions", CurrentTrigger);
|
||||
|
||||
m_Name=GetParam(TriggerData, 2);
|
||||
m_House.SetWindowText(TranslateHouse(GetParam(TriggerData,0), TRUE));
|
||||
|
||||
|
||||
CString trig2=GetParam(TriggerData,1);
|
||||
if(ini.sections["Triggers"].values.find(trig2)!=ini.sections["Triggers"].values.end())
|
||||
{
|
||||
trig2+=" (";
|
||||
trig2+=GetParam( ini.sections["Triggers"].values[GetParam(TriggerData,1)],2);
|
||||
trig2+=")";
|
||||
if (ini["Triggers"].Exists(trig2)) {
|
||||
trig2 += " (";
|
||||
trig2 += GetParam(ini["Triggers"][GetParam(TriggerData, 1)], 2);
|
||||
trig2 += ")";
|
||||
}
|
||||
m_Trigger2.SetWindowText(trig2);
|
||||
|
||||
|
@ -338,11 +318,10 @@ void CTriggers::OnSelchangeEvent()
|
|||
TruncSpace(CurrentTrigger);
|
||||
|
||||
|
||||
CString EventData;
|
||||
EventData=ini.sections["Events"].values[(LPCTSTR)CurrentTrigger];
|
||||
auto const& eventData = ini["Events"][CurrentTrigger];
|
||||
|
||||
int startpos=1+selev*3;
|
||||
CString EventType=GetParam(EventData,startpos);
|
||||
CString EventType=GetParam(eventData,startpos);
|
||||
m_EventType.SetWindowText(EventType);
|
||||
for(i=0;i<m_EventType.GetCount();i++)
|
||||
{
|
||||
|
@ -352,9 +331,9 @@ void CTriggers::OnSelchangeEvent()
|
|||
if(tmp==EventType)
|
||||
m_EventType.SetCurSel(i);
|
||||
}
|
||||
m_E1.SetWindowText(GetParam(EventData,startpos+1));
|
||||
m_E1.SetWindowText(GetParam(eventData,startpos+1));
|
||||
|
||||
m_E2.SetWindowText(GetParam(EventData,startpos+2));
|
||||
m_E2.SetWindowText(GetParam(eventData,startpos+2));
|
||||
|
||||
OnEditchangeEventtype();
|
||||
}
|
||||
|
@ -373,8 +352,7 @@ void CTriggers::OnSelchangeAction()
|
|||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
CString ActionData;
|
||||
ActionData=ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger];
|
||||
auto const& ActionData=ini["Actions"][CurrentTrigger];
|
||||
|
||||
int startpos=1+selac*8;
|
||||
CString ActionType=GetParam(ActionData,startpos);
|
||||
|
@ -406,7 +384,9 @@ void CTriggers::OnEditchangeHouse()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
|
@ -417,7 +397,7 @@ void CTriggers::OnEditchangeHouse()
|
|||
|
||||
house=TranslateHouse(house);
|
||||
|
||||
ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger], 0, (LPCTSTR)house);
|
||||
ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 0, house));
|
||||
}
|
||||
|
||||
void CTriggers::OnSelchangeHouse()
|
||||
|
@ -442,14 +422,16 @@ void CTriggers::OnChangeName()
|
|||
|
||||
int esel=name.GetSel();
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger], 2, (LPCTSTR)m_Name);
|
||||
ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 2, m_Name));
|
||||
|
||||
UpdateDialog();
|
||||
|
||||
|
@ -465,15 +447,16 @@ void CTriggers::OnChangeFlag1()
|
|||
UpdateData();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger], 3, (LPCTSTR)m_F1);
|
||||
|
||||
ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 3, m_F1));
|
||||
}
|
||||
|
||||
void CTriggers::OnChangeFlag2()
|
||||
|
@ -483,14 +466,16 @@ void CTriggers::OnChangeFlag2()
|
|||
UpdateData();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger], 4, (LPCTSTR)m_F2);
|
||||
|
||||
ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 4, m_F2));
|
||||
|
||||
}
|
||||
|
||||
|
@ -501,14 +486,16 @@ void CTriggers::OnChangeFlag3()
|
|||
UpdateData();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger], 5, (LPCTSTR)m_F3);
|
||||
ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 5, m_F3));
|
||||
|
||||
|
||||
}
|
||||
|
@ -520,14 +507,16 @@ void CTriggers::OnChangeFlag4()
|
|||
UpdateData();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger], 6, (LPCTSTR)m_F4);
|
||||
ini.SetString("Triggers",CurrentTrigger,SetParam(ini["Triggers"][CurrentTrigger], 6, m_F4));
|
||||
|
||||
}
|
||||
|
||||
|
@ -538,14 +527,16 @@ void CTriggers::OnChangeFlag5()
|
|||
UpdateData();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
|
||||
ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger], 7, (LPCTSTR)m_F5);
|
||||
ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 7, m_F5));
|
||||
|
||||
}
|
||||
|
||||
|
@ -554,7 +545,9 @@ void CTriggers::OnEditchangeTrigger2()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
|
@ -564,7 +557,7 @@ void CTriggers::OnEditchangeTrigger2()
|
|||
m_Trigger2.GetWindowText(trg);
|
||||
TruncSpace(trg);
|
||||
|
||||
ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Triggers"].values[(LPCTSTR)CurrentTrigger], 1, (LPCTSTR)trg);
|
||||
ini.SetString("Triggers", CurrentTrigger, SetParam(ini["Triggers"][CurrentTrigger], 1, trg));
|
||||
}
|
||||
|
||||
void CTriggers::OnSelchangeTrigger2()
|
||||
|
@ -605,18 +598,19 @@ void CTriggers::OnEditchangeEventtype()
|
|||
|
||||
int pos=1+3*sel2;
|
||||
|
||||
ini.sections["Events"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Events"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)eventtype);
|
||||
|
||||
if(g_data.sections["Events"].FindName(eventtype)<0) return;
|
||||
ini.SetString("Events", CurrentTrigger, SetParam(ini["Events"][CurrentTrigger], pos, eventtype));
|
||||
|
||||
if (g_data["Events"].FindIndex(eventtype) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString ptype[2];
|
||||
ptype[0]=GetParam(g_data.sections["Events"].values[eventtype],1);
|
||||
ptype[1]=GetParam(g_data.sections["Events"].values[eventtype],2);
|
||||
ptype[0]=GetParam(g_data["Events"][eventtype],1);
|
||||
ptype[1]=GetParam(g_data["Events"][eventtype],2);
|
||||
|
||||
int pListType[2];
|
||||
pListType[0]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[0]], 1));
|
||||
pListType[1]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[1]], 1));
|
||||
pListType[0]=atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1));
|
||||
pListType[1]=atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1));
|
||||
|
||||
int i;
|
||||
for(i=0;i<2;i++)
|
||||
|
@ -641,7 +635,7 @@ void CTriggers::OnEditchangeEventtype()
|
|||
continue;
|
||||
}
|
||||
|
||||
*label=GetParam(g_data.sections["ParamTypes"].values[ptype[i]], 0);
|
||||
*label=GetParam(g_data["ParamTypes"][ptype[i]], 0);
|
||||
|
||||
|
||||
|
||||
|
@ -701,7 +695,7 @@ void CTriggers::OnEditchangeEventparam1()
|
|||
|
||||
int pos=1+3*sel2+1;
|
||||
|
||||
ini.sections["Events"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Events"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)param1);
|
||||
ini.SetString("Events", CurrentTrigger, SetParam(ini["Events"][CurrentTrigger], pos, param1));
|
||||
|
||||
}
|
||||
|
||||
|
@ -734,7 +728,7 @@ void CTriggers::OnEditchangeEventparam2()
|
|||
|
||||
int pos=1+3*sel2+2;
|
||||
|
||||
ini.sections["Events"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Events"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)param2);
|
||||
ini.SetString("Events", CurrentTrigger, SetParam(ini["Events"][CurrentTrigger], pos, param2));
|
||||
|
||||
}
|
||||
|
||||
|
@ -787,27 +781,30 @@ void CTriggers::OnEditchangeActiontype()
|
|||
|
||||
int pos=1+8*sel2;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)actiontype);
|
||||
ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, actiontype));
|
||||
|
||||
if(g_data.sections["Actions"].FindName(actiontype)<0) return;
|
||||
if (g_data["Actions"].FindIndex(actiontype) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CString ptype[6];
|
||||
ptype[0]=GetParam(g_data.sections["Actions"].values[actiontype],1);
|
||||
ptype[1]=GetParam(g_data.sections["Actions"].values[actiontype],2);
|
||||
ptype[2]=GetParam(g_data.sections["Actions"].values[actiontype],3);
|
||||
ptype[3]=GetParam(g_data.sections["Actions"].values[actiontype],4);
|
||||
ptype[4]=GetParam(g_data.sections["Actions"].values[actiontype],5);
|
||||
ptype[5]=GetParam(g_data.sections["Actions"].values[actiontype],6);
|
||||
ptype[0]=GetParam(g_data["Actions"][actiontype],1);
|
||||
ptype[1]=GetParam(g_data["Actions"][actiontype],2);
|
||||
ptype[2]=GetParam(g_data["Actions"][actiontype],3);
|
||||
ptype[3]=GetParam(g_data["Actions"][actiontype],4);
|
||||
ptype[4]=GetParam(g_data["Actions"][actiontype],5);
|
||||
ptype[5]=GetParam(g_data["Actions"][actiontype],6);
|
||||
|
||||
if(GetParam(g_data.sections["Actions"].values[actiontype],7)=="0")
|
||||
if (GetParam(g_data["Actions"][actiontype], 7) == "0") {
|
||||
m_LAW="Unused";
|
||||
else
|
||||
m_LAW="Waypoint:";
|
||||
} else {
|
||||
m_LAW = "Waypoint:";
|
||||
}
|
||||
|
||||
int pListType[6];
|
||||
pListType[0]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[0]], 1));
|
||||
pListType[1]=atoi(GetParam(g_data.sections["ParamTypes"].values[ptype[1]], 1));
|
||||
pListType[0]=atoi(GetParam(g_data["ParamTypes"][ptype[0]], 1));
|
||||
pListType[1]=atoi(GetParam(g_data["ParamTypes"][ptype[1]], 1));
|
||||
|
||||
|
||||
|
||||
|
@ -842,7 +839,7 @@ void CTriggers::OnEditchangeActiontype()
|
|||
continue;
|
||||
}
|
||||
|
||||
*label = GetParam(g_data.sections["ParamTypes"].values[ptype[i]], 0);
|
||||
*label = GetParam(g_data["ParamTypes"][ptype[i]], 0);
|
||||
|
||||
|
||||
|
||||
|
@ -1041,7 +1038,7 @@ void CTriggers::OnEditchangeActionwaypoint()
|
|||
|
||||
int pos=1+8*sel2+7;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)waypoint);
|
||||
ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, waypoint));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1059,9 +1056,13 @@ void CTriggers::OnEditchangeActionparam1()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
int sel2=m_Action.GetCurSel();
|
||||
if(sel2<0) return;
|
||||
if (sel2 < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CString CurrentTrigger;
|
||||
|
@ -1074,7 +1075,7 @@ void CTriggers::OnEditchangeActionparam1()
|
|||
|
||||
int pos=1+8*sel2+1;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)p1);
|
||||
ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p1));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1107,7 +1108,7 @@ void CTriggers::OnEditchangeActionparam2()
|
|||
|
||||
int pos=1+8*sel2+2;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)p2);
|
||||
ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p2));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1140,7 +1141,7 @@ void CTriggers::OnEditchangeActionparam3()
|
|||
|
||||
int pos=1+8*sel2+3;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)p3);
|
||||
ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p3));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1173,7 +1174,7 @@ void CTriggers::OnEditchangeActionparam4()
|
|||
|
||||
int pos=1+8*sel2+4;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)p4);
|
||||
ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p4));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1206,7 +1207,7 @@ void CTriggers::OnEditchangeActionparam5()
|
|||
|
||||
int pos=1+8*sel2+5;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)p5);
|
||||
ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p5));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1239,7 +1240,7 @@ void CTriggers::OnEditchangeActionparam6()
|
|||
|
||||
int pos=1+8*sel2+6;
|
||||
|
||||
ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger]=SetParam(ini.sections["Actions"].values[(LPCTSTR)CurrentTrigger], pos, (LPCTSTR)p6);
|
||||
ini.SetString("Actions", CurrentTrigger, SetParam(ini["Actions"][CurrentTrigger], pos, p6));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1264,16 +1265,14 @@ void CTriggers::OnAddevent()
|
|||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
CIniFileSection& sec=ini.sections["Events"];
|
||||
CIniFileSection& sec=ini.AddSection("Events");
|
||||
|
||||
int cval=atoi(GetParam(sec.values[(LPCTSTR)CurrentTrigger],0));
|
||||
int cval=atoi(GetParam(sec[CurrentTrigger],0));
|
||||
cval++;
|
||||
char c[50];
|
||||
itoa(cval,c,10);
|
||||
|
||||
sec.values[(LPCTSTR)CurrentTrigger]=SetParam(sec.values[(LPCTSTR)CurrentTrigger],0,c);
|
||||
sec.values[(LPCTSTR)CurrentTrigger]+=",13,0,0";
|
||||
|
||||
sec.SetString(CurrentTrigger, SetParam(sec[CurrentTrigger], 0, c) + ",13,0,0");
|
||||
|
||||
UpdateDialog();
|
||||
|
||||
|
@ -1284,49 +1283,53 @@ void CTriggers::OnAddevent()
|
|||
|
||||
}
|
||||
|
||||
void CTriggers::OnDeleteevent()
|
||||
void CTriggers::OnDeleteevent()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
int sel2=m_Event.GetCurSel();
|
||||
if(sel2<0) return;
|
||||
if(MessageBox("Do you really want to delete this event?","Delete event", MB_YESNO)==IDNO) return;
|
||||
int sel = m_Trigger.GetCurSel();
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
int sel2 = m_Event.GetCurSel();
|
||||
if (sel2 < 0) {
|
||||
return;
|
||||
}
|
||||
if (MessageBox("Do you really want to delete this event?", "Delete event", MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
CIniFileSection& sec=ini.sections["Events"];
|
||||
auto const& sec = ini["Events"];
|
||||
|
||||
CString data;
|
||||
data=sec.values[(LPCTSTR)CurrentTrigger];
|
||||
auto data = sec[CurrentTrigger];
|
||||
|
||||
int v=atoi(GetParam(data,0));
|
||||
int v = atoi(GetParam(data, 0));
|
||||
char c[50];
|
||||
v--;
|
||||
itoa(v,c,10);
|
||||
data=SetParam(data,0, c);
|
||||
itoa(v, c, 10);
|
||||
data = SetParam(data, 0, c);
|
||||
|
||||
int pos=1+sel2*3;
|
||||
int posc=1+v*3;
|
||||
int i;
|
||||
for(i=0;i<3;i++)
|
||||
data=SetParam(data,pos+i, GetParam(data,posc+i));
|
||||
int pos = 1 + sel2 * 3;
|
||||
int posc = 1 + v * 3;
|
||||
|
||||
char* cupos=(char*)(LPCTSTR)data;
|
||||
for(i=0;i<posc;i++)
|
||||
{
|
||||
cupos=strchr(cupos+1, ',');
|
||||
if(i==posc-1)
|
||||
{
|
||||
cupos[0]=0;
|
||||
for (auto i = 0; i < 3; i++) {
|
||||
data = SetParam(data, pos + i, GetParam(data, posc + i));
|
||||
}
|
||||
|
||||
LPCSTR cupos = data.operator LPCSTR();
|
||||
for (auto i = 0; i < posc; i++) {
|
||||
cupos = strchr(cupos + 1, ',');
|
||||
if (i == posc - 1) {
|
||||
data.SetAt(cupos - data.operator LPCSTR(), '\0');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sec.values[(LPCTSTR)CurrentTrigger]=data;
|
||||
ini.SetString("Events", CurrentTrigger, data);
|
||||
UpdateDialog();
|
||||
m_Trigger.SetCurSel(sel);
|
||||
OnSelchangeTrigger();
|
||||
|
@ -1337,23 +1340,23 @@ void CTriggers::OnAddaction()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
CIniFileSection& sec=ini.sections["Actions"];
|
||||
CIniFileSection& sec=ini.AddSection("Actions");
|
||||
|
||||
int cval=atoi(GetParam(sec.values[(LPCTSTR)CurrentTrigger],0));
|
||||
int cval=atoi(GetParam(sec[CurrentTrigger],0));
|
||||
cval++;
|
||||
char c[50];
|
||||
itoa(cval,c,10);
|
||||
|
||||
sec.values[(LPCTSTR)CurrentTrigger]=SetParam(sec.values[(LPCTSTR)CurrentTrigger],0,c);
|
||||
sec.values[(LPCTSTR)CurrentTrigger]+=",0,0,0,0,0,0,0,A";
|
||||
|
||||
sec.SetString(CurrentTrigger, SetParam(sec[CurrentTrigger], 0, c) + ",0,0,0,0,0,0,0,A");
|
||||
|
||||
UpdateDialog();
|
||||
|
||||
|
@ -1371,16 +1374,17 @@ void CTriggers::OnDeleteaction()
|
|||
if(sel<0) return;
|
||||
int sel2=m_Action.GetCurSel();
|
||||
if(sel2<0) return;
|
||||
if(MessageBox("Do you really want to delete this action?","Delete action", MB_YESNO)==IDNO) return;
|
||||
if (MessageBox("Do you really want to delete this action?", "Delete action", MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
CIniFileSection& sec=ini.sections["Actions"];
|
||||
auto const& sec = ini["Actions"];
|
||||
|
||||
CString data;
|
||||
data=sec.values[(LPCTSTR)CurrentTrigger];
|
||||
auto data = sec[CurrentTrigger];
|
||||
|
||||
int v=atoi(GetParam(data,0));
|
||||
char c[50];
|
||||
|
@ -1394,18 +1398,16 @@ void CTriggers::OnDeleteaction()
|
|||
for(i=0;i<3;i++)
|
||||
data=SetParam(data,pos+i, GetParam(data,posc+i));
|
||||
|
||||
char* cupos=(char*)(LPCTSTR)data;
|
||||
for(i=0;i<posc;i++)
|
||||
{
|
||||
cupos=strchr(cupos+1, ',');
|
||||
if(i==posc-1)
|
||||
{
|
||||
cupos[0]=0;
|
||||
LPCSTR cupos = data.operator LPCSTR();
|
||||
for (auto i = 0; i < posc; i++) {
|
||||
cupos = strchr(cupos + 1, ',');
|
||||
if (i == posc - 1) {
|
||||
data.SetAt(cupos - data.operator LPCSTR(), '\0');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sec.values[(LPCTSTR)CurrentTrigger]=data;
|
||||
ini.SetString("Actions", CurrentTrigger, data);
|
||||
UpdateDialog();
|
||||
|
||||
m_Trigger.SetCurSel(sel);
|
||||
|
@ -1418,41 +1420,43 @@ void CTriggers::OnDeletetrigger()
|
|||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
int sel=m_Trigger.GetCurSel();
|
||||
if(sel<0) return;
|
||||
if (sel < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(MessageBox("Do you really want to delete this trigger? Don´t forget to delete the attached tag (important!)","Delete trigger", MB_YESNO)==IDNO) return;
|
||||
if (MessageBox("Do you really want to delete this trigger? Don´t forget to delete the attached tag (important!)", "Delete trigger", MB_YESNO) == IDNO) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString CurrentTrigger;
|
||||
m_Trigger.GetLBText(sel, CurrentTrigger);
|
||||
TruncSpace(CurrentTrigger);
|
||||
|
||||
ini.sections["Triggers"].values.erase((LPCTSTR)CurrentTrigger);
|
||||
ini.sections["Events"].values.erase((LPCTSTR)CurrentTrigger);
|
||||
ini.sections["Actions"].values.erase((LPCTSTR)CurrentTrigger);
|
||||
ini.RemoveValueByKey( "Triggers",CurrentTrigger);
|
||||
ini.RemoveValueByKey( "Events",CurrentTrigger);
|
||||
ini.RemoveValueByKey( "Actions",CurrentTrigger);
|
||||
|
||||
//UpdateDialog();
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE);
|
||||
}
|
||||
|
||||
void CTriggers::OnAddtrigger()
|
||||
void CTriggers::OnAddtrigger()
|
||||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
CIniFile& ini = Map->GetIniFile();
|
||||
|
||||
CString ID_T=GetFreeID();
|
||||
ini.sections["Triggers"].values[ID_T]="GDI,<none>,New trigger,0,1,1,1,0";
|
||||
ini.sections["Events"].values[ID_T]="0";
|
||||
ini.sections["Actions"].values[ID_T]="0";
|
||||
CString newId = GetFreeID();
|
||||
ini.SetString("Triggers", newId, "GDI,<none>,New trigger,0,1,1,1,0");
|
||||
ini.SetString("Events", newId, "0");
|
||||
ini.SetString("Actions", newId, "0");
|
||||
|
||||
if(MessageBox("Trigger created. If you want to create a simple tag now, press Yes. The tag will be called ""New tag"", you should name it like the trigger (after you have set up the trigger).","Trigger created",MB_YESNO))
|
||||
{
|
||||
CString ID_TAG=GetFreeID();
|
||||
ini.sections["Tags"].values[ID_TAG]="0,New tag,";
|
||||
ini.sections["Tags"].values[ID_TAG]+=ID_T;
|
||||
if (MessageBox("Trigger created. If you want to create a simple tag now, press Yes. The tag will be called ""New tag"", you should name it like the trigger (after you have set up the trigger).", "Trigger created", MB_YESNO)) {
|
||||
CString newTagId = GetFreeID();
|
||||
ini.SetString("Tags", newTagId, "0,New tag," + newId);
|
||||
}
|
||||
|
||||
//UpdateDialog();
|
||||
((CFinalSunDlg*)theApp.m_pMainWnd)->UpdateDialogs(TRUE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -88,15 +88,15 @@ void CUnit::Init(CString house, CString strength, CString direction, CString act
|
|||
{
|
||||
CIniFile& ini=Map->GetIniFile();
|
||||
|
||||
if(house=="")
|
||||
{
|
||||
m_house=*rules.sections["Houses"].GetValue(0);
|
||||
if(ini.sections.find("Houses")!=ini.sections.end())
|
||||
if(ini.sections["Houses"].values.size()>0)
|
||||
m_house=TranslateHouse(*ini.sections["Houses"].GetValue(0), TRUE);
|
||||
if (house.IsEmpty()) {
|
||||
auto const& houseSec = rules["Houses"];
|
||||
m_house = houseSec.Nth(0).second;
|
||||
if (houseSec.Size() > 0) {
|
||||
m_house = TranslateHouse(m_house, TRUE);
|
||||
}
|
||||
} else {
|
||||
m_house = TranslateHouse(house, TRUE);
|
||||
}
|
||||
else
|
||||
m_house=TranslateHouse(house, TRUE);
|
||||
|
||||
m_flag1=flag1;
|
||||
m_flag2=flag2;
|
||||
|
|
|
@ -1148,21 +1148,21 @@ void CUserScriptsDlg::OnOK()
|
|||
variables[params[0]]=ID_T;
|
||||
}
|
||||
|
||||
ini.sections["Triggers"].values[ID_T]=params[1];
|
||||
ini.sections["Events"].values[ID_T]=params[2];
|
||||
ini.sections["Actions"].values[ID_T]=params[3];
|
||||
ini.SetString("Triggers", ID_T, params[1]);
|
||||
ini.SetString("Events", ID_T, params[2]);
|
||||
ini.SetString("Actions", ID_T, params[3]);
|
||||
|
||||
BOOL tag=TRUE;
|
||||
params[4].MakeLower();
|
||||
if(params[4]=="false" || params[4]=="no") tag=FALSE;
|
||||
|
||||
if(tag)
|
||||
{
|
||||
CString ID_TAG=GetFreeID();
|
||||
ini.sections["Tags"].values[ID_TAG]="0,";
|
||||
ini.sections["Tags"].values[ID_TAG]+=GetParam(params[1],2);
|
||||
ini.sections["Tags"].values[ID_TAG]+=",";
|
||||
ini.sections["Tags"].values[ID_TAG]+=ID_T;
|
||||
if(tag) {
|
||||
auto const ID_TAG=GetFreeID();
|
||||
CString def = "0,";
|
||||
def += GetParam(params[1], 2);;
|
||||
def += ",";
|
||||
def += ID_T;
|
||||
ini.SetString("Tags", ID_TAG, def);
|
||||
}
|
||||
|
||||
report+="Trigger " + GetParam(params[1],2) + " added\r\n";
|
||||
|
@ -1187,12 +1187,12 @@ void CUserScriptsDlg::OnOK()
|
|||
}
|
||||
}
|
||||
|
||||
//if(ini.sections[params[0]].FindName(params[1])>=0)
|
||||
//if(ini.sections[params[0]].FindIndex(params[1])>=0)
|
||||
{
|
||||
if(bSafeMode) goto nextline;
|
||||
}
|
||||
|
||||
ini.sections[params[0]].values[params[1]]=params[2];
|
||||
ini.SetString(params[0], params[1], params[2]);
|
||||
|
||||
report +=params[0]+(CString)"->"+params[1]+(CString) " set to \"" + params[2] + "\"\r\n";
|
||||
|
||||
|
@ -1217,12 +1217,11 @@ void CUserScriptsDlg::OnOK()
|
|||
}
|
||||
}
|
||||
|
||||
if(ini.sections.find(params[1])==ini.sections.end() || ini.sections[params[1]].FindName(params[2])<0)
|
||||
{
|
||||
variables[params[0]]="";
|
||||
if (ini[params[1]].FindIndex(params[2]) < 0) {
|
||||
variables[params[0]] = "";
|
||||
} else {
|
||||
variables[params[0]] = ini.GetString(params[1], params[2]);
|
||||
}
|
||||
else
|
||||
variables[params[0]]=ini.sections[params[1]].values[params[2]];
|
||||
}
|
||||
else if(name==ID_SET_SAFE_MODE)
|
||||
{
|
||||
|
@ -1667,7 +1666,7 @@ void CUserScriptsDlg::OnOK()
|
|||
|
||||
if(bSafeMode && n>=0)
|
||||
{
|
||||
if(ini.sections["Waypoints"].FindName(id)>=0)
|
||||
if(ini["Waypoints"].FindIndex(id)>=0)
|
||||
{
|
||||
goto nextline;
|
||||
}
|
||||
|
@ -1753,7 +1752,7 @@ void CUserScriptsDlg::OnOK()
|
|||
variables[params[0]]=ID_T;
|
||||
}
|
||||
|
||||
ini.sections["AITriggerTypes"].values[ID_T]=params[1];
|
||||
ini.SetString("AITriggerTypes", ID_T, params[1]);
|
||||
|
||||
report+="AI Trigger " + GetParam(params[1],0) + " added\r\n";
|
||||
|
||||
|
@ -1787,7 +1786,7 @@ void CUserScriptsDlg::OnOK()
|
|||
}
|
||||
|
||||
CString ID_TAG=ID_T; //GetFreeID();
|
||||
ini.sections["Tags"].values[ID_TAG]=params[1];
|
||||
ini.SetString("Tags", ID_TAG, params[1]);
|
||||
|
||||
report+="Tag " + GetParam(params[1],1) + " added\r\n";
|
||||
|
||||
|
@ -2649,7 +2648,7 @@ void CUserScriptsDlg::OnOK()
|
|||
goto nextline;
|
||||
}
|
||||
|
||||
lastStructureDeleted=*ini.sections["Structures"].GetValueName(index);
|
||||
lastStructureDeleted = ini["Structures"].Nth(index).first;
|
||||
Map->DeleteStructure(index);
|
||||
|
||||
report+="Structure deleted\r\n";
|
||||
|
@ -2684,7 +2683,7 @@ void CUserScriptsDlg::OnOK()
|
|||
goto nextline;
|
||||
}
|
||||
|
||||
lastUnitDeleted=*ini.sections["Units"].GetValueName(index);
|
||||
lastUnitDeleted = ini["Units"].Nth(index).first;
|
||||
Map->DeleteUnit(index);
|
||||
|
||||
report+="Vehicle deleted\r\n";
|
||||
|
@ -2720,7 +2719,7 @@ void CUserScriptsDlg::OnOK()
|
|||
goto nextline;
|
||||
}
|
||||
|
||||
lastAircraftDeleted=*ini.sections["Aircraft"].GetValueName(index);
|
||||
lastAircraftDeleted = ini["Aircraft"].Nth(index).first;
|
||||
Map->DeleteAircraft(index);
|
||||
|
||||
report+="Aircraft deleted\r\n";
|
||||
|
@ -3099,9 +3098,8 @@ void CUserScriptsDlg::OnOK()
|
|||
|
||||
int index=atoi(params[1]);
|
||||
CString s;
|
||||
if(index>=0 && index<Map->GetAircraftCount())
|
||||
{
|
||||
s=*ini.sections["Aircraft"].GetValue(index);
|
||||
if (index >= 0 && index < Map->GetAircraftCount()) {
|
||||
s = ini["Aircraft"].Nth(index).second;
|
||||
}
|
||||
|
||||
variables[params[0]]=s;
|
||||
|
@ -3126,9 +3124,8 @@ void CUserScriptsDlg::OnOK()
|
|||
|
||||
int index=atoi(params[1]);
|
||||
CString s;
|
||||
if(index>=0 && index<Map->GetStructureCount())
|
||||
{
|
||||
s=*ini.sections["Structures"].GetValue(index);
|
||||
if (index >= 0 && index < Map->GetStructureCount()) {
|
||||
s = ini["Structures"].Nth(index).second;
|
||||
}
|
||||
|
||||
variables[params[0]]=s;
|
||||
|
@ -3153,9 +3150,8 @@ void CUserScriptsDlg::OnOK()
|
|||
|
||||
int index=atoi(params[1]);
|
||||
CString s;
|
||||
if(index>=0 && index<Map->GetUnitCount())
|
||||
{
|
||||
s=*ini.sections["Units"].GetValue(index);
|
||||
if (index >= 0 && index < Map->GetUnitCount()) {
|
||||
s = ini["Units"].Nth(index).second;
|
||||
}
|
||||
|
||||
variables[params[0]]=s;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -28,7 +28,39 @@
|
|||
//
|
||||
#include <afxcview.h>
|
||||
|
||||
#define MAKE_MASK(refVal) 1 << static_cast<int>(refVal)
|
||||
|
||||
enum class TreeViewTechnoType {
|
||||
Set_None = -1,
|
||||
Building = 0,
|
||||
Infantry,
|
||||
Vehicle,
|
||||
Aircraft,
|
||||
_Last,
|
||||
_First = 0,
|
||||
Count = _Last,
|
||||
};
|
||||
|
||||
enum class TechnoTypeMask
|
||||
{
|
||||
ForBuilding = MAKE_MASK(TreeViewTechnoType::Building),
|
||||
ForInfantry = MAKE_MASK(TreeViewTechnoType::Infantry),
|
||||
ForVehicle = MAKE_MASK(TreeViewTechnoType::Vehicle),
|
||||
ForAircraft = MAKE_MASK(TreeViewTechnoType::Aircraft),
|
||||
};
|
||||
|
||||
inline bool operator&(TechnoTypeMask lhs, TechnoTypeMask rhs)
|
||||
{
|
||||
return static_cast<int>(lhs) & static_cast<int>(rhs);
|
||||
}
|
||||
inline bool operator&(TechnoTypeMask lhs, TreeViewTechnoType rhs)
|
||||
{
|
||||
return lhs & static_cast<TechnoTypeMask>(MAKE_MASK(rhs));
|
||||
}
|
||||
inline bool operator&(TreeViewTechnoType lhs, TechnoTypeMask rhs)
|
||||
{
|
||||
return rhs & static_cast<TechnoTypeMask>(MAKE_MASK(lhs));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Ansicht CViewObjects
|
||||
|
|
|
@ -71,13 +71,12 @@ void CWaypointID::OnFree()
|
|||
int i;
|
||||
CString freen;
|
||||
|
||||
for(i=0;i>-1;i++)
|
||||
for (i = 0; i > -1; i++)
|
||||
{
|
||||
char d[50];
|
||||
itoa(i,d,10);
|
||||
if(ini.sections["Waypoints"].values.find(d)==ini.sections["Waypoints"].values.end())
|
||||
{
|
||||
freen=d;
|
||||
itoa(i, d, 10);
|
||||
if (ini.GetString("Waypoints", d).IsEmpty()) {
|
||||
freen = d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -42,7 +42,7 @@ CString TranslateHouse(CString original, BOOL bToUI=FALSE);
|
|||
void ShowOptionsDialog();
|
||||
|
||||
// repairs a trigger (sets flags correctly)
|
||||
void RepairTrigger(CString& triggerdata);
|
||||
bool RepairTrigger(CString& triggerdata);
|
||||
|
||||
// coordinate functions
|
||||
void PosToXY(const char* pos, int* X, int* Y);
|
||||
|
@ -84,7 +84,7 @@ void ListWaypoints(CComboBox &cb);
|
|||
void ListTargets(CComboBox& cb);
|
||||
void ListTags(CComboBox& cb, BOOL bListNone);
|
||||
void ListMovies(CComboBox& cb, BOOL bListNone, BOOL bListParam=FALSE);
|
||||
void ListBuildings(CComboBox& cb, BOOL bININame=FALSE);
|
||||
void ListBuildings(CComboBox& cb, bool useIniName = false);
|
||||
void ListUnits(CComboBox& cb);
|
||||
void ListAircraft(CComboBox& cb);
|
||||
void ListInfantry(CComboBox& cb);
|
||||
|
|
|
@ -54,28 +54,28 @@ inline CString GetUnitPictureFilename(LPCTSTR lpUnitName, DWORD dwPicIndex)
|
|||
|
||||
CString UnitName = lpUnitName;
|
||||
|
||||
UnitName = rules.sections[lpUnitName].GetValueByName("Image", lpUnitName);
|
||||
|
||||
if (ini.sections.find(lpUnitName) != ini.sections.end())
|
||||
UnitName = ini.sections[lpUnitName].GetValueByName("Image", UnitName);
|
||||
|
||||
if (rules.sections[lpUnitName].values.find("Image") != rules.sections[lpUnitName].values.end())
|
||||
UnitName = rules.sections[lpUnitName].values["Image"];
|
||||
UnitName = ini.GetString(lpUnitName, "Image");
|
||||
if (UnitName.IsEmpty()) {
|
||||
UnitName = rules.GetString(lpUnitName, "Image");
|
||||
}
|
||||
|
||||
CString artname = UnitName;
|
||||
|
||||
if (art.sections[UnitName].values.find("Image") != art.sections[UnitName].values.end())
|
||||
{
|
||||
if (!isTrue(g_data.sections["IgnoreArtImage"].AccessValueByName(UnitName)))
|
||||
artname = art.sections[UnitName].AccessValueByName("Image");
|
||||
if (UnitName.IsEmpty()) {
|
||||
artname = lpUnitName;
|
||||
}
|
||||
auto const shapeName = art.GetString(UnitName, "Image");
|
||||
|
||||
if (!shapeName.IsEmpty()) {
|
||||
if (!g_data.GetBool("IgnoreArtImage", UnitName)) {
|
||||
artname = shapeName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CString filename = UnitName;
|
||||
|
||||
if (art.sections[UnitName].FindName("NewTheater") >= 0 && art.sections[UnitName].AccessValueByName("DemandLoad") != "yes")
|
||||
if (art.sections[UnitName].AccessValueByName("NewTheater") == "yes")
|
||||
filename.SetAt(1, 'T');
|
||||
if (art.GetBool(UnitName, "NewTheater") && !art.GetBool(UnitName, "DemandLoad")) {
|
||||
filename.SetAt(1, 'T');
|
||||
}
|
||||
|
||||
char n[50];
|
||||
itoa(dwPicIndex, n, 10);
|
||||
|
|
|
@ -190,8 +190,8 @@ CFinalSunApp theApp;
|
|||
|
||||
CString currentOwner="Neutral";
|
||||
|
||||
map<CString, XCString> CCStrings;
|
||||
map<CString, XCString> AllStrings;
|
||||
TranslationMap CCStrings;
|
||||
TranslationMap AllStrings;
|
||||
|
||||
// tilesets
|
||||
int cliffset;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "FinalSun.h"
|
||||
#include "MapData.h"
|
||||
|
||||
using TranslationMap = map<CString, XCString>;
|
||||
|
||||
// the map
|
||||
extern CMapData* Map;
|
||||
|
||||
|
@ -132,7 +134,7 @@ extern BOOL yr_only[];
|
|||
|
||||
|
||||
extern CString currentOwner;
|
||||
extern map<CString, XCString> CCStrings;
|
||||
extern TranslationMap CCStrings;
|
||||
|
||||
// tileset ids
|
||||
extern int cliffset;
|
||||
|
|
|
@ -115,12 +115,13 @@ namespace FSunPackLib
|
|||
std::wstring utf8ToUtf16(const std::string& utf8)
|
||||
{
|
||||
// wstring_convert and codecvt_utf8_utf16 are deprecated in C++17, fallback to Win32
|
||||
if (utf8.size() == 0)
|
||||
auto utf8Count = static_cast<int>(utf8.size());
|
||||
if (utf8Count == 0) {
|
||||
// MultiByteToWideChar does not support passing in cbMultiByte == 0
|
||||
return L"";
|
||||
}
|
||||
|
||||
// unterminatedCountWChars will be the count of WChars NOT including the terminating zero (due to passing in utf8.size() instead of -1)
|
||||
auto utf8Count = utf8.size();
|
||||
auto unterminatedCountWChars = MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, utf8.data(), utf8Count, nullptr, 0);
|
||||
if (unterminatedCountWChars == 0)
|
||||
{
|
||||
|
@ -287,7 +288,7 @@ namespace FSunPackLib
|
|||
return true;
|
||||
}
|
||||
|
||||
int DecodeBase64(const char* sp, std::vector<BYTE>& dest)
|
||||
size_t DecodeBase64(const char* sp, std::vector<BYTE>& dest)
|
||||
{
|
||||
auto len = strlen(reinterpret_cast<const char*>(sp));
|
||||
auto res = decode64(data_ref(sp, len));
|
||||
|
@ -1765,7 +1766,7 @@ namespace FSunPackLib
|
|||
Vec3f secMinVec, secMaxVec;
|
||||
GetVXLSectionBounds(i, rotation, postHVAOffset, secMinVec, secMaxVec);
|
||||
auto extent = secMaxVec - secMinVec;
|
||||
auto volume = extent.x() * extent.y() * extent.z();
|
||||
auto volume = static_cast<int>(extent.x() * extent.y() * extent.z());
|
||||
if (volume >= iLargestVolume)
|
||||
{
|
||||
iLargestVolume = volume;
|
||||
|
@ -1785,8 +1786,8 @@ namespace FSunPackLib
|
|||
|
||||
|
||||
const auto extents = (maxCoords - minCoords);
|
||||
int rtWidth = ceil(extents.x());
|
||||
int rtHeight = ceil(extents.y());
|
||||
int rtWidth = static_cast<int>(ceil(extents.x()));
|
||||
int rtHeight = static_cast<int>(ceil(extents.y()));
|
||||
const int c_pixels = rtWidth * rtHeight;
|
||||
|
||||
// MYASSERT(c_pixels,1);
|
||||
|
@ -2000,7 +2001,7 @@ namespace FSunPackLib
|
|||
Vec3f secMinVec, secMaxVec;
|
||||
GetVXLSectionBounds(i, rotation, modelOffset, secMinVec, secMaxVec);
|
||||
auto extent = secMaxVec - secMinVec;
|
||||
auto volume = extent.x() * extent.y() * extent.z();
|
||||
auto volume = static_cast<int>(extent.x() * extent.y() * extent.z());
|
||||
if (volume >= iLargestVolume)
|
||||
{
|
||||
iLargestVolume = volume;
|
||||
|
@ -2021,8 +2022,8 @@ namespace FSunPackLib
|
|||
|
||||
|
||||
const auto extents = (maxCoords - minCoords);
|
||||
int rtWidth = ceil(extents.x()) + 1;
|
||||
int rtHeight = ceil(extents.y()) + 1;
|
||||
int rtWidth = static_cast<int>(ceil(extents.x()) + 1);
|
||||
int rtHeight = static_cast<int>(ceil(extents.y()) + 1);
|
||||
const int c_pixels = rtWidth * rtHeight;
|
||||
|
||||
MYASSERT(c_pixels, 1);
|
||||
|
|
|
@ -109,7 +109,7 @@ sp - source poINTer
|
|||
dp - dest buffer (should be as large as sp)
|
||||
Returns the hex data length
|
||||
*/
|
||||
int DecodeBase64(const char* sp, std::vector<BYTE>& dest);
|
||||
size_t DecodeBase64(const char* sp, std::vector<BYTE>& dest);
|
||||
|
||||
|
||||
// format 80
|
||||
|
|
|
@ -5,10 +5,18 @@
|
|||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
|
@ -25,12 +33,24 @@
|
|||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
|
@ -38,22 +58,41 @@
|
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)d</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)\build\output\$(Configuration)-$(Platform)\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)\build\intermediate\$(Configuration)-$(Platform)\$(ProjectName)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)d</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
@ -86,6 +125,38 @@
|
|||
<ModuleDefinitionFile>.\MissionEditorPackLib.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>..\3rdParty\xcc\misc;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;EF;WIN32;_LIB;NO_XIF_SUPPORT;NO_FT_SUPPORT;NO_AVI_SUPPORT;XCC_MINIMAL_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>.\Release\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\Release\MissionEditorPackLib.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\Release\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0407</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Release\MissionEditorPackLib.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>.\MissionEditorPackLib.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
|
@ -118,6 +189,38 @@
|
|||
<ModuleDefinitionFile>.\MissionEditorPackLib.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>..\3rdParty\xcc\misc;.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
|
||||
<PrecompiledHeaderOutputFile>.\Debug\MissionEditorPackLib.pch</PrecompiledHeaderOutputFile>
|
||||
<ObjectFileName>.\Debug\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<PreprocessorDefinitions>_DEBUG;WIN32;_LIB;NO_XIF_SUPPORT;NO_FT_SUPPORT;NO_AVI_SUPPORT;XCC_MINIMAL_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0407</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Bscmake>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<OutputFile>.\Debug\MissionEditorPackLib.bsc</OutputFile>
|
||||
</Bscmake>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>.\MissionEditorPackLib.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="VoxelNormals.cpp" />
|
||||
<ClCompile Include="MissionEditorPackLib.cpp" />
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
inline T length() const
|
||||
{
|
||||
return sqrt(squaredLength());
|
||||
return static_cast<T>(sqrt(squaredLength()));
|
||||
}
|
||||
|
||||
inline T squaredLength() const
|
||||
|
|
240
UnitTest/CIni_Test.cpp
Normal file
240
UnitTest/CIni_Test.cpp
Normal file
|
@ -0,0 +1,240 @@
|
|||
#include "stdafx.h"
|
||||
#include "../MissionEditor/IniFile.h"
|
||||
|
||||
class IniTestHelper
|
||||
{
|
||||
std::string m_fileName;
|
||||
|
||||
void writeDownContent(const char* pContent) {
|
||||
std::ofstream iniFile(m_fileName.c_str());
|
||||
ASSERT(iniFile.is_open() == true);
|
||||
iniFile << pContent;
|
||||
iniFile.flush();
|
||||
iniFile.close();
|
||||
}
|
||||
|
||||
public :
|
||||
IniTestHelper(std::string&& name, const char* pContent) :
|
||||
m_fileName(std::move(name))
|
||||
{
|
||||
ASSERT(!m_fileName.empty());
|
||||
ASSERT(pContent != nullptr);
|
||||
writeDownContent(pContent);
|
||||
}
|
||||
~IniTestHelper() {
|
||||
remove(m_fileName.c_str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
TEST(CIniFileClass, LoadFileTest) {
|
||||
auto const fileName = "test.ini";
|
||||
IniTestHelper helper(fileName, R"(
|
||||
[Debug]
|
||||
;DisplayAllOverlay=Yes ; Doesn´t cripple the overlay list in any way
|
||||
;EnableTrackLogic=Yes ; Enables Track Logic
|
||||
;IgnoreSHPImageHeadUnused=Yes ; Use this *carefully* to make SHP graphics of some mods work that incorrectly have the shadow flag set
|
||||
AllowTunnels=yes
|
||||
AllowUnidirectionalTunnels=yes
|
||||
|
||||
[BuildingVoxelTurretsRA2OLD]
|
||||
GTGCANX=00
|
||||
GTGCANY=44;-6
|
||||
)");
|
||||
|
||||
|
||||
CIniFile file;
|
||||
ASSERT_EQ(file.LoadFile(std::string(fileName)), 0);
|
||||
|
||||
EXPECT_NE(file.Size(), 0);
|
||||
EXPECT_EQ(true, file.GetBool("Debug", "AllowTunnels"));
|
||||
EXPECT_EQ(false, file.GetBool("Debug", "DisplayAllOverlay"));
|
||||
EXPECT_EQ("00", file.GetString("BuildingVoxelTurretsRA2OLD", "GTGCANX"));
|
||||
}
|
||||
|
||||
|
||||
TEST(CIniFileClass, IniSequenceTest) {
|
||||
auto const fileName = "test.ini";
|
||||
IniTestHelper helper(fileName, R"(
|
||||
[SlopeSetPiecesDirections]
|
||||
Count=10
|
||||
0=Right_1
|
||||
1=Left_1
|
||||
2=Top_1
|
||||
3=Bottom_1
|
||||
4=Right_2
|
||||
5=Left_2
|
||||
6=Left_2
|
||||
7=Bottom_2
|
||||
8=Top_2
|
||||
9=Top_2
|
||||
)");
|
||||
|
||||
CIniFile file;
|
||||
ASSERT_EQ(file.LoadFile(std::string(fileName)), 0);
|
||||
EXPECT_EQ(11, file["SlopeSetPiecesDirections"].Size());
|
||||
EXPECT_EQ("10", file["SlopeSetPiecesDirections"].Nth(0).second);
|
||||
|
||||
}
|
||||
|
||||
TEST(CIniFileClass, IniSetValueTest) {
|
||||
auto const fileName = "test.ini";
|
||||
IniTestHelper helper(fileName, R"(
|
||||
[Debug]
|
||||
;DisplayAllOverlay=Yes ; Doesn´t cripple the overlay list in any way
|
||||
;EnableTrackLogic=Yes ; Enables Track Logic
|
||||
;IgnoreSHPImageHeadUnused=Yes ; Use this *carefully* to make SHP graphics of some mods work that incorrectly have the shadow flag set
|
||||
AllowTunnels=yes
|
||||
AllowUnidirectionalTunnels=yes
|
||||
)");
|
||||
|
||||
CIniFile file;
|
||||
ASSERT_EQ(file.LoadFile(std::string(fileName)), 0);
|
||||
// Test value not exists
|
||||
EXPECT_EQ(false, file.GetBool("Debug", "DisplayAllOverlay"));
|
||||
file.SetBool("Debug", "DisplayAllOverlay", true);
|
||||
EXPECT_EQ(true, file.GetBool("Debug", "DisplayAllOverlay"));
|
||||
// Test existed value and override
|
||||
EXPECT_EQ(true, file.GetBool("Debug", "AllowTunnels"));
|
||||
file.SetBool("Debug", "AllowTunnels", false);
|
||||
EXPECT_EQ(false, file.GetBool("Debug", "AllowTunnels"));
|
||||
// Test section not exists
|
||||
EXPECT_EQ("", file.GetString("SlopeSetPiecesDirections", "0"));
|
||||
file.SetString("SlopeSetPiecesDirections", "0", "Right_1");
|
||||
EXPECT_EQ("Right_1", file.GetString("SlopeSetPiecesDirections", "0"));
|
||||
}
|
||||
|
||||
TEST(CIniFileClass, IniSetSectionTest) {
|
||||
auto const fileName = "test.ini";
|
||||
IniTestHelper helper(fileName, R"(
|
||||
[SlopeSetPiecesDirections]
|
||||
Count=10
|
||||
0=Right_1
|
||||
1=Left_1
|
||||
2=Top_1
|
||||
3=Bottom_1
|
||||
4=Right_2
|
||||
5=Left_2
|
||||
6=Left_2
|
||||
7=Bottom_2
|
||||
8=Top_2
|
||||
9=Top_2
|
||||
)");
|
||||
|
||||
CIniFile file;
|
||||
ASSERT_EQ(file.LoadFile(std::string(fileName)), 0);
|
||||
|
||||
CIniFile anotherIni;
|
||||
anotherIni.AddSection("Debug");
|
||||
auto pDebugSecAnother = anotherIni.TryGetSection("Debug");
|
||||
ASSERT_NE(pDebugSecAnother, nullptr);
|
||||
pDebugSecAnother->SetBool("DisplayAllOverlay", false);
|
||||
pDebugSecAnother->SetBool("AllowTunnels", true);
|
||||
|
||||
|
||||
file.SetSection("Debug", anotherIni["Debug"]);
|
||||
EXPECT_EQ(true, file.GetBool("Debug", "AllowTunnels"));
|
||||
EXPECT_EQ(false, file.GetBool("Debug", "DisplayAllOverlay"));
|
||||
}
|
||||
|
||||
TEST(CIniFileClass, IniAddSectionTest) {
|
||||
auto const fileName = "test.ini";
|
||||
IniTestHelper helper(fileName, R"(
|
||||
[SlopeSetPiecesDirections]
|
||||
Count=10
|
||||
0=Right_1
|
||||
1=Left_1
|
||||
2=Top_1
|
||||
3=Bottom_1
|
||||
4=Right_2
|
||||
5=Left_2
|
||||
6=Left_2
|
||||
7=Bottom_2
|
||||
8=Top_2
|
||||
9=Top_2
|
||||
)");
|
||||
|
||||
CIniFile file;
|
||||
ASSERT_EQ(file.LoadFile(std::string(fileName)), 0);
|
||||
file.AddSection("Debug");
|
||||
auto pDebugSec = file.TryGetSection("Debug");
|
||||
ASSERT_NE(pDebugSec, nullptr);
|
||||
pDebugSec->SetBool("DisplayAllOverlay", false);
|
||||
pDebugSec->SetBool("AllowTunnels", true);
|
||||
EXPECT_EQ(true, file.GetBool("Debug", "AllowTunnels"));
|
||||
EXPECT_EQ(false, file.GetBool("Debug", "DisplayAllOverlay"));
|
||||
}
|
||||
|
||||
TEST(CIniFileClass, IniDeleteSectionTest) {
|
||||
auto const fileName = "test.ini";
|
||||
IniTestHelper helper(fileName, R"(
|
||||
[LUNARLimits]
|
||||
TreeMax=999
|
||||
TreeMin=999
|
||||
|
||||
[URBANLimits]
|
||||
TreeMax=999
|
||||
;TreeMax=27
|
||||
|
||||
[TEMPERATELimits]
|
||||
TreeMax=999
|
||||
;TreeMax=27
|
||||
|
||||
[SNOWLimits]
|
||||
TreeMax=999
|
||||
;TreeMax=27
|
||||
|
||||
[NEWURBANLimits]
|
||||
TreeMax=999
|
||||
;TreeMax=27
|
||||
|
||||
[DESERTLimits]
|
||||
TreeMin=30
|
||||
TreeMax=999
|
||||
)");
|
||||
|
||||
CIniFile file;
|
||||
ASSERT_EQ(file.LoadFile(std::string(fileName)), 0);
|
||||
|
||||
EXPECT_EQ(999, file.GetInteger("SNOWLimits", "TreeMax"));
|
||||
EXPECT_EQ(999, file.GetInteger("LUNARLimits", "TreeMin"));
|
||||
|
||||
EXPECT_EQ(6, file.Size());
|
||||
file.DeleteSection("SNOWLimits");
|
||||
|
||||
EXPECT_EQ(0, file.GetInteger("SNOWLimits", "TreeMax"));
|
||||
EXPECT_EQ(nullptr, file.TryGetSection("SNOWLimits"));
|
||||
EXPECT_EQ(5, file.Size());
|
||||
}
|
||||
|
||||
TEST(CIniFileClass, IniDeleteValueTest) {
|
||||
auto const fileName = "test.ini";
|
||||
IniTestHelper helper(fileName, R"(
|
||||
[LUNARLimits]
|
||||
TreeMax=999
|
||||
TreeMin=999
|
||||
|
||||
[NewUrbanInfo]
|
||||
Morphable2=114
|
||||
Ramps2=117
|
||||
Cliffs2=110
|
||||
CliffsWater2=112
|
||||
|
||||
; tileset ini overwritings
|
||||
; only used by FinalAlert
|
||||
[IgnoreSetTEMPERATE]
|
||||
0=77
|
||||
1=78
|
||||
2=79
|
||||
)");
|
||||
|
||||
CIniFile file;
|
||||
ASSERT_EQ(file.LoadFile(std::string(fileName)), 0);
|
||||
|
||||
EXPECT_EQ(114, file.GetInteger("NewUrbanInfo", "Morphable2"));
|
||||
file.RemoveValueByKey("NewUrbanInfo", "Morphable2");
|
||||
|
||||
EXPECT_EQ(0, file.GetInteger("NewUrbanInfo", "Morphable2"));
|
||||
EXPECT_EQ(false, file["NewUrbanInfo"].Exists("Morphable2"));
|
||||
|
||||
}
|
32
UnitTest/StdAfx.h
Normal file
32
UnitTest/StdAfx.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
FinalSun/FinalAlert 2 Mission Editor
|
||||
|
||||
Copyright (C) 1999-2024 Electronic Arts, Inc.
|
||||
Authored by Matthias Wagner
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// stdafx.h : include everything that should be available everywhere in the code
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <iostream>
|
||||
#include <afxwin.h>
|
||||
|
||||
#if !defined(ASSERT)
|
||||
#define ASSERT(x) if (!(x)) throw("assertion failed");
|
||||
#endif
|
2
UnitTest/UnitTest.cpp
Normal file
2
UnitTest/UnitTest.cpp
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "stdafx.h"
|
||||
|
146
UnitTest/UnitTest.vcxproj
Normal file
146
UnitTest/UnitTest.vcxproj
Normal file
|
@ -0,0 +1,146 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{75e18879-7564-4a2c-8c00-393a5a17171f}</ProjectGuid>
|
||||
<RootNamespace>UnitTest</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_AFXDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)googletest\x64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>$(SolutionDir)googletest\x64\lib\$(Configuration)\*.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\MissionEditor\IniFile.cpp" />
|
||||
<ClCompile Include="CIni_Test.cpp" />
|
||||
<ClCompile Include="UnitTest.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\MissionEditor\IniFile.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
36
UnitTest/UnitTest.vcxproj.filters
Normal file
36
UnitTest/UnitTest.vcxproj.filters
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="UnitTest.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CIni_Test.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\MissionEditor\IniFile.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\MissionEditor\IniFile.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
1
googletest
Submodule
1
googletest
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit b0865c2800b6d2eda4d27b2ade82ee8302c788ea
|
Loading…
Add table
Reference in a new issue