2020-09-11 23:46:04 +03:00
//
// Copyright 2020 Electronic Arts Inc.
//
2023-06-09 11:44:39 +02:00
// The Command & Conquer Map Editor and corresponding source code 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,
2020-09-11 23:46:04 +03:00
// either version 3 of the License, or (at your option) any later version.
2023-06-09 11:44:39 +02:00
// The Command & Conquer Map Editor and corresponding source code is distributed
// in the hope that it will be useful, but with permitted additional restrictions
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
// distributed with this program. You should have received a copy of the
// GNU General Public License along with permitted additional restrictions
2020-09-11 23:46:04 +03:00
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
using MobiusEditor.Model ;
using System ;
using System.Collections.Generic ;
using System.Drawing ;
namespace MobiusEditor.Interface
{
public enum FileType
{
None ,
INI ,
BIN ,
MEG ,
PGM
}
public enum GameType
{
None ,
TiberianDawn ,
2022-09-20 18:40:27 +02:00
RedAlert ,
SoleSurvivor
2020-09-11 23:46:04 +03:00
}
public interface IGamePlugin : IDisposable
{
2023-05-31 17:45:31 +02:00
/// <summary>Name of the game.</summary>
2022-09-25 12:11:59 +02:00
string Name { get ; }
2023-05-31 17:45:31 +02:00
/// <summary>The game type as enum.</summary>
2020-09-11 23:46:04 +03:00
GameType GameType { get ; }
2022-09-25 12:11:59 +02:00
2023-05-31 17:45:31 +02:00
/// <summary>True if the plugin is initialised to handle a megamap.</summary>
2022-09-22 01:26:46 +02:00
bool IsMegaMap { get ; }
2020-09-11 23:46:04 +03:00
2023-05-31 17:45:31 +02:00
/// <summary>The map.</summary>
2020-09-11 23:46:04 +03:00
Map Map { get ; }
2023-05-31 17:45:31 +02:00
/// <summary>The map image to show.</summary>
2020-09-11 23:46:04 +03:00
Image MapImage { get ; }
2023-05-31 17:45:31 +02:00
/// <summary>Feedback handler that can be attached to the plugin.</summary>
2022-10-02 12:40:55 +02:00
IFeedBackHandler FeedBackHandler { get ; set ; }
2023-05-31 17:45:31 +02:00
/// <summary>True if the currently loaded map was modified.</summary>
2020-09-11 23:46:04 +03:00
bool Dirty { get ; set ; }
2023-05-31 17:45:31 +02:00
/// <summary>Extra ini text that can be freely edited by the user.</summary>
2022-09-25 12:11:59 +02:00
string ExtraIniText { get ; set ; }
2022-09-10 02:47:12 +02:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Create a new map in the chosen theater.
/// </summary>
/// <param name="theater">The name of the theater to use.</param>
2020-09-11 23:46:04 +03:00
void New ( string theater ) ;
2023-05-31 17:45:31 +02:00
/// <summary>
/// Load a map.
/// </summary>
/// <param name="path">Path of the map to load.</param>
/// <param name="fileType">File type of the actual file in the path, so accompanying files can be loaded correctly.</param>
/// <returns>Any issues encountered when loading the map.</returns>
2022-10-02 12:40:55 +02:00
IEnumerable < string > Load ( string path , FileType fileType ) ;
2020-09-11 23:46:04 +03:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Save the current map to the given path, with the given file type.
/// </summary>
/// <param name="path">Path of the map to save.</param>
/// <param name="fileType">File type of the actual file in the path, so accompanying files can be saved correctly.</param>
/// <returns>true if the saving succeeded.</returns>
2020-09-11 23:46:04 +03:00
bool Save ( string path , FileType fileType ) ;
2022-08-14 15:12:30 +02:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Save the current map to the given path, with the given file type.
/// </summary>
/// <param name="path">Path of the map to save.</param>
/// <param name="fileType">File type of the actual file in the path, so accompanying files can be saved correctly.</param>
/// <param name="customPreview">Custom preview given to the map.</param>
/// <param name="dontResavePreview">True to not resave the preview on disc when doing the save operation.</param>
/// <returns>true if the saving succeeded.</returns>
2023-03-10 21:45:02 +01:00
bool Save ( string path , FileType fileType , Bitmap customPreview , bool dontResavePreview ) ;
2022-08-18 00:41:47 +02:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Validate the map to see if there are any blocking errors preventing it from saving.
/// </summary>
/// <returns>true if the validation succeeded.</returns>
2022-08-14 15:12:30 +02:00
string Validate ( ) ;
2022-10-13 18:45:23 +02:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Generates an overview of how many items are on the map and how many are allowed, and does a trigger analysis.
/// </summary>
/// <returns>The generated map items overview.</returns>
2023-04-03 21:17:00 +02:00
IEnumerable < string > AssessMapItems ( ) ;
2022-10-18 08:56:25 +02:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Retrieves a hash set of all houses for which production is started by triggers.
/// </summary>
/// <returns>A hash set of all houses for which production is started by triggers.</returns>
2022-10-18 08:56:25 +02:00
HashSet < string > GetHousesWithProduction ( ) ;
2022-10-28 15:15:52 +02:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Returns an array containing the reveal radius for each waypoint on the map.
/// </summary>
/// <param name="map">The map to gheck the waypoints on.</param>
/// <param name="forLargeReveal">False for small flare reveal, true for large area reveal.</param>
/// <returns></returns>
2023-03-16 19:03:14 +01:00
int [ ] GetRevealRadiusForWaypoints ( Map map , bool forLargeReveal ) ;
2023-03-12 02:40:33 +01:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Check whether there are any errors in the currect scripting.
/// </summary>
/// <param name="triggers">List of triggers to check.</param>
/// <param name="includeExternalData">True to fetch extra data from the map, such as map objects that triggers can be linked to.</param>
/// <param name="prefixNames">True to prefix the trigger name before every line. If false, each trigger's analysis will be preceded with a header line containing the trigger name.</param>
/// <param name="fatalOnly">True to report fatal issues only.</param>
/// <param name="fatal">Returns true if fatal issues were encountered.</param>
/// <param name="fix">True to fix issues that are encountered whenever possible.</param>
/// <param name="wasFixed">Returns true if issues were fixed.</param>
/// <returns>A summation of the encountered issues.</returns>
2023-04-03 21:17:00 +02:00
IEnumerable < string > CheckTriggers ( IEnumerable < Trigger > triggers , bool includeExternalData , bool prefixNames , bool fatalOnly , out bool fatal , bool fix , out bool wasFixed ) ;
2022-10-28 15:15:52 +02:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Checks whether the name has a default map name that is considered empty by this game plugin.
/// </summary>
/// <param name="name">Map name to check.</param>
/// <returns>True if the given name is considered empty by this game plugin.</returns>
2022-11-14 23:13:32 +01:00
bool MapNameIsEmpty ( string name ) ;
2023-03-18 01:42:43 +01:00
2023-05-31 17:45:31 +02:00
/// <summary>
/// Checks whether the briefing has any kind of issues concerning length or supported characters.
/// </summary>
/// <param name="briefing">The briefing to check</param>
/// <returns>Null if everything is okay, otherwise any issues to show on the user interface.</returns>
string EvaluateBriefing ( string briefing ) ;
2020-09-11 23:46:04 +03:00
}
}