mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-09-14 04:19:40 +00:00
Compare commits
100
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d919787743 | ||
|
|
8711395682 | ||
|
|
23204aa404 | ||
|
|
bddfcaef95 | ||
|
|
9d958ff581 | ||
|
|
c19d7bfdae | ||
|
|
1b4e13bd49 | ||
|
|
fa0949577e | ||
|
|
597ef4e7b1 | ||
|
|
ee0fcb2567 | ||
|
|
69e197c87f | ||
|
|
2fb393fcd0 | ||
|
|
b476537d29 | ||
|
|
d2c643df63 | ||
|
|
d0770c8319 | ||
|
|
c530450193 | ||
|
|
531e501b5a | ||
|
|
b80fb93b1b | ||
|
|
52175a4260 | ||
|
|
bc9c8db287 | ||
|
|
3c355da531 | ||
|
|
251687f795 | ||
|
|
00ec5da361 | ||
|
|
7ff95b9e97 | ||
|
|
f5ebbc96e9 | ||
|
|
d906c6865a | ||
|
|
d8d2f74559 | ||
|
|
6d6be50ae0 | ||
|
|
d880056415 | ||
|
|
ecb725b34b | ||
|
|
a32154eaa0 | ||
|
|
f4770d0b0a | ||
|
|
e40eb8177a | ||
|
|
9856282d0b | ||
|
|
abbc0f052b | ||
|
|
aa482051ed | ||
|
|
34d90da509 | ||
|
|
18ac3f2bd8 | ||
|
|
2aa6086256 | ||
|
|
9a05d03e2c | ||
|
|
8dbb654e39 | ||
|
|
4da7f2b723 | ||
|
|
f5caf142c0 | ||
|
|
5f79b4c5d1 | ||
|
|
b9e19cc6c1 | ||
|
|
4027e58ba3 | ||
|
|
c4e2dfdd89 | ||
|
|
d2f776ef3e | ||
|
|
8371ecc922 | ||
|
|
37b136576d | ||
|
|
caa5762636 | ||
|
|
3655d5105b | ||
|
|
2d368a37b9 | ||
|
|
091bc25a90 | ||
|
|
0d929e877f | ||
|
|
19004a77f8 | ||
|
|
0e9a98619d | ||
|
|
6ed84aff8d | ||
|
|
9a921fd0ae | ||
|
|
cb414b09d2 | ||
|
|
62b00c1da8 | ||
|
|
bcd3f2bb59 | ||
|
|
a90b767995 | ||
|
|
4af8c2d5e1 | ||
|
|
da460f6928 | ||
|
|
3b2ecfab01 | ||
|
|
6f6035ce0b | ||
|
|
39f2d75e03 | ||
|
|
a057b8c634 | ||
|
|
b111813d0b | ||
|
|
6d0cf1d2ea | ||
|
|
167813aded | ||
|
|
8b223f0274 | ||
|
|
20931c5af8 | ||
|
|
a137c838f9 | ||
|
|
1a6d352b92 | ||
|
|
f27b7e2a78 | ||
|
|
440b63da33 | ||
|
|
4d71d3868d | ||
|
|
977c1fa68a | ||
|
|
433af5215a | ||
|
|
24d530b55d | ||
|
|
35b76bc8a9 | ||
|
|
fbbfaac819 | ||
|
|
8d125a60ce | ||
|
|
660e5b286f | ||
|
|
7d2061516a | ||
|
|
98fdf81320 | ||
|
|
156e25d375 | ||
|
|
96e1f0a8f0 | ||
|
|
0e6ca77e1a | ||
|
|
2c09939bd3 | ||
|
|
3f7b812891 | ||
|
|
47171c7829 | ||
|
|
f7c7271ecf | ||
|
|
1143f0451a | ||
|
|
cf4f7399a1 | ||
|
|
3ef77e55c5 | ||
|
|
dc497258d6 | ||
|
|
2fb22e8214 |
@@ -93,7 +93,7 @@ FILE_PATTERNS = *.c \
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS = */3rdparty */.svn
|
||||
EXCLUDE_PATTERNS = */3rdparty */.svn */script/api
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
|
||||
@@ -1,3 +1,42 @@
|
||||
1.2.0-beta2 (2012-01-07)
|
||||
------------------------------------------------------------------------
|
||||
-Feature: [NewGRF] Allow read-only display of NewGRF parameters, if GRF list may not be edited (r23760)
|
||||
-Feature: [NewGRF] Alternate rail type label list (r23758)
|
||||
-Feature: Make the default secondary sort method for the server list the number of clients instead of the name (r23710)
|
||||
-Feature: Try harder to sort text instead of fancy characters in the server names (r23709)
|
||||
-Feature: Make a distinction between fully zoomed in and default zoomed in screenshots [FS#4916] (r23695)
|
||||
-Feature: Add ability to adjust brightness of colour after remapping for 32bpp sprites (r23670)
|
||||
-Feature: [GS] GSGoal::Question(), to ask a question to a(ll) company(ies). It can contain random text, and at most 3 buttons from a collection of 17 (r23731)
|
||||
-Feature: Australian translation (r23730)
|
||||
-Fix: Make default timeouts for certain network states lower and configurable [FS#4955] (r23764)
|
||||
-Fix: Check whether a water tile is really empty when overbuilding it with an object [FS#4956] (r23763)
|
||||
-Fix: The check for duplicate town names was not really working [FS#4951] (r23759)
|
||||
-Fix: Missing locking causing crash is extreme case when being in the MP lobby [FS#4938] (r23752)
|
||||
-Fix: [Win32] Work around a possible deadlock when initialising threaded drawing (r23749)
|
||||
-Fix: Make vehicle variables A8 and A9 always return 0. Returning cur_image is a potential desyncer due to Action1 in static NewGRFs (r23748)
|
||||
-Fix: Also set 'info' to NULL if 'instance' dies (for both AI and GS); avoids invalid memory reads (r23746)
|
||||
-Fix: If autorefit fails, count the vehicle capacity nevertheless, if it is already carrying the right thing (r23745)
|
||||
-Fix: [NewGRF] Check the version of the right GRF [FS#4923] (r23744)
|
||||
-Fix: [NewGRF] Call CB 15E for all vehicles before actually executing any refit [FS#4906] (r23743)
|
||||
-Fix: Cheating to different climates messes things even more up than changing NewGRFs in-game so it was removed [FS#4939] (r23733)
|
||||
-Fix: When cheating into another company, the SignList was not updated [FS#4942] (r23728)
|
||||
-Fix: Reading memory of a temporary (already deconstructed) object is invalid (r23721)
|
||||
-Fix: [Script] Show the script debug window also when the game script crashes [FS#4935] (r23720)
|
||||
-Fix: Extraction of music packs failed [FS#4930] (r23719)
|
||||
-Fix: [AI] Rescanai caused crash when the AI settings of an AI was opened [FS#4936] (r23718)
|
||||
-Fix: Ships going to wrong dock location when moving the dock while the game is paused [FS#4927] (r23717)
|
||||
-Fix: The amount of goals was too low [FS#4928] (r23699)
|
||||
-Fix: Hardcode the original defaults for loading old savegames if they could totally mess with the game's behaviour [FS#4859] (r23693)
|
||||
-Fix: Infrastructure count of canals/locks/ship depots was not updated properly when a company went into bankruptcy or was taken over [FS#4921] (r23686)
|
||||
-Fix: When fitting another engine the cargo capacity of wagons could become lower, causing them to contain more than they should. This caused the cargo transfer from the replaced parts to put even more stuff in the already full wagon. Prevent this from happening by reducing the amount of cargo in the vehicle to the capacity when moving vehicles/wagons around, or when autoreplacing [FS#4912] (r23683)
|
||||
-Fix: Vehicle numbers got misaccounted when autoreplacing failed due to length checks [FS#4914] (r23681)
|
||||
-Fix: [AI] Prevent removal of the (AI) company the local player is in [FS#4915] (r23680)
|
||||
-Fix: [Script] Close the editbox of settings when changing an AI, to avoid invalid memory read/write (r23678)
|
||||
-Fix: [Script] Invalidate AI Parameters window when changing AI [FS#4909] (r23677)
|
||||
-Fix: When removing road stops the wrong tile was checked for updating the infrastructure cache [FS#4913] (r23676)
|
||||
-Fix: [Script] The 'Configure' button in the 'AI / Game Configuration' window did not get enabled when activating a GameScript (r23668)
|
||||
|
||||
|
||||
1.2.0-beta1 (2011-12-24)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: Ability to run a game script; a script that controls some of the logic of the game, e.g. to implement goals or tutorials (r23637)
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
OpenTTD's known bugs
|
||||
Last updated: 2011-12-24
|
||||
Release version: 1.2.0-beta1
|
||||
Last updated: 2012-01-07
|
||||
Release version: 1.2.0-beta2
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
+7
-1
@@ -1,8 +1,14 @@
|
||||
openttd (1.2.0~beta2) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.2.0-beta2
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Sat, 07 Jan 2012 00:00:00 +0100
|
||||
|
||||
openttd (1.2.0~beta1) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.2.0-beta1
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Fri, 24 Dec 2011 00:00:00 +0100
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Sat, 24 Dec 2011 00:00:00 +0100
|
||||
|
||||
openttd (1.1.4) unstable; urgency=low
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@echo off
|
||||
|
||||
set OPENTTD_VERSION=1.2.0-beta1
|
||||
set OPENTTD_VERSION=1.2.0-beta2
|
||||
set OPENSFX_VERSION=0.8.0
|
||||
set NOSOUND_VERSION=0.8.0
|
||||
set OPENGFX_VERSION=0.7.0
|
||||
set OPENGFX_VERSION=1.2.0
|
||||
|
||||
echo To make the installer, you must have the WarpIN compiler (wic) installed and in
|
||||
echo your path, as well as wget and unzip. This file will download the various DLLs
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
!define APPV_MAJOR 1
|
||||
!define APPV_MINOR 2
|
||||
!define APPV_MAINT 0
|
||||
!define APPV_BUILD 0
|
||||
!define APPV_EXTRA "-beta1"
|
||||
!define APPV_BUILD 1
|
||||
!define APPV_EXTRA "-beta2"
|
||||
|
||||
!define APPNAME "OpenTTD" ; Define application name
|
||||
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version
|
||||
@@ -14,7 +14,7 @@
|
||||
!define APPURLLINK "http://www.openttd.org"
|
||||
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
|
||||
|
||||
!define OPENGFX_BASE_VERSION "0.7.0"
|
||||
!define OPENGFX_BASE_VERSION "1.2.0"
|
||||
!define OPENSFX_BASE_VERSION "0.8.0"
|
||||
!define OPENMSX_BASE_VERSION "1.0.0"
|
||||
|
||||
|
||||
@@ -107,6 +107,12 @@
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\src\lang\english.txt;..\objs\strgen\strgen.exe;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\bin\lang\dutch.lng;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\src\lang\english_AU.txt">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating english_AU language file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "%(FullPath)"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\src\lang\english.txt;..\objs\strgen\strgen.exe;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\bin\lang\english_AU.lng;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\src\lang\english_US.txt">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating english_US language file</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "%(FullPath)"</Command>
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
<CustomBuild Include="..\src\lang\dutch.txt">
|
||||
<Filter>Translations</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\src\lang\english_AU.txt">
|
||||
<Filter>Translations</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\src\lang\english_US.txt">
|
||||
<Filter>Translations</Filter>
|
||||
</CustomBuild>
|
||||
|
||||
@@ -213,6 +213,21 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\english_AU.txt"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating english_AU language file"
|
||||
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "$(InputPath)"
exit 0
"
|
||||
AdditionalDependencies="..\src\lang\english.txt;..\objs\strgen\strgen.exe"
|
||||
Outputs="..\bin\lang\english_AU.lng"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\english_US.txt"
|
||||
>
|
||||
|
||||
@@ -214,6 +214,21 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\english_AU.txt"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating english_AU language file"
|
||||
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "$(InputPath)"
exit 0
"
|
||||
AdditionalDependencies="..\src\lang\english.txt;..\objs\strgen\strgen.exe"
|
||||
Outputs="..\bin\lang\english_AU.lng"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\english_US.txt"
|
||||
>
|
||||
|
||||
+4
-2
@@ -1,6 +1,6 @@
|
||||
OpenTTD readme
|
||||
Last updated: 2011-12-24
|
||||
Release version: 1.2.0-beta1
|
||||
Last updated: 2012-01-07
|
||||
Release version: 1.2.0-beta2
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -292,6 +292,8 @@ OpenTTD directory:
|
||||
Music Sets: baseset (or a subdirectory thereof)
|
||||
AIs: ai (or a subdirectory thereof)
|
||||
AI Libraries: ai/libraries (or a subdirectory thereof)
|
||||
Game Scripts (GS): game (or a subdirectory thereof)
|
||||
GS Libraries: game/libraries (or a subdirectory thereof)
|
||||
Savegames: save
|
||||
Automatic Savegames: save/autosave
|
||||
Scenarios: scenario
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define AI_HPP
|
||||
|
||||
#include "../script/api/script_event_types.hpp"
|
||||
#include "../date_type.h"
|
||||
#include "../core/string_compare_type.hpp"
|
||||
#include <map>
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../settings_type.h"
|
||||
#include "../core/random_func.hpp"
|
||||
#include "ai.hpp"
|
||||
#include "ai_config.hpp"
|
||||
#include "ai_info.hpp"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define AI_CONFIG_HPP
|
||||
|
||||
#include "../script/script_config.hpp"
|
||||
#include "../company_type.h"
|
||||
|
||||
class AIConfig : public ScriptConfig {
|
||||
public:
|
||||
|
||||
+2
-5
@@ -16,15 +16,11 @@
|
||||
#include "../company_func.h"
|
||||
#include "../network/network.h"
|
||||
#include "../window_func.h"
|
||||
#include "../command_func.h"
|
||||
#include "../fileio_func.h"
|
||||
#include "ai_scanner.hpp"
|
||||
#include "ai_instance.hpp"
|
||||
#include "ai_config.hpp"
|
||||
#include "ai_info.hpp"
|
||||
#include "ai.hpp"
|
||||
#include "../script/script_storage.hpp"
|
||||
#include "../script/api/script_error.hpp"
|
||||
|
||||
/* static */ uint AI::frame_counter = 0;
|
||||
/* static */ AIScannerInfo *AI::scanner_info = NULL;
|
||||
@@ -108,6 +104,7 @@
|
||||
|
||||
delete c->ai_instance;
|
||||
c->ai_instance = NULL;
|
||||
c->ai_info = NULL;
|
||||
|
||||
cur_company.Restore();
|
||||
|
||||
@@ -333,7 +330,7 @@
|
||||
|
||||
InvalidateWindowData(WC_AI_LIST, 0, 1);
|
||||
SetWindowClassesDirty(WC_AI_DEBUG);
|
||||
SetWindowDirty(WC_AI_SETTINGS, 0);
|
||||
InvalidateWindowClassesData(WC_AI_SETTINGS);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
|
||||
+10
-6
@@ -7,14 +7,13 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file ai_gui.cpp Window for configuring the AIs */
|
||||
/** @file ai_gui.cpp %Window for configuring the AIs */
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../table/sprites.h"
|
||||
#include "../error.h"
|
||||
#include "../gui.h"
|
||||
#include "../querystring_gui.h"
|
||||
#include "../company_func.h"
|
||||
#include "../company_base.h"
|
||||
#include "../company_gui.h"
|
||||
#include "../strings_func.h"
|
||||
@@ -24,7 +23,6 @@
|
||||
#include "../network/network.h"
|
||||
#include "../settings_func.h"
|
||||
#include "../network/network_content.h"
|
||||
#include "../core/backup_type.hpp"
|
||||
|
||||
#include "ai.hpp"
|
||||
#include "../script/api/script_log.hpp"
|
||||
@@ -36,7 +34,6 @@
|
||||
#include "../game/game_info.hpp"
|
||||
#include "../game/game_instance.hpp"
|
||||
|
||||
#include "../widgets/ai_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -172,7 +169,9 @@ struct AIListWindow : public Window {
|
||||
for (int i = 0; i < this->selected; i++) it++;
|
||||
GetConfig(slot)->Change((*it).second->GetName(), (*it).second->GetVersion());
|
||||
}
|
||||
SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
|
||||
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
|
||||
InvalidateWindowClassesData(WC_AI_SETTINGS);
|
||||
DeleteWindowByClass(WC_QUERY_STRING);
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
@@ -385,7 +384,7 @@ struct AISettingsWindow : public Window {
|
||||
}
|
||||
|
||||
if ((config_item.flags & SCRIPTCONFIG_BOOLEAN) != 0) {
|
||||
DrawFrameRect(buttons_left, y + 2, buttons_left + 19, y + 10, (current_value != 0) ? COLOUR_GREEN : COLOUR_RED, (current_value != 0) ? FR_LOWERED : FR_NONE);
|
||||
DrawBoolButton(buttons_left, y + 2, current_value != 0, editable);
|
||||
SetDParam(idx++, current_value == 0 ? STR_CONFIG_SETTING_OFF : STR_CONFIG_SETTING_ON);
|
||||
} else {
|
||||
DrawArrowButtons(buttons_left, y + 2, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + (this->clicked_increase != rtl) : 0, editable && current_value > config_item.min_value, editable && current_value < config_item.max_value);
|
||||
@@ -1319,4 +1318,9 @@ void ShowAIDebugWindowIfAIError()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GameInstance *g = Game::GetGameInstance();
|
||||
if (g != NULL && g->IsDead()) {
|
||||
ShowAIDebugWindow(OWNER_DEITY);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file ai_gui.hpp Window for configuring the AIs */
|
||||
/** @file ai_gui.hpp %Window for configuring the AIs */
|
||||
|
||||
#ifndef AI_GUI_HPP
|
||||
#define AI_GUI_HPP
|
||||
|
||||
@@ -11,14 +11,11 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
|
||||
#include "../script/squirrel_helper.hpp"
|
||||
#include "../script/squirrel_class.hpp"
|
||||
#include "ai_info.hpp"
|
||||
#include "ai_scanner.hpp"
|
||||
#include "../settings_type.h"
|
||||
#include "../debug.h"
|
||||
#include "../rev.h"
|
||||
#include "ai.hpp"
|
||||
|
||||
/**
|
||||
* Check if the API version provided by the AI is supported.
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define AI_INFO_HPP
|
||||
|
||||
#include "../script/script_info.hpp"
|
||||
#include "../script/script_config.hpp"
|
||||
|
||||
/** All static information from an AI like name, version, etc. */
|
||||
class AIInfo : public ScriptInfo {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../debug.h"
|
||||
#include "../saveload/saveload.h"
|
||||
#include "../error.h"
|
||||
|
||||
#include "../script/squirrel_class.hpp"
|
||||
@@ -20,8 +19,6 @@
|
||||
#include "ai_gui.hpp"
|
||||
#include "ai.hpp"
|
||||
|
||||
#include "../script/script_fatalerror.hpp"
|
||||
#include "../script/script_suspend.hpp"
|
||||
#include "../script/script_storage.hpp"
|
||||
#include "ai_info.hpp"
|
||||
#include "ai_instance.hpp"
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#ifndef AI_INSTANCE_HPP
|
||||
#define AI_INSTANCE_HPP
|
||||
|
||||
#include <squirrel.h>
|
||||
#include "../script/script_instance.hpp"
|
||||
|
||||
/** Runtime information about an AI like a pointer to the squirrel vm and the current state. */
|
||||
|
||||
@@ -11,14 +11,12 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../debug.h"
|
||||
#include "../fileio_func.h"
|
||||
#include "../network/network.h"
|
||||
#include "../core/random_func.hpp"
|
||||
|
||||
#include "../script/squirrel_class.hpp"
|
||||
#include "ai_info.hpp"
|
||||
#include "ai_scanner.hpp"
|
||||
#include "../script/api/script_controller.hpp"
|
||||
|
||||
|
||||
AIScannerInfo::AIScannerInfo() :
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "aircraft.h"
|
||||
#include "landscape.h"
|
||||
#include "news_func.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "newgrf_engine.h"
|
||||
#include "newgrf_sound.h"
|
||||
#include "spritecache.h"
|
||||
@@ -314,8 +313,8 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
|
||||
|
||||
UpdateAircraftCache(v, true);
|
||||
|
||||
VehicleMove(v, false);
|
||||
VehicleMove(u, false);
|
||||
VehicleUpdatePosition(v);
|
||||
VehicleUpdatePosition(u);
|
||||
|
||||
/* Aircraft with 3 vehicles (chopper)? */
|
||||
if (v->subtype == AIR_HELICOPTER) {
|
||||
@@ -336,7 +335,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
|
||||
w->UpdateDeltaXY(INVALID_DIR);
|
||||
|
||||
u->SetNext(w);
|
||||
VehicleMove(w, false);
|
||||
VehicleUpdatePosition(w);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +463,7 @@ static void HelicopterTickHandler(Aircraft *v)
|
||||
|
||||
u->cur_image = img;
|
||||
|
||||
VehicleMove(u, true);
|
||||
VehicleUpdatePositionAndViewport(u);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,6 +479,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
|
||||
v->y_pos = y;
|
||||
v->z_pos = z;
|
||||
|
||||
VehicleUpdatePosition(v);
|
||||
v->UpdateViewport(true, false);
|
||||
if (v->subtype == AIR_HELICOPTER) v->Next()->Next()->cur_image = GetRotorImage(v, EIT_ON_MAP);
|
||||
|
||||
@@ -494,7 +494,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
|
||||
u->z_pos = GetSlopePixelZ(safe_x, safe_y);
|
||||
u->cur_image = v->cur_image;
|
||||
|
||||
VehicleMove(u, true);
|
||||
VehicleUpdatePositionAndViewport(u);
|
||||
|
||||
u = u->Next();
|
||||
if (u != NULL) {
|
||||
@@ -502,7 +502,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
|
||||
u->y_pos = y;
|
||||
u->z_pos = z + ROTOR_Z_OFFSET;
|
||||
|
||||
VehicleMove(u, true);
|
||||
VehicleUpdatePositionAndViewport(u);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -201,7 +201,7 @@ static AirportFTA *AirportBuildAutomata(uint nofelements, const AirportFTAbuildu
|
||||
|
||||
/**
|
||||
* Get the finite state machine of an airport type.
|
||||
* @param airport_type Airport type to query FTA from. @see AirportTypes
|
||||
* @param airport_type %Airport type to query FTA from. @see AirportTypes
|
||||
* @return Finite state machine of the airport.
|
||||
*/
|
||||
const AirportFTAClass *GetAirport(const byte airport_type)
|
||||
|
||||
+2
-2
@@ -71,7 +71,7 @@ enum AirportMovementStates {
|
||||
STARTTAKEOFF = 11, ///< Airplane has arrived at a runway for take-off.
|
||||
ENDTAKEOFF = 12, ///< Airplane has reached end-point of the take-off runway.
|
||||
HELITAKEOFF = 13, ///< Helicopter wants to leave the airport.
|
||||
FLYING = 14, ///< Vehicle is flying in the air.
|
||||
FLYING = 14, ///< %Vehicle is flying in the air.
|
||||
LANDING = 15, ///< Airplane wants to land.
|
||||
ENDLANDING = 16, ///< Airplane wants to finish landing.
|
||||
HELILANDING = 17, ///< Helicopter wants to land.
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
const AirportMovingData *moving_data; ///< Movement data.
|
||||
struct AirportFTA *layout; ///< state machine for airport
|
||||
const byte *terminals; ///< Array with the number of terminal groups, followed by the number of terminals in each group.
|
||||
const byte *terminals; ///< %Array with the number of terminal groups, followed by the number of terminals in each group.
|
||||
const byte num_helipads; ///< Number of helipads on this airport. When 0 helicopters will go to normal terminals.
|
||||
Flags flags; ///< Flags for this airport type.
|
||||
byte nofelements; ///< number of positions the airport consists of
|
||||
|
||||
@@ -27,11 +27,9 @@
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "hotkeys.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "sprite.h"
|
||||
|
||||
#include "widgets/airport_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
static AirportClassID _selected_airport_class; ///< the currently visible airport class
|
||||
static int _selected_airport_index; ///< the index of the selected airport in the current class or -1
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file animated_tile_func.h Tile animation! */
|
||||
/** @file animated_tile_func.h %Tile animation! */
|
||||
|
||||
#ifndef ANIMATED_TILE_FUNC_H
|
||||
#define ANIMATED_TILE_FUNC_H
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "newgrf.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
|
||||
static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts per vehicle, i.e. when to abort calling the articulated vehicle callback.
|
||||
|
||||
@@ -397,6 +396,6 @@ void AddArticulatedParts(Vehicle *first)
|
||||
|
||||
if (flip_image) v->spritenum++;
|
||||
|
||||
VehicleMove(v, false);
|
||||
VehicleUpdatePosition(v);
|
||||
}
|
||||
}
|
||||
|
||||
+30
-2
@@ -17,7 +17,6 @@
|
||||
#include "vehicle_func.h"
|
||||
#include "autoreplace_func.h"
|
||||
#include "autoreplace_gui.h"
|
||||
#include "group.h"
|
||||
#include "articulated_vehicles.h"
|
||||
#include "core/random_func.hpp"
|
||||
|
||||
@@ -89,6 +88,33 @@ bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company)
|
||||
return EnginesHaveCargoInCommon(from, to);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the capacity of all vehicles in a chain and spread cargo if needed.
|
||||
* @param v The vehicle to check.
|
||||
*/
|
||||
void CheckCargoCapacity(Vehicle *v)
|
||||
{
|
||||
assert(v == NULL || v->First() == v);
|
||||
|
||||
for (Vehicle *src = v; src != NULL; src = src->Next()) {
|
||||
/* Do we need to more cargo away? */
|
||||
if (src->cargo.Count() <= src->cargo_cap) continue;
|
||||
|
||||
/* We need to move a particular amount. Try that on the other vehicles. */
|
||||
uint to_spread = src->cargo.Count() - src->cargo_cap;
|
||||
for (Vehicle *dest = v; dest != NULL && to_spread != 0; dest = dest->Next()) {
|
||||
if (dest->cargo.Count() >= dest->cargo_cap || dest->cargo_type != src->cargo_type) continue;
|
||||
|
||||
uint amount = min(to_spread, dest->cargo_cap - dest->cargo.Count());
|
||||
src->cargo.MoveTo(&dest->cargo, amount, VehicleCargoList::MTA_UNLOAD, NULL);
|
||||
to_spread -= amount;
|
||||
}
|
||||
|
||||
/* Any left-overs will be thrown away, but not their feeder share. */
|
||||
src->cargo.Truncate(src->cargo_cap);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer cargo from a single (articulated )old vehicle to the new vehicle chain
|
||||
* @param old_veh Old vehicle that will be sold
|
||||
@@ -297,7 +323,7 @@ static inline CommandCost CmdStartStopVehicle(const Vehicle *v, bool evaluate_ca
|
||||
*/
|
||||
static inline CommandCost CmdMoveVehicle(const Vehicle *v, const Vehicle *after, DoCommandFlag flags, bool whole_chain)
|
||||
{
|
||||
return DoCommand(0, v->index | (whole_chain ? 1 : 0) << 20, after != NULL ? after->index : INVALID_VEHICLE, flags, CMD_MOVE_RAIL_VEHICLE);
|
||||
return DoCommand(0, v->index | (whole_chain ? 1 : 0) << 20, after != NULL ? after->index : INVALID_VEHICLE, flags | DC_NO_CARGO_CAP_CHECK, CMD_MOVE_RAIL_VEHICLE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -551,6 +577,8 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
||||
if (i == 0) old_head = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & DC_EXEC) != 0) CheckCargoCapacity(new_head);
|
||||
}
|
||||
|
||||
/* If we are not in DC_EXEC undo everything, i.e. rearrange old vehicles.
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
#include "command_type.h"
|
||||
#include "company_base.h"
|
||||
#include "engine_type.h"
|
||||
#include "group_type.h"
|
||||
|
||||
void RemoveAllEngineReplacement(EngineRenewList *erl);
|
||||
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "command_func.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "newgrf_engine.h"
|
||||
#include "group.h"
|
||||
#include "rail.h"
|
||||
#include "strings_func.h"
|
||||
#include "window_func.h"
|
||||
@@ -28,7 +27,6 @@
|
||||
|
||||
#include "widgets/autoreplace_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
uint GetEngineListHeight(VehicleType type);
|
||||
void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "company_func.h"
|
||||
#include "depot_func.h"
|
||||
#include "slope_func.h"
|
||||
#include "tile_map.h"
|
||||
|
||||
/**
|
||||
|
||||
+49
-48
@@ -10,7 +10,6 @@
|
||||
/** @file 32bpp_anim.cpp Implementation of the optimized 32 bpp blitter with animation support. */
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../core/math_func.hpp"
|
||||
#include "../video/video_driver.hpp"
|
||||
#include "32bpp_anim.hpp"
|
||||
|
||||
@@ -25,27 +24,27 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
const SpriteData *src = (const SpriteData *)bp->sprite;
|
||||
|
||||
const Colour *src_px = (const Colour *)(src->data + src->offset[zoom][0]);
|
||||
const uint8 *src_n = (const uint8 *)(src->data + src->offset[zoom][1]);
|
||||
const uint16 *src_n = (const uint16 *)(src->data + src->offset[zoom][1]);
|
||||
|
||||
for (uint i = bp->skip_top; i != 0; i--) {
|
||||
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
||||
src_n += *(const uint32 *)src_n;
|
||||
src_n = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
|
||||
}
|
||||
|
||||
uint32 *dst = (uint32 *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
uint8 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
|
||||
uint16 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
|
||||
|
||||
const byte *remap = bp->remap; // store so we don't have to access it via bp everytime
|
||||
|
||||
for (int y = 0; y < bp->height; y++) {
|
||||
uint32 *dst_ln = dst + bp->pitch;
|
||||
uint8 *anim_ln = anim + this->anim_buf_width;
|
||||
uint16 *anim_ln = anim + this->anim_buf_width;
|
||||
|
||||
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
||||
src_px++;
|
||||
|
||||
const uint8 *src_n_ln = src_n + *(const uint32 *)src_n;
|
||||
src_n += 4;
|
||||
const uint16 *src_n_ln = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
|
||||
src_n += 2;
|
||||
|
||||
uint32 *dst_end = dst + bp->skip_left;
|
||||
|
||||
@@ -106,9 +105,9 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
*dst = src_px->data;
|
||||
*anim = 0;
|
||||
} else {
|
||||
uint r = remap[m];
|
||||
*anim = r;
|
||||
if (r != 0) *dst = this->LookupColourInPalette(r);
|
||||
uint r = remap[GB(m, 0, 8)];
|
||||
*anim = r | (m & 0xFF00);
|
||||
if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
|
||||
}
|
||||
anim++;
|
||||
dst++;
|
||||
@@ -122,9 +121,9 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
|
||||
*anim = 0;
|
||||
} else {
|
||||
uint r = remap[m];
|
||||
uint r = remap[GB(m, 0, 8)];
|
||||
*anim = 0;
|
||||
if (r != 0) *dst = ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, *dst);
|
||||
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
|
||||
}
|
||||
anim++;
|
||||
dst++;
|
||||
@@ -145,14 +144,14 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
src_px += n;
|
||||
do {
|
||||
*dst = MakeTransparent(*dst, 3, 4);
|
||||
*anim = remap[*anim];
|
||||
*anim = 0;
|
||||
anim++;
|
||||
dst++;
|
||||
} while (--n != 0);
|
||||
} else {
|
||||
do {
|
||||
*dst = MakeTransparent(*dst, (256 * 4 - src_px->a), 256 * 4);
|
||||
*anim = remap[*anim];
|
||||
*anim = 0;
|
||||
anim++;
|
||||
dst++;
|
||||
src_px++;
|
||||
@@ -164,23 +163,25 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
/* Compiler assumes pointer aliasing, can't optimise this on its own */
|
||||
uint m = *src_n++;
|
||||
uint m = GB(*src_n, 0, 8);
|
||||
/* Above PALETTE_ANIM_START is palette animation */
|
||||
*anim++ = m;
|
||||
*dst++ = (m >= PALETTE_ANIM_START) ? this->LookupColourInPalette(m) : src_px->data;
|
||||
*anim++ = *src_n;
|
||||
*dst++ = (m >= PALETTE_ANIM_START) ? this->AdjustBrightness(this->LookupColourInPalette(m), GB(*src_n, 8, 8)) : src_px->data;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
} else {
|
||||
do {
|
||||
uint m = *src_n++;
|
||||
uint m = GB(*src_n, 0, 8);
|
||||
*anim++ = 0;
|
||||
if (m >= PALETTE_ANIM_START) {
|
||||
*dst = ComposeColourPANoCheck(this->LookupColourInPalette(m), src_px->a, *dst);
|
||||
*dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(m), GB(*src_n, 8, 8)), src_px->a, *dst);
|
||||
} else {
|
||||
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
|
||||
}
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
}
|
||||
break;
|
||||
@@ -219,7 +220,7 @@ void Blitter_32bppAnim::DrawColourMappingRect(void *dst, int width, int height,
|
||||
}
|
||||
|
||||
uint32 *udst = (uint32 *)dst;
|
||||
uint8 *anim;
|
||||
uint16 *anim;
|
||||
|
||||
anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
|
||||
|
||||
@@ -259,7 +260,7 @@ void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
|
||||
|
||||
/* Set the colour in the anim-buffer too, if we are rendering to the screen */
|
||||
if (_screen_disable_anim) return;
|
||||
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour;
|
||||
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour | (DEFAULT_BRIGHTNESS << 8);
|
||||
}
|
||||
|
||||
void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colour)
|
||||
@@ -271,18 +272,18 @@ void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colou
|
||||
}
|
||||
|
||||
uint32 colour32 = LookupColourInPalette(colour);
|
||||
uint8 *anim_line;
|
||||
uint16 *anim_line;
|
||||
|
||||
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
||||
|
||||
do {
|
||||
uint32 *dst = (uint32 *)video;
|
||||
uint8 *anim = anim_line;
|
||||
uint16 *anim = anim_line;
|
||||
|
||||
for (int i = width; i > 0; i--) {
|
||||
*dst = colour32;
|
||||
/* Set the colour in the anim-buffer too */
|
||||
*anim = colour;
|
||||
*anim = colour | (DEFAULT_BRIGHTNESS << 8);
|
||||
dst++;
|
||||
anim++;
|
||||
}
|
||||
@@ -297,19 +298,19 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
|
||||
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
||||
uint32 *dst = (uint32 *)video;
|
||||
const uint32 *usrc = (const uint32 *)src;
|
||||
uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
||||
uint16 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
/* We need to keep those for palette animation. */
|
||||
uint32 *dst_pal = dst;
|
||||
uint8 *anim_pal = anim_line;
|
||||
uint16 *anim_pal = anim_line;
|
||||
|
||||
memcpy(dst, usrc, width * sizeof(uint32));
|
||||
usrc += width;
|
||||
dst += _screen.pitch;
|
||||
/* Copy back the anim-buffer */
|
||||
memcpy(anim_line, usrc, width * sizeof(uint8));
|
||||
usrc = (const uint32 *)((const uint8 *)usrc + width);
|
||||
memcpy(anim_line, usrc, width * sizeof(uint16));
|
||||
usrc = (const uint32 *)((const uint16 *)usrc + width);
|
||||
anim_line += this->anim_buf_width;
|
||||
|
||||
/* Okay, it is *very* likely that the image we stored is using
|
||||
@@ -320,10 +321,10 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
|
||||
* for just the cursor. This just copies the implementation of
|
||||
* palette animation, much cheaper though slightly nastier. */
|
||||
for (int i = 0; i < width; i++) {
|
||||
uint colour = *anim_pal;
|
||||
if (IsInsideBS(colour, PALETTE_ANIM_START, PALETTE_ANIM_SIZE)) {
|
||||
uint colour = GB(*anim_pal, 0, 8);
|
||||
if (colour >= PALETTE_ANIM_START) {
|
||||
/* Update this pixel */
|
||||
*dst_pal = LookupColourInPalette(colour);
|
||||
*dst_pal = this->AdjustBrightness(LookupColourInPalette(colour), GB(*anim_pal, 8, 8));
|
||||
}
|
||||
dst_pal++;
|
||||
anim_pal++;
|
||||
@@ -337,7 +338,7 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
|
||||
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
||||
uint32 *udst = (uint32 *)dst;
|
||||
const uint32 *src = (const uint32 *)video;
|
||||
const uint8 *anim_line;
|
||||
const uint16 *anim_line;
|
||||
|
||||
if (this->anim_buf == NULL) return;
|
||||
|
||||
@@ -348,8 +349,8 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
|
||||
src += _screen.pitch;
|
||||
udst += width;
|
||||
/* Copy the anim-buffer */
|
||||
memcpy(udst, anim_line, width * sizeof(uint8));
|
||||
udst = (uint32 *)((uint8 *)udst + width);
|
||||
memcpy(udst, anim_line, width * sizeof(uint16));
|
||||
udst = (uint32 *)((uint16 *)udst + width);
|
||||
anim_line += this->anim_buf_width;
|
||||
}
|
||||
}
|
||||
@@ -358,7 +359,7 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
|
||||
{
|
||||
assert(!_screen_disable_anim);
|
||||
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
||||
uint8 *dst, *src;
|
||||
uint16 *dst, *src;
|
||||
|
||||
/* We need to scroll the anim-buffer too */
|
||||
if (scroll_y > 0) {
|
||||
@@ -375,7 +376,7 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
|
||||
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
|
||||
uint th = height - scroll_y;
|
||||
for (; th > 0; th--) {
|
||||
memcpy(dst, src, tw * sizeof(uint8));
|
||||
memcpy(dst, src, tw * sizeof(uint16));
|
||||
src -= this->anim_buf_width;
|
||||
dst -= this->anim_buf_width;
|
||||
}
|
||||
@@ -396,7 +397,7 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
|
||||
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
|
||||
uint th = height + scroll_y;
|
||||
for (; th > 0; th--) {
|
||||
memmove(dst, src, tw * sizeof(uint8));
|
||||
memmove(dst, src, tw * sizeof(uint16));
|
||||
src += this->anim_buf_width;
|
||||
dst += this->anim_buf_width;
|
||||
}
|
||||
@@ -407,7 +408,7 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
|
||||
|
||||
int Blitter_32bppAnim::BufferSize(int width, int height)
|
||||
{
|
||||
return width * height * (sizeof(uint32) + sizeof(uint8));
|
||||
return width * height * (sizeof(uint32) + sizeof(uint16));
|
||||
}
|
||||
|
||||
void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
|
||||
@@ -415,22 +416,22 @@ void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
|
||||
assert(!_screen_disable_anim);
|
||||
|
||||
this->palette = palette;
|
||||
/* Never repaint the transparency pixel */
|
||||
if (this->palette.first_dirty == 0) {
|
||||
this->palette.first_dirty++;
|
||||
this->palette.count_dirty--;
|
||||
}
|
||||
/* If first_dirty is 0, it is for 8bpp indication to send the new
|
||||
* palette. As we dont do that for 32bpp, ignore that request
|
||||
* completely */
|
||||
if (this->palette.first_dirty == 0) return;
|
||||
assert(this->palette.first_dirty == PALETTE_ANIM_START);
|
||||
|
||||
const uint8 *anim = this->anim_buf;
|
||||
const uint16 *anim = this->anim_buf;
|
||||
uint32 *dst = (uint32 *)_screen.dst_ptr;
|
||||
|
||||
/* Let's walk the anim buffer and try to find the pixels */
|
||||
for (int y = this->anim_buf_height; y != 0 ; y--) {
|
||||
for (int x = this->anim_buf_width; x != 0 ; x--) {
|
||||
uint colour = *anim;
|
||||
if (IsInsideBS(colour, this->palette.first_dirty, this->palette.count_dirty)) {
|
||||
uint colour = GB(*anim, 0, 8);
|
||||
if (colour >= PALETTE_ANIM_START) {
|
||||
/* Update this pixel */
|
||||
*dst = LookupColourInPalette(colour);
|
||||
*dst = this->AdjustBrightness(LookupColourInPalette(colour), GB(*anim, 8, 8));
|
||||
}
|
||||
dst++;
|
||||
anim++;
|
||||
@@ -452,7 +453,7 @@ void Blitter_32bppAnim::PostResize()
|
||||
if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height) {
|
||||
/* The size of the screen changed; we can assume we can wipe all data from our buffer */
|
||||
free(this->anim_buf);
|
||||
this->anim_buf = CallocT<uint8>(_screen.width * _screen.height);
|
||||
this->anim_buf = CallocT<uint16>(_screen.width * _screen.height);
|
||||
this->anim_buf_width = _screen.width;
|
||||
this->anim_buf_height = _screen.height;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/** The optimised 32 bpp blitter with palette animation. */
|
||||
class Blitter_32bppAnim FINAL : public Blitter_32bppOptimized {
|
||||
private:
|
||||
uint8 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
|
||||
uint16 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
|
||||
int anim_buf_width; ///< The width of the animation buffer.
|
||||
int anim_buf_height; ///< The height of the animation buffer.
|
||||
Palette palette; ///< The current palette.
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
|
||||
|
||||
/* virtual */ const char *GetName() { return "32bpp-anim"; }
|
||||
/* virtual */ int GetBytesPerPixel() { return 5; }
|
||||
/* virtual */ int GetBytesPerPixel() { return 6; }
|
||||
/* virtual */ void PostResize();
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "base.hpp"
|
||||
#include "../core/bitmath_func.hpp"
|
||||
#include "../core/math_func.hpp"
|
||||
#include "../gfx_func.h"
|
||||
|
||||
/** Base for all 32bpp blitters. */
|
||||
@@ -134,6 +135,33 @@ public:
|
||||
|
||||
return ComposeColour(0xFF, colour, colour, colour);
|
||||
}
|
||||
|
||||
static const int DEFAULT_BRIGHTNESS = 64;
|
||||
|
||||
static inline uint32 AdjustBrightness(uint32 colour, uint8 brightness)
|
||||
{
|
||||
/* Shortcut for normal brightness */
|
||||
if (brightness == DEFAULT_BRIGHTNESS) return colour;
|
||||
|
||||
uint16 ob = 0;
|
||||
uint16 r = GB(colour, 16, 8) * brightness / DEFAULT_BRIGHTNESS;
|
||||
uint16 g = GB(colour, 8, 8) * brightness / DEFAULT_BRIGHTNESS;
|
||||
uint16 b = GB(colour, 0, 8) * brightness / DEFAULT_BRIGHTNESS;
|
||||
|
||||
/* Sum overbright */
|
||||
if (r > 255) ob += r - 255;
|
||||
if (g > 255) ob += g - 255;
|
||||
if (b > 255) ob += b - 255;
|
||||
|
||||
if (ob == 0) return ComposeColour(GB(colour, 24, 8), r, g, b);
|
||||
|
||||
/* Reduce overbright strength */
|
||||
ob /= 2;
|
||||
return ComposeColour(GB(colour, 24, 8),
|
||||
r >= 255 ? 255 : min(r + ob * (255 - r) / 256, 255),
|
||||
g >= 255 ? 255 : min(g + ob * (255 - g) / 256, 255),
|
||||
b >= 255 ? 255 : min(b + ob * (255 - b) / 256, 255));
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* BLITTER_32BPP_BASE_HPP */
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "../stdafx.h"
|
||||
#include "../zoom_func.h"
|
||||
#include "../settings_type.h"
|
||||
#include "../core/math_func.hpp"
|
||||
#include "32bpp_optimized.hpp"
|
||||
|
||||
/** Instantiation of the optimized 32bpp blitter factory. */
|
||||
@@ -36,12 +35,12 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
/* src_n : each line begins with uint32 n = 'number of bytes in this line',
|
||||
* then interleaved stream of 'm' and 'n' channels. 'm' is remap,
|
||||
* 'n' is number of bytes with the same alpha channel class */
|
||||
const uint8 *src_n = (const uint8 *)(src->data + src->offset[zoom][1]);
|
||||
const uint16 *src_n = (const uint16 *)(src->data + src->offset[zoom][1]);
|
||||
|
||||
/* skip upper lines in src_px and src_n */
|
||||
for (uint i = bp->skip_top; i != 0; i--) {
|
||||
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
||||
src_n += *(const uint32 *)src_n;
|
||||
src_n = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
|
||||
}
|
||||
|
||||
/* skip lines in dst */
|
||||
@@ -59,8 +58,8 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
src_px++;
|
||||
|
||||
/* next src_n line begins here */
|
||||
const uint8 *src_n_ln = src_n + *(const uint32 *)src_n;
|
||||
src_n += 4;
|
||||
const uint16 *src_n_ln = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
|
||||
src_n += 2;
|
||||
|
||||
/* we will end this line when we reach this point */
|
||||
uint32 *dst_end = dst + bp->skip_left;
|
||||
@@ -119,8 +118,8 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
if (m == 0) {
|
||||
*dst = src_px->data;
|
||||
} else {
|
||||
uint r = remap[m];
|
||||
if (r != 0) *dst = this->LookupColourInPalette(r);
|
||||
uint r = remap[GB(m, 0, 8)];
|
||||
if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
|
||||
}
|
||||
dst++;
|
||||
src_px++;
|
||||
@@ -132,8 +131,8 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
if (m == 0) {
|
||||
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
|
||||
} else {
|
||||
uint r = remap[m];
|
||||
if (r != 0) *dst = ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, *dst);
|
||||
uint r = remap[GB(m, 0, 8)];
|
||||
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
|
||||
}
|
||||
dst++;
|
||||
src_px++;
|
||||
@@ -270,7 +269,7 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
|
||||
*
|
||||
* it has to be stored in one stream so fewer registers are used -
|
||||
* x86 has problems with register allocation even with this solution */
|
||||
uint8 *dst_n_orig[ZOOM_LVL_COUNT];
|
||||
uint16 *dst_n_orig[ZOOM_LVL_COUNT];
|
||||
|
||||
/* lengths of streams */
|
||||
uint32 lengths[ZOOM_LVL_COUNT][2];
|
||||
@@ -293,7 +292,7 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
|
||||
uint size = src_orig->height * src_orig->width;
|
||||
|
||||
dst_px_orig[z] = CallocT<Colour>(size + src_orig->height * 2);
|
||||
dst_n_orig[z] = CallocT<uint8>(size * 2 + src_orig->height * 4 * 2);
|
||||
dst_n_orig[z] = CallocT<uint16>(size * 2 + src_orig->height * 4 * 2);
|
||||
|
||||
uint32 *dst_px_ln = (uint32 *)dst_px_orig[z];
|
||||
uint32 *dst_n_ln = (uint32 *)dst_n_orig[z];
|
||||
@@ -302,9 +301,9 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
|
||||
|
||||
for (uint y = src_orig->height; y > 0; y--) {
|
||||
Colour *dst_px = (Colour *)(dst_px_ln + 1);
|
||||
uint8 *dst_n = (uint8 *)(dst_n_ln + 1);
|
||||
uint16 *dst_n = (uint16 *)(dst_n_ln + 1);
|
||||
|
||||
uint8 *dst_len = dst_n++;
|
||||
uint16 *dst_len = dst_n++;
|
||||
|
||||
uint last = 3;
|
||||
int len = 0;
|
||||
@@ -313,7 +312,7 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
|
||||
uint8 a = src->a;
|
||||
uint t = a > 0 && a < 255 ? 1 : a;
|
||||
|
||||
if (last != t || len == 255) {
|
||||
if (last != t || len == 65535) {
|
||||
if (last != 3) {
|
||||
*dst_len = len;
|
||||
dst_len = dst_n++;
|
||||
@@ -328,8 +327,15 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
|
||||
dst_px->a = a;
|
||||
*dst_n = src->m;
|
||||
if (src->m != 0) {
|
||||
/* Get brightest value */
|
||||
uint8 rgb_max = max(src->r, max(src->g, src->b));
|
||||
|
||||
/* Black pixel (8bpp or old 32bpp image), so use default value */
|
||||
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
|
||||
*dst_n |= rgb_max << 8;
|
||||
|
||||
/* Pre-convert the mapping channel to a RGB value */
|
||||
uint32 colour = this->LookupColourInPalette(src->m);
|
||||
uint32 colour = this->AdjustBrightness(this->LookupColourInPalette(src->m), rgb_max);
|
||||
dst_px->r = GB(colour, 16, 8);
|
||||
dst_px->g = GB(colour, 8, 8);
|
||||
dst_px->b = GB(colour, 0, 8);
|
||||
@@ -354,7 +360,7 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
|
||||
}
|
||||
|
||||
dst_px = (Colour *)AlignPtr(dst_px, 4);
|
||||
dst_n = (uint8 *)AlignPtr(dst_n, 4);
|
||||
dst_n = (uint16 *)AlignPtr(dst_n, 4);
|
||||
|
||||
*dst_px_ln = (uint8 *)dst_px - (uint8 *)dst_px_ln;
|
||||
*dst_n_ln = (uint8 *)dst_n - (uint8 *)dst_n_ln;
|
||||
|
||||
@@ -20,11 +20,11 @@ static FBlitter_32bppSimple iFBlitter_32bppSimple;
|
||||
|
||||
void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
const SpriteLoader::CommonPixel *src, *src_line;
|
||||
const Blitter_32bppSimple::Pixel *src, *src_line;
|
||||
uint32 *dst, *dst_line;
|
||||
|
||||
/* Find where to start reading in the source sprite */
|
||||
src_line = (const SpriteLoader::CommonPixel *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
|
||||
src_line = (const Blitter_32bppSimple::Pixel *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
|
||||
dst_line = (uint32 *)bp->dst + bp->top * bp->pitch + bp->left;
|
||||
|
||||
for (int y = 0; y < bp->height; y++) {
|
||||
@@ -41,7 +41,7 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
|
||||
if (src->m == 0) {
|
||||
if (src->a != 0) *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst);
|
||||
} else {
|
||||
if (bp->remap[src->m] != 0) *dst = ComposeColourPA(this->LookupColourInPalette(bp->remap[src->m]), src->a, *dst);
|
||||
if (bp->remap[src->m] != 0) *dst = ComposeColourPA(this->AdjustBrightness(this->LookupColourInPalette(bp->remap[src->m]), src->v), src->a, *dst);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -94,26 +94,42 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
|
||||
|
||||
Sprite *Blitter_32bppSimple::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
Sprite *dest_sprite;
|
||||
SpriteLoader::CommonPixel *dst;
|
||||
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width * sizeof(SpriteLoader::CommonPixel));
|
||||
Blitter_32bppSimple::Pixel *dst;
|
||||
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width * sizeof(*dst));
|
||||
|
||||
dest_sprite->height = sprite->height;
|
||||
dest_sprite->width = sprite->width;
|
||||
dest_sprite->x_offs = sprite->x_offs;
|
||||
dest_sprite->y_offs = sprite->y_offs;
|
||||
|
||||
dst = (SpriteLoader::CommonPixel *)dest_sprite->data;
|
||||
dst = (Blitter_32bppSimple::Pixel *)dest_sprite->data;
|
||||
SpriteLoader::CommonPixel *src = (SpriteLoader::CommonPixel *)sprite->data;
|
||||
|
||||
memcpy(dst, sprite->data, sprite->height * sprite->width * sizeof(SpriteLoader::CommonPixel));
|
||||
for (int i = 0; i < sprite->height * sprite->width; i++) {
|
||||
if (dst[i].m != 0) {
|
||||
if (src->m == 0) {
|
||||
dst[i].r = src->r;
|
||||
dst[i].g = src->g;
|
||||
dst[i].b = src->b;
|
||||
dst[i].a = src->a;
|
||||
dst[i].m = 0;
|
||||
dst[i].v = 0;
|
||||
} else {
|
||||
/* Get brightest value */
|
||||
uint8 rgb_max = max(src->r, max(src->g, src->b));
|
||||
|
||||
/* Black pixel (8bpp or old 32bpp image), so use default value */
|
||||
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
|
||||
dst[i].v = rgb_max;
|
||||
|
||||
/* Pre-convert the mapping channel to a RGB value */
|
||||
uint colour = this->LookupColourInPalette(dst[i].m);
|
||||
uint colour = this->AdjustBrightness(this->LookupColourInPalette(src->m), dst[i].v);
|
||||
dst[i].r = GB(colour, 16, 8);
|
||||
dst[i].g = GB(colour, 8, 8);
|
||||
dst[i].b = GB(colour, 0, 8);
|
||||
dst[i].a = src->a;
|
||||
dst[i].m = src->m;
|
||||
}
|
||||
src++;
|
||||
}
|
||||
|
||||
return dest_sprite;
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
|
||||
/** The most trivial 32 bpp blitter (without palette animation). */
|
||||
class Blitter_32bppSimple : public Blitter_32bppBase {
|
||||
struct Pixel {
|
||||
uint8 r; ///< Red-channel
|
||||
uint8 g; ///< Green-channel
|
||||
uint8 b; ///< Blue-channel
|
||||
uint8 a; ///< Alpha-channel
|
||||
uint8 m; ///< Remap-channel
|
||||
uint8 v; ///< Brightness-channel
|
||||
};
|
||||
public:
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE)
|
||||
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "fileio_func.h"
|
||||
#include "fontcache.h"
|
||||
#include "gfx_func.h"
|
||||
#include "network/network.h"
|
||||
@@ -25,7 +24,6 @@
|
||||
#include "strings_func.h"
|
||||
#include "video/video_driver.hpp"
|
||||
#include "window_func.h"
|
||||
#include "window_gui.h"
|
||||
|
||||
#include "widgets/bootstrap_widget.h"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "cargotype.h"
|
||||
#include "core/bitmath_func.hpp"
|
||||
#include "newgrf_cargo.h"
|
||||
#include "string_func.h"
|
||||
#include "strings_func.h"
|
||||
|
||||
+1
-38
@@ -18,18 +18,15 @@
|
||||
#include "saveload/saveload.h"
|
||||
#include "textbuf_gui.h"
|
||||
#include "window_gui.h"
|
||||
#include "newgrf.h"
|
||||
#include "string_func.h"
|
||||
#include "strings_func.h"
|
||||
#include "window_func.h"
|
||||
#include "rail_gui.h"
|
||||
#include "gui.h"
|
||||
#include "company_gui.h"
|
||||
#include "gamelog.h"
|
||||
|
||||
#include "widgets/cheat_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
|
||||
|
||||
@@ -87,26 +84,6 @@ static int32 ClickSetProdCheat(int32 p1, int32 p2)
|
||||
return _cheats.setup_prod.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle changing of climate.
|
||||
* @param p1 New climate.
|
||||
* @param p2 Unused.
|
||||
* @return New climate.
|
||||
*/
|
||||
static int32 ClickChangeClimateCheat(int32 p1, int32 p2)
|
||||
{
|
||||
if (p1 == -1) p1 = 3;
|
||||
if (p1 == 4) p1 = 0;
|
||||
_settings_game.game_creation.landscape = p1;
|
||||
|
||||
GamelogStartAction(GLAT_CHEAT);
|
||||
GamelogTestMode();
|
||||
ReloadNewGRFData();
|
||||
GamelogStopAction();
|
||||
|
||||
return _settings_game.game_creation.landscape;
|
||||
}
|
||||
|
||||
extern void EnginesMonthlyLoop();
|
||||
|
||||
/**
|
||||
@@ -140,7 +117,6 @@ enum CheatNumbers {
|
||||
CHT_CROSSINGTUNNELS, ///< Allow tunnels to cross each other.
|
||||
CHT_NO_JETCRASH, ///< Disable jet-airplane crashes.
|
||||
CHT_SETUP_PROD, ///< Allow manually editing of industry production.
|
||||
CHT_SWITCH_CLIMATE, ///< Switch climate.
|
||||
CHT_CHANGE_DATE, ///< Do time traveling.
|
||||
|
||||
CHT_NUM_CHEATS, ///< Number of cheats.
|
||||
@@ -173,7 +149,6 @@ static const CheatEntry _cheats_ui[] = {
|
||||
{SLE_BOOL, STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value, &_cheats.crossing_tunnels.been_used, NULL },
|
||||
{SLE_BOOL, STR_CHEAT_NO_JETCRASH, &_cheats.no_jetcrash.value, &_cheats.no_jetcrash.been_used, NULL },
|
||||
{SLE_BOOL, STR_CHEAT_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, &ClickSetProdCheat },
|
||||
{SLE_UINT8, STR_CHEAT_SWITCH_CLIMATE, &_settings_game.game_creation.landscape, &_cheats.switch_climate.been_used, &ClickChangeClimateCheat },
|
||||
{SLE_INT32, STR_CHEAT_CHANGE_DATE, &_cur_year, &_cheats.change_date.been_used, &ClickChangeDateCheat },
|
||||
};
|
||||
|
||||
@@ -222,7 +197,7 @@ struct CheatWindow : Window {
|
||||
case SLE_BOOL: {
|
||||
bool on = (*(bool*)ce->variable);
|
||||
|
||||
DrawFrameRect(button_left, y + 1, button_left + 20 - 1, y + FONT_HEIGHT_NORMAL - 1, on ? COLOUR_GREEN : COLOUR_RED, on ? FR_LOWERED : FR_NONE);
|
||||
DrawBoolButton(button_left, y, on, true);
|
||||
SetDParam(0, on ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
|
||||
break;
|
||||
}
|
||||
@@ -247,10 +222,6 @@ struct CheatWindow : Window {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set correct string for switch climate cheat */
|
||||
case STR_CHEAT_SWITCH_CLIMATE: val += STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE;
|
||||
/* FALL THROUGH */
|
||||
|
||||
default: SetDParam(0, val);
|
||||
}
|
||||
break;
|
||||
@@ -292,14 +263,6 @@ struct CheatWindow : Window {
|
||||
width = max(width, GetStringBoundingBox(ce->str).width + 10 + 10);
|
||||
break;
|
||||
|
||||
/* Set correct string for switch climate cheat */
|
||||
case STR_CHEAT_SWITCH_CLIMATE:
|
||||
for (StringID i = STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE; i <= STR_CHEAT_SWITCH_CLIMATE_TOYLAND_LANDSCAPE; i++) {
|
||||
SetDParam(0, i);
|
||||
width = max(width, GetStringBoundingBox(ce->str).width);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
SetDParam(0, INT64_MAX);
|
||||
width = max(width, GetStringBoundingBox(ce->str).width);
|
||||
|
||||
+2
-2
@@ -32,10 +32,10 @@ struct Cheats {
|
||||
Cheat crossing_tunnels; ///< allow tunnels that cross each other
|
||||
Cheat dummy1; ///< empty cheat (build while in pause mode)
|
||||
Cheat no_jetcrash; ///< no jet will crash on small airports anymore
|
||||
Cheat switch_climate; ///< change the climate of the map
|
||||
Cheat dummy2; ///< empty cheat (change the climate of the map)
|
||||
Cheat change_date; ///< changes date ingame
|
||||
Cheat setup_prod; ///< setup raw-material production in game
|
||||
Cheat dummy2; ///< empty cheat (enable running el-engines on normal rail)
|
||||
Cheat dummy3; ///< empty cheat (enable running el-engines on normal rail)
|
||||
};
|
||||
|
||||
extern Cheats _cheats;
|
||||
|
||||
+1
-4
@@ -14,9 +14,6 @@
|
||||
#include "command_func.h"
|
||||
#include "landscape.h"
|
||||
#include "genworld.h"
|
||||
#include "landscape_type.h"
|
||||
#include "clear_func.h"
|
||||
#include "economy_func.h"
|
||||
#include "viewport_func.h"
|
||||
#include "water.h"
|
||||
#include "core/random_func.hpp"
|
||||
@@ -259,7 +256,7 @@ static void TileLoop_Clear(TileIndex tile)
|
||||
return;
|
||||
}
|
||||
}
|
||||
AmbientSoundEffectCallback(tile);
|
||||
AmbientSoundEffect(tile);
|
||||
|
||||
switch (_settings_game.game_creation.landscape) {
|
||||
case LT_TROPIC: TileLoopClearDesert(tile); break;
|
||||
|
||||
+4
-2
@@ -17,9 +17,7 @@
|
||||
#include "network/network_type.h"
|
||||
#include "network/network.h"
|
||||
#include "genworld.h"
|
||||
#include "newgrf_storage.h"
|
||||
#include "strings_func.h"
|
||||
#include "gfx_func.h"
|
||||
#include "texteff.hpp"
|
||||
#include "town.h"
|
||||
#include "date_func.h"
|
||||
@@ -152,6 +150,8 @@ CommandProc CmdCompanyCtrl;
|
||||
CommandProc CmdCustomNewsItem;
|
||||
CommandProc CmdCreateGoal;
|
||||
CommandProc CmdRemoveGoal;
|
||||
CommandProc CmdGoalQuestion;
|
||||
CommandProc CmdGoalQuestionAnswer;
|
||||
|
||||
CommandProc CmdLevelLand;
|
||||
|
||||
@@ -290,6 +290,8 @@ static const Command _command_proc_table[] = {
|
||||
DEF_CMD(CmdCustomNewsItem, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CUSTOM_NEWS_ITEM
|
||||
DEF_CMD(CmdCreateGoal, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CREATE_GOAL
|
||||
DEF_CMD(CmdRemoveGoal, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_GOAL
|
||||
DEF_CMD(CmdGoalQuestion, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_GOAL_QUESTION
|
||||
DEF_CMD(CmdGoalQuestionAnswer, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_GOAL_QUESTION_ANSWER
|
||||
|
||||
DEF_CMD(CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once
|
||||
|
||||
|
||||
+6
-3
@@ -266,6 +266,8 @@ enum Commands {
|
||||
CMD_CUSTOM_NEWS_ITEM, ///< create a custom news message
|
||||
CMD_CREATE_GOAL, ///< create a new goal
|
||||
CMD_REMOVE_GOAL, ///< remove a goal
|
||||
CMD_GOAL_QUESTION, ///< ask a goal related question
|
||||
CMD_GOAL_QUESTION_ANSWER, ///< answer(s) to CMD_GOAL_QUESTION
|
||||
CMD_LEVEL_LAND, ///< level land
|
||||
|
||||
CMD_BUILD_LOCK, ///< build a lock
|
||||
@@ -318,9 +320,10 @@ enum DoCommandFlag {
|
||||
DC_NO_TEST_TOWN_RATING = 0x020, ///< town rating does not disallow you from building
|
||||
DC_BANKRUPT = 0x040, ///< company bankrupts, skip money check, skip vehicle on tile check in some cases
|
||||
DC_AUTOREPLACE = 0x080, ///< autoreplace/autorenew is in progress, this shall disable vehicle limits when building, and ignore certain restrictions when undoing things (like vehicle attach callback)
|
||||
DC_ALL_TILES = 0x100, ///< allow this command also on MP_VOID tiles
|
||||
DC_NO_MODIFY_TOWN_RATING = 0x200, ///< do not change town rating
|
||||
DC_FORCE_CLEAR_TILE = 0x400, ///< do not only remove the object on the tile, but also clear any water left on it
|
||||
DC_NO_CARGO_CAP_CHECK = 0x100, ///< when autoreplace/autorenew is in progress, this shall prevent truncating the amount of cargo in the vehicle to prevent testing the command to remove cargo
|
||||
DC_ALL_TILES = 0x200, ///< allow this command also on MP_VOID tiles
|
||||
DC_NO_MODIFY_TOWN_RATING = 0x400, ///< do not change town rating
|
||||
DC_FORCE_CLEAR_TILE = 0x800, ///< do not only remove the object on the tile, but also clear any water left on it
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(DoCommandFlag)
|
||||
|
||||
|
||||
@@ -12,12 +12,9 @@
|
||||
#ifndef COMPANY_BASE_H
|
||||
#define COMPANY_BASE_H
|
||||
|
||||
#include "core/pool_type.hpp"
|
||||
#include "road_type.h"
|
||||
#include "rail_type.h"
|
||||
#include "livery.h"
|
||||
#include "autoreplace_type.h"
|
||||
#include "economy_type.h"
|
||||
#include "tile_type.h"
|
||||
#include "settings_type.h"
|
||||
#include "group.h"
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@
|
||||
/** @file company_cmd.cpp Handling of companies. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "engine_base.h"
|
||||
#include "company_base.h"
|
||||
#include "company_func.h"
|
||||
#include "company_gui.h"
|
||||
@@ -33,7 +32,6 @@
|
||||
#include "settings_func.h"
|
||||
#include "vehicle_base.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "sprite.h"
|
||||
#include "smallmap_gui.h"
|
||||
#include "game/game.hpp"
|
||||
|
||||
@@ -112,6 +110,7 @@ void SetLocalCompany(CompanyID new_company)
|
||||
|
||||
/* ... and redraw the whole screen. */
|
||||
MarkWholeScreenDirty();
|
||||
InvalidateWindowClassesData(WC_SIGN_LIST, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "command_type.h"
|
||||
#include "company_type.h"
|
||||
#include "tile_type.h"
|
||||
#include "gfx_type.h"
|
||||
|
||||
bool MayCompanyTakeOver(CompanyID cbig, CompanyID small);
|
||||
|
||||
+1
-5
@@ -7,7 +7,7 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file company_gui.cpp Company related GUIs. */
|
||||
/** @file company_gui.cpp %Company related GUIs. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "error.h"
|
||||
@@ -20,17 +20,14 @@
|
||||
#include "network/network.h"
|
||||
#include "network/network_gui.h"
|
||||
#include "network/network_func.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "newgrf.h"
|
||||
#include "company_manager_face.h"
|
||||
#include "strings_func.h"
|
||||
#include "date_func.h"
|
||||
#include "widgets/dropdown_type.h"
|
||||
#include "tilehighlight_func.h"
|
||||
#include "sprite.h"
|
||||
#include "company_base.h"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "economy_func.h"
|
||||
#include "object_type.h"
|
||||
#include "rail.h"
|
||||
#include "engine_base.h"
|
||||
@@ -41,7 +38,6 @@
|
||||
|
||||
#include "widgets/company_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
/** Company GUI constants. */
|
||||
static const uint EXP_LINESPACE = 2; ///< Amount of vertical space for a horizontal (sub-)total line.
|
||||
|
||||
@@ -1245,7 +1245,7 @@ DEF_CONSOLE_CMD(ConStopAI)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Company::IsHumanID(company_id)) {
|
||||
if (Company::IsHumanID(company_id) || company_id == _local_company) {
|
||||
IConsoleWarning("Company is not controlled by an AI.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
/**
|
||||
* Simple pair of data. Both types have to be POD ("Plain Old Data")!
|
||||
* @tvar T Key type.
|
||||
* @tvar U Value type.
|
||||
* @tparam T Key type.
|
||||
* @tparam U Value type.
|
||||
*/
|
||||
template <typename T, typename U>
|
||||
struct SmallPair {
|
||||
@@ -32,9 +32,9 @@ struct SmallPair {
|
||||
/**
|
||||
* Implementation of simple mapping class. Both types have to be POD ("Plain Old Data")!
|
||||
* It has inherited accessors from SmallVector().
|
||||
* @tvar T Key type.
|
||||
* @tvar U Value type.
|
||||
* @tvar S Unit of allocation.
|
||||
* @tparam T Key type.
|
||||
* @tparam U Value type.
|
||||
* @tparam S Unit of allocation.
|
||||
*
|
||||
* @see SmallVector
|
||||
*/
|
||||
|
||||
+8
-7
@@ -15,25 +15,26 @@
|
||||
#include "date_type.h"
|
||||
#include "strings_type.h"
|
||||
|
||||
static const int CF_NOEURO = 0;
|
||||
static const int CF_ISEURO = 1;
|
||||
static const uint NUM_CURRENCY = 29;
|
||||
static const int CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1;
|
||||
static const int CF_NOEURO = 0; ///< Currency never switches to the Euro (as far as known).
|
||||
static const int CF_ISEURO = 1; ///< Currency _is_ the Euro.
|
||||
static const uint NUM_CURRENCY = 29; ///< Number of currencies.
|
||||
static const int CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1; ///< Index of the custom currency.
|
||||
|
||||
/** Specification of a currency. */
|
||||
struct CurrencySpec {
|
||||
uint16 rate;
|
||||
char separator[8];
|
||||
Year to_euro;
|
||||
Year to_euro; ///< %Year of switching to the Euro. May also be #CF_NOEURO or #CF_ISEURO.
|
||||
char prefix[16];
|
||||
char suffix[16];
|
||||
/**
|
||||
* The currency symbol is represented by two possible values, prefix and suffix
|
||||
* Usage of one or the other is determined by symbol_pos.
|
||||
* Usage of one or the other is determined by #symbol_pos.
|
||||
* 0 = prefix
|
||||
* 1 = suffix
|
||||
* 2 = both : Special case only for custom currency.
|
||||
* It is not a spec from Newgrf,
|
||||
* rather a way to let users do what they want with custom curency
|
||||
* rather a way to let users do what they want with custom currency
|
||||
*/
|
||||
byte symbol_pos;
|
||||
StringID name;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "widgets/dropdown_type.h"
|
||||
#include "widgets/date_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
/** Window to select a date graphically by using dropdowns */
|
||||
struct SetDateWindow : Window {
|
||||
|
||||
@@ -149,13 +149,13 @@ enum Token {
|
||||
TOKEN_ELSE, ///< (#)else in code
|
||||
TOKEN_ENDIF, ///< (#)endif in code
|
||||
TOKEN_UNDEF, ///< (#)undef in code
|
||||
TOKEN_OR, ///< '||' within #if expression
|
||||
TOKEN_AND, ///< '&&' within #if expression
|
||||
TOKEN_DEFINED, ///< 'defined' within #if expression
|
||||
TOKEN_OPEN, ///< '(' within #if expression
|
||||
TOKEN_CLOSE, ///< ')' within #if expression
|
||||
TOKEN_NOT, ///< '!' within #if expression
|
||||
TOKEN_ZERO, ///< '0' within #if expression
|
||||
TOKEN_OR, ///< '||' within <tt>#if</tt> expression
|
||||
TOKEN_AND, ///< '&&' within <tt>#if</tt> expression
|
||||
TOKEN_DEFINED, ///< 'defined' within <tt>#if</tt> expression
|
||||
TOKEN_OPEN, ///< '(' within <tt>#if</tt> expression
|
||||
TOKEN_CLOSE, ///< ')' within <tt>#if</tt> expression
|
||||
TOKEN_NOT, ///< '!' within <tt>#if</tt> expression
|
||||
TOKEN_ZERO, ///< '0' within <tt>#if</tt> expression
|
||||
TOKEN_INCLUDE, ///< (#)include in code
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file depot_cmd.cpp Command Handling for depots. */
|
||||
/** @file depot_cmd.cpp %Command Handling for depots. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "command_func.h"
|
||||
|
||||
+1
-3
@@ -12,10 +12,8 @@
|
||||
#ifndef DEPOT_FUNC_H
|
||||
#define DEPOT_FUNC_H
|
||||
|
||||
#include "tile_type.h"
|
||||
#include "vehicle_type.h"
|
||||
#include "direction_type.h"
|
||||
#include "slope_type.h"
|
||||
#include "slope_func.h"
|
||||
|
||||
void ShowDepotWindow(TileIndex tile, VehicleType type);
|
||||
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
#include "viewport_func.h"
|
||||
#include "command_func.h"
|
||||
#include "depot_base.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "spritecache.h"
|
||||
#include "strings_func.h"
|
||||
#include "window_func.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "company_func.h"
|
||||
#include "tilehighlight_func.h"
|
||||
|
||||
@@ -149,8 +149,7 @@ static void InitializeDisasterVehicle(DisasterVehicle *v, int x, int y, int z, D
|
||||
v->current_order.Free();
|
||||
|
||||
DisasterVehicleUpdateImage(v);
|
||||
VehicleMove(v, false);
|
||||
MarkSingleVehicleDirty(v);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
}
|
||||
|
||||
static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, int z)
|
||||
@@ -161,7 +160,7 @@ static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, int z)
|
||||
v->tile = TileVirtXY(x, y);
|
||||
|
||||
DisasterVehicleUpdateImage(v);
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
|
||||
DisasterVehicle *u = v->Next();
|
||||
if (u != NULL) {
|
||||
@@ -175,13 +174,13 @@ static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, int z)
|
||||
u->direction = v->direction;
|
||||
|
||||
DisasterVehicleUpdateImage(u);
|
||||
VehicleMove(u, true);
|
||||
VehicleUpdatePositionAndViewport(u);
|
||||
|
||||
if ((u = u->Next()) != NULL) {
|
||||
u->x_pos = x;
|
||||
u->y_pos = y;
|
||||
u->z_pos = z + 5;
|
||||
VehicleMove(u, true);
|
||||
VehicleUpdatePositionAndViewport(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -479,7 +478,7 @@ static bool DisasterTick_Helicopter_Rotors(DisasterVehicle *v)
|
||||
|
||||
if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1;
|
||||
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "station_gui.h"
|
||||
#include "command_func.h"
|
||||
#include "water.h"
|
||||
#include "water_map.h"
|
||||
#include "window_func.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "sound_func.h"
|
||||
@@ -25,9 +24,7 @@
|
||||
#include "slope_func.h"
|
||||
#include "tilehighlight_func.h"
|
||||
#include "company_base.h"
|
||||
#include "station_type.h"
|
||||
#include "hotkeys.h"
|
||||
#include "bridge.h"
|
||||
|
||||
#include "widgets/dock_widget.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "news_func.h"
|
||||
#include "network/network.h"
|
||||
#include "network/network_func.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "ai/ai.hpp"
|
||||
#include "aircraft.h"
|
||||
#include "newgrf_engine.h"
|
||||
@@ -29,9 +28,7 @@
|
||||
#include "newgrf_station.h"
|
||||
#include "newgrf_airporttiles.h"
|
||||
#include "object.h"
|
||||
#include "group.h"
|
||||
#include "strings_func.h"
|
||||
#include "window_func.h"
|
||||
#include "date_func.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "sound_func.h"
|
||||
@@ -44,7 +41,6 @@
|
||||
#include "waypoint_base.h"
|
||||
#include "economy_base.h"
|
||||
#include "core/pool_func.hpp"
|
||||
#include "newgrf.h"
|
||||
#include "core/backup_type.hpp"
|
||||
#include "water.h"
|
||||
#include "game/game.hpp"
|
||||
|
||||
+13
-15
@@ -19,7 +19,6 @@
|
||||
#include "effectvehicle_func.h"
|
||||
#include "effectvehicle_base.h"
|
||||
|
||||
#include "table/sprites.h"
|
||||
|
||||
static void ChimneySmokeInit(EffectVehicle *v)
|
||||
{
|
||||
@@ -45,7 +44,7 @@ static bool ChimneySmokeTick(EffectVehicle *v)
|
||||
v->cur_image = SPR_CHIMNEY_SMOKE_0;
|
||||
}
|
||||
v->progress = 7;
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -78,7 +77,7 @@ static bool SteamSmokeTick(EffectVehicle *v)
|
||||
moved = true;
|
||||
}
|
||||
|
||||
if (moved) VehicleMove(v, true);
|
||||
if (moved) VehicleUpdatePositionAndViewport(v);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -95,11 +94,11 @@ static bool DieselSmokeTick(EffectVehicle *v)
|
||||
|
||||
if ((v->progress & 3) == 0) {
|
||||
v->z_pos++;
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
} else if ((v->progress & 7) == 1) {
|
||||
if (v->cur_image != SPR_DIESEL_SMOKE_5) {
|
||||
v->cur_image++;
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
} else {
|
||||
delete v;
|
||||
return false;
|
||||
@@ -123,7 +122,7 @@ static bool ElectricSparkTick(EffectVehicle *v)
|
||||
v->progress = 0;
|
||||
if (v->cur_image != SPR_ELECTRIC_SPARK_5) {
|
||||
v->cur_image++;
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
} else {
|
||||
delete v;
|
||||
return false;
|
||||
@@ -160,7 +159,7 @@ static bool SmokeTick(EffectVehicle *v)
|
||||
moved = true;
|
||||
}
|
||||
|
||||
if (moved) VehicleMove(v, true);
|
||||
if (moved) VehicleUpdatePositionAndViewport(v);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -177,7 +176,7 @@ static bool ExplosionLargeTick(EffectVehicle *v)
|
||||
if ((v->progress & 3) == 0) {
|
||||
if (v->cur_image != SPR_EXPLOSION_LARGE_F) {
|
||||
v->cur_image++;
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
} else {
|
||||
delete v;
|
||||
return false;
|
||||
@@ -202,7 +201,7 @@ static bool BreakdownSmokeTick(EffectVehicle *v)
|
||||
} else {
|
||||
v->cur_image = SPR_BREAKDOWN_SMOKE_0;
|
||||
}
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
}
|
||||
|
||||
v->animation_state--;
|
||||
@@ -226,7 +225,7 @@ static bool ExplosionSmallTick(EffectVehicle *v)
|
||||
if ((v->progress & 3) == 0) {
|
||||
if (v->cur_image != SPR_EXPLOSION_SMALL_B) {
|
||||
v->cur_image++;
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
} else {
|
||||
delete v;
|
||||
return false;
|
||||
@@ -303,7 +302,7 @@ static bool BulldozerTick(EffectVehicle *v)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -476,7 +475,7 @@ static bool BubbleTick(EffectVehicle *v)
|
||||
if (v->spritenum == 0) {
|
||||
v->cur_image++;
|
||||
if (v->cur_image < SPR_BUBBLE_GENERATE_3) {
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
return true;
|
||||
}
|
||||
if (v->animation_substate != 0) {
|
||||
@@ -522,7 +521,7 @@ static bool BubbleTick(EffectVehicle *v)
|
||||
v->z_pos += b->z;
|
||||
v->cur_image = SPR_BUBBLE_0 + b->image;
|
||||
|
||||
VehicleMove(v, true);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -606,8 +605,7 @@ EffectVehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type)
|
||||
|
||||
_effect_init_procs[type](v);
|
||||
|
||||
VehicleMove(v, false);
|
||||
MarkSingleVehicleDirty(v);
|
||||
VehicleUpdatePositionAndViewport(v);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define EFFECTVEHICLE_BASE_H
|
||||
|
||||
#include "vehicle_base.h"
|
||||
#include "transparency.h"
|
||||
|
||||
/**
|
||||
* A special vehicle is one of the following:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "aircraft.h"
|
||||
#include "newgrf.h"
|
||||
#include "newgrf_engine.h"
|
||||
#include "group.h"
|
||||
#include "strings_func.h"
|
||||
#include "core/random_func.hpp"
|
||||
#include "window_func.h"
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
#ifndef ENGINE_BASE_H
|
||||
#define ENGINE_BASE_H
|
||||
|
||||
#include "company_type.h"
|
||||
#include "engine_type.h"
|
||||
#include "vehicle_type.h"
|
||||
#include "core/pool_type.hpp"
|
||||
#include "core/smallvec_type.hpp"
|
||||
#include "newgrf_commons.h"
|
||||
|
||||
typedef Pool<Engine, EngineID, 64, 64000> EnginePool;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "window_gui.h"
|
||||
#include "gfx_func.h"
|
||||
#include "engine_base.h"
|
||||
#include "command_func.h"
|
||||
#include "strings_func.h"
|
||||
|
||||
+5
-4
@@ -7,7 +7,7 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file engine_gui.h Engine GUI functions, used by build_vehicle_gui and autoreplace_gui */
|
||||
/** @file engine_gui.h %Engine GUI functions, used by build_vehicle_gui and autoreplace_gui */
|
||||
|
||||
#ifndef ENGINE_GUI_H
|
||||
#define ENGINE_GUI_H
|
||||
@@ -15,12 +15,13 @@
|
||||
#include "engine_type.h"
|
||||
#include "sortlist_type.h"
|
||||
#include "gfx_type.h"
|
||||
#include "vehicle_type.h"
|
||||
|
||||
typedef GUIList<EngineID, CargoID> GUIEngineList;
|
||||
|
||||
typedef int CDECL EngList_SortTypeFunction(const EngineID*, const EngineID*); ///< argument type for EngList_Sort()
|
||||
void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare); ///< sort of the engine list
|
||||
void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items); ///< sort of specified portion of the engine list
|
||||
typedef int CDECL EngList_SortTypeFunction(const EngineID*, const EngineID*); ///< argument type for #EngList_Sort.
|
||||
void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare);
|
||||
void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items);
|
||||
|
||||
StringID GetEngineCategoryName(EngineID engine);
|
||||
StringID GetEngineInfoString(EngineID engine);
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@ enum Subdirectory {
|
||||
BASESET_DIR, ///< Subdirectory for all base data (base sets, intro game)
|
||||
NEWGRF_DIR, ///< Subdirectory for all NewGRFs
|
||||
LANG_DIR, ///< Subdirectory for all translation files
|
||||
AI_DIR, ///< Subdirectory for all AI files
|
||||
AI_LIBRARY_DIR,///< Subdirectory for all AI libraries
|
||||
AI_DIR, ///< Subdirectory for all %AI files
|
||||
AI_LIBRARY_DIR,///< Subdirectory for all %AI libraries
|
||||
GAME_DIR, ///< Subdirectory for all game scripts
|
||||
GAME_LIBRARY_DIR, ///< Subdirectory for all GS libraries
|
||||
NUM_SUBDIRS, ///< Number of subdirectories
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../settings_type.h"
|
||||
#include "../core/random_func.hpp"
|
||||
#include "game.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "game_info.hpp"
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
/** @file game_core.cpp Implementation of Game. */
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../command_func.h"
|
||||
#include "../core/backup_type.hpp"
|
||||
#include "../core/bitmath_func.hpp"
|
||||
#include "../company_base.h"
|
||||
#include "../company_func.h"
|
||||
#include "../network/network.h"
|
||||
#include "../window_func.h"
|
||||
#include "../fileio_func.h"
|
||||
#include "game.hpp"
|
||||
#include "game_scanner.hpp"
|
||||
#include "game_config.hpp"
|
||||
@@ -97,6 +94,7 @@
|
||||
|
||||
delete Game::instance;
|
||||
Game::instance = NULL;
|
||||
Game::info = NULL;
|
||||
|
||||
cur_company.Restore();
|
||||
|
||||
@@ -155,6 +153,7 @@
|
||||
if (Game::instance != NULL) {
|
||||
delete Game::instance;
|
||||
Game::instance = NULL;
|
||||
Game::info = NULL;
|
||||
}
|
||||
} else if (Game::instance != NULL) {
|
||||
Game::info = _settings_game.game_config->GetInfo();
|
||||
@@ -178,7 +177,7 @@
|
||||
|
||||
InvalidateWindowData(WC_AI_LIST, 0, 1);
|
||||
SetWindowClassesDirty(WC_AI_DEBUG);
|
||||
SetWindowDirty(WC_AI_SETTINGS, 0);
|
||||
InvalidateWindowClassesData(WC_AI_SETTINGS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,14 +11,10 @@
|
||||
|
||||
#include "../stdafx.h"
|
||||
|
||||
#include "../script/squirrel_helper.hpp"
|
||||
#include "../script/squirrel_class.hpp"
|
||||
#include "game_info.hpp"
|
||||
#include "game_scanner.hpp"
|
||||
#include "../settings_type.h"
|
||||
#include "../debug.h"
|
||||
#include "../rev.h"
|
||||
#include "game.hpp"
|
||||
|
||||
/**
|
||||
* Check if the API version provided by the Game is supported.
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#define GAME_INFO_HPP
|
||||
|
||||
#include "../script/script_info.hpp"
|
||||
#include "../script/script_config.hpp"
|
||||
|
||||
/** All static information from an Game like name, version, etc. */
|
||||
class GameInfo : public ScriptInfo {
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
/** @file game_instance.cpp Implementation of GameInstance. */
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../debug.h"
|
||||
#include "../saveload/saveload.h"
|
||||
#include "../error.h"
|
||||
|
||||
#include "../script/squirrel_class.hpp"
|
||||
|
||||
#include "../script/script_storage.hpp"
|
||||
#include "../ai/ai_gui.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "game_info.hpp"
|
||||
#include "game_instance.hpp"
|
||||
@@ -126,6 +126,7 @@ void GameInstance::RegisterAPI()
|
||||
SQGSEventCompanyMerger_Register(this->engine);
|
||||
SQGSEventCompanyNew_Register(this->engine);
|
||||
SQGSEventController_Register(this->engine);
|
||||
SQGSEventGoalQuestionAnswer_Register(this->engine);
|
||||
SQGSEventIndustryClose_Register(this->engine);
|
||||
SQGSEventIndustryOpen_Register(this->engine);
|
||||
SQGSEventStationFirstVehicle_Register(this->engine);
|
||||
@@ -196,6 +197,23 @@ ScriptInfo *GameInstance::FindLibrary(const char *library, int version)
|
||||
return (ScriptInfo *)Game::FindLibrary(library, version);
|
||||
}
|
||||
|
||||
void GameInstance::Died()
|
||||
{
|
||||
ScriptInstance::Died();
|
||||
|
||||
ShowAIDebugWindow(OWNER_DEITY);
|
||||
|
||||
const GameInfo *info = Game::GetInfo();
|
||||
if (info != NULL) {
|
||||
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);
|
||||
|
||||
if (info->GetURL() != NULL) {
|
||||
ScriptLog::Info("Please report the error to the following URL:");
|
||||
ScriptLog::Info(info->GetURL());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DoCommand callback function for all commands executed by Game Scripts.
|
||||
* @param result The result of the command.
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
|
||||
private:
|
||||
/* virtual */ void RegisterAPI();
|
||||
/* virtual */ void Died();
|
||||
/* virtual */ CommandCallback *GetDoCommandCallback();
|
||||
/* virtual */ void LoadDummyScript() {}
|
||||
};
|
||||
|
||||
@@ -10,15 +10,10 @@
|
||||
/** @file game_scanner.cpp allows scanning Game scripts */
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../debug.h"
|
||||
#include "../fileio_func.h"
|
||||
#include "../network/network.h"
|
||||
#include "../core/random_func.hpp"
|
||||
|
||||
#include "../script/squirrel_class.hpp"
|
||||
#include "game_info.hpp"
|
||||
#include "game_scanner.hpp"
|
||||
#include "../script/api/script_controller.hpp"
|
||||
|
||||
|
||||
void GameScannerInfo::Initialize()
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
/** @file game_text.cpp Implementation of handling translated strings. */
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../language.h"
|
||||
#include "../strgen/strgen.h"
|
||||
#include "../debug.h"
|
||||
#include "../fileio_func.h"
|
||||
@@ -21,7 +20,6 @@
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include <exception>
|
||||
#include <stdarg.h>
|
||||
|
||||
void CDECL strgen_warning(const char *s, ...)
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
#include "network/network.h"
|
||||
#include "heightmap.h"
|
||||
#include "viewport_func.h"
|
||||
#include "gfx_func.h"
|
||||
#include "date_func.h"
|
||||
#include "engine_func.h"
|
||||
#include "newgrf_storage.h"
|
||||
#include "water.h"
|
||||
#include "video/video_driver.hpp"
|
||||
#include "tilehighlight_func.h"
|
||||
@@ -36,7 +34,6 @@
|
||||
#include "game/game.hpp"
|
||||
#include "game/game_instance.hpp"
|
||||
|
||||
#include "table/sprites.h"
|
||||
|
||||
void GenerateClearTile();
|
||||
void GenerateIndustries();
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "string_func.h"
|
||||
#include "widgets/dropdown_type.h"
|
||||
#include "widgets/dropdown_func.h"
|
||||
#include "landscape_type.h"
|
||||
#include "querystring_gui.h"
|
||||
#include "town.h"
|
||||
#include "settings_func.h"
|
||||
@@ -33,8 +32,6 @@
|
||||
|
||||
#include "widgets/genworld_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
|
||||
extern void MakeNewgameSettingsLive();
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "settings_type.h"
|
||||
#include "network/network.h"
|
||||
#include "network/network_func.h"
|
||||
#include "thread/thread.h"
|
||||
#include "window_func.h"
|
||||
#include "newgrf_debug.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "base_media_func.h"
|
||||
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
/** Whether the given NewGRFs must get a palette remap from windows to DOS or not. */
|
||||
bool _palette_remap_grf[MAX_FILE_SLOTS];
|
||||
|
||||
+64
-7
@@ -13,21 +13,16 @@
|
||||
#include "company_func.h"
|
||||
#include "industry.h"
|
||||
#include "town.h"
|
||||
#include "news_func.h"
|
||||
#include "ai/ai.hpp"
|
||||
#include "station_base.h"
|
||||
#include "cargotype.h"
|
||||
#include "strings_func.h"
|
||||
#include "window_func.h"
|
||||
#include "goal_base.h"
|
||||
#include "core/pool_func.hpp"
|
||||
#include "core/random_func.hpp"
|
||||
#include "game/game.hpp"
|
||||
#include "command_func.h"
|
||||
#include "company_base.h"
|
||||
#include "string_func.h"
|
||||
#include "gui.h"
|
||||
#include "network/network.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
GoalID _new_goal_id;
|
||||
|
||||
@@ -118,3 +113,65 @@ CommandCost CmdRemoveGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ask a goal related question
|
||||
* @param tile unused.
|
||||
* @param flags type of operation
|
||||
* @param p1 various bitstuffed elements
|
||||
* - p1 = (bit 0 - 15) - Unique ID to use for this question.
|
||||
* - p1 = (bit 16 - 23) - Company for which this question is.
|
||||
* @param p2 Buttons of the question.
|
||||
* @param text Text of the question.
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
uint16 uniqueid = (GoalType)GB(p1, 0, 16);
|
||||
CompanyID company = (CompanyID)GB(p1, 16, 8);
|
||||
|
||||
if (_current_company != OWNER_DEITY) return CMD_ERROR;
|
||||
if (StrEmpty(text)) return CMD_ERROR;
|
||||
if (company != INVALID_COMPANY && !Company::IsValidID(company)) return CMD_ERROR;
|
||||
if (CountBits(p2) < 1 || CountBits(p2) > 3) return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
if (company == _local_company || (company == INVALID_COMPANY && Company::IsValidID(_local_company))) ShowGoalQuestion(uniqueid, p2, text);
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reply to a goal question.
|
||||
* @param tile unused.
|
||||
* @param flags type of operation
|
||||
* @param p1 Unique ID to use for this question.
|
||||
* @param p2 Button the company pressed
|
||||
* @param text Text of the question.
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
{
|
||||
if (p1 > UINT16_MAX) return CMD_ERROR;
|
||||
if (p2 >= GOAL_QUESTION_BUTTON_COUNT) return CMD_ERROR;
|
||||
|
||||
if (_current_company == OWNER_DEITY) {
|
||||
/* It has been requested to close this specific question on all clients */
|
||||
if (flags & DC_EXEC) DeleteWindowById(WC_GOAL_QUESTION, p1);
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
if (_networking && _local_company == _current_company) {
|
||||
/* Somebody in the same company answered the question. Close the window */
|
||||
if (flags & DC_EXEC) DeleteWindowById(WC_GOAL_QUESTION, p1);
|
||||
if (!_network_server) return CommandCost();
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
Game::NewEvent(new ScriptEventGoalQuestionAnswer(p1, (ScriptCompany::CompanyID)(byte)_current_company, (ScriptGoal::QuestionButton)(1 << p2)));
|
||||
}
|
||||
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
+2
-3
@@ -7,17 +7,16 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file goal_base.h Goal base class. */
|
||||
/** @file goal_base.h %Goal base class. */
|
||||
|
||||
#ifndef GOAL_BASE_H
|
||||
#define GOAL_BASE_H
|
||||
|
||||
#include "cargo_type.h"
|
||||
#include "company_type.h"
|
||||
#include "goal_type.h"
|
||||
#include "core/pool_type.hpp"
|
||||
|
||||
typedef Pool<Goal, GoalID, 1, MAX_COMPANIES> GoalPool;
|
||||
typedef Pool<Goal, GoalID, 1, 256> GoalPool;
|
||||
extern GoalPool _goal_pool;
|
||||
|
||||
/** Struct about subsidies, offered and awarded */
|
||||
|
||||
+125
-2
@@ -16,11 +16,11 @@
|
||||
#include "strings_func.h"
|
||||
#include "date_func.h"
|
||||
#include "viewport_func.h"
|
||||
#include "gfx_func.h"
|
||||
#include "gui.h"
|
||||
#include "goal_base.h"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "company_func.h"
|
||||
#include "command_func.h"
|
||||
|
||||
#include "widgets/goal_widget.h"
|
||||
|
||||
@@ -247,8 +247,131 @@ static const WindowDesc _goals_list_desc(
|
||||
_nested_goals_list_widgets, lengthof(_nested_goals_list_widgets)
|
||||
);
|
||||
|
||||
|
||||
void ShowGoalsList()
|
||||
{
|
||||
AllocateWindowDescFront<GoalListWindow>(&_goals_list_desc, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct GoalQuestionWindow : Window {
|
||||
char *question;
|
||||
int buttons;
|
||||
int button[3];
|
||||
|
||||
GoalQuestionWindow(const WindowDesc *desc, WindowNumber window_number, uint32 button_mask, const char *question) : Window()
|
||||
{
|
||||
this->question = strdup(question);
|
||||
|
||||
/* Figure out which buttons we have to enable */
|
||||
int bit;
|
||||
int n = 0;
|
||||
FOR_EACH_SET_BIT(bit, button_mask) {
|
||||
if (bit >= GOAL_QUESTION_BUTTON_COUNT) break;
|
||||
this->button[n++] = bit;
|
||||
if (n == 3) break;
|
||||
}
|
||||
this->buttons = n;
|
||||
assert(this->buttons > 0 && this->buttons < 4);
|
||||
|
||||
this->CreateNestedTree(desc);
|
||||
this->GetWidget<NWidgetStacked>(WID_GQ_BUTTONS)->SetDisplayedPlane(this->buttons - 1);
|
||||
this->FinishInitNested(desc, window_number);
|
||||
}
|
||||
|
||||
~GoalQuestionWindow()
|
||||
{
|
||||
free(this->question);
|
||||
}
|
||||
|
||||
virtual void SetStringParameters(int widget) const
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GQ_BUTTON_1:
|
||||
SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[0]);
|
||||
break;
|
||||
|
||||
case WID_GQ_BUTTON_2:
|
||||
SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[1]);
|
||||
break;
|
||||
|
||||
case WID_GQ_BUTTON_3:
|
||||
SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[2]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget, int click_count)
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_GQ_BUTTON_1:
|
||||
DoCommandP(0, this->window_number, this->button[0], CMD_GOAL_QUESTION_ANSWER);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
case WID_GQ_BUTTON_2:
|
||||
DoCommandP(0, this->window_number, this->button[1], CMD_GOAL_QUESTION_ANSWER);
|
||||
delete this;
|
||||
break;
|
||||
|
||||
case WID_GQ_BUTTON_3:
|
||||
DoCommandP(0, this->window_number, this->button[2], CMD_GOAL_QUESTION_ANSWER);
|
||||
delete this;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
{
|
||||
if (widget != WID_GQ_QUESTION) return;
|
||||
|
||||
SetDParamStr(0, this->question);
|
||||
size->height = GetStringHeight(STR_JUST_RAW_STRING, size->width) + WD_PAR_VSEP_WIDE;
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
{
|
||||
if (widget != WID_GQ_QUESTION) return;
|
||||
|
||||
SetDParamStr(0, this->question);
|
||||
DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_JUST_RAW_STRING, TC_BLACK, SA_TOP | SA_HOR_CENTER);
|
||||
}
|
||||
};
|
||||
|
||||
static const NWidgetPart _nested_goal_question_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
|
||||
NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_GOAL_QUESTION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GQ_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GQ_BUTTONS),
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(85, 10, 85),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_1), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(65, 10, 65),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_1), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_2), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(25, 10, 25),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_1), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_2), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_3), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static const WindowDesc _goal_question_list_desc(
|
||||
WDP_CENTER, 0, 0,
|
||||
WC_GOAL_QUESTION, WC_NONE,
|
||||
WDF_CONSTRUCTION,
|
||||
_nested_goal_question_widgets, lengthof(_nested_goal_question_widgets)
|
||||
);
|
||||
|
||||
|
||||
void ShowGoalQuestion(uint16 id, uint32 button_mask, const char *question)
|
||||
{
|
||||
new GoalQuestionWindow(&_goal_question_list_desc, id, button_mask, question);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,12 @@
|
||||
#ifndef GOAL_TYPE_H
|
||||
#define GOAL_TYPE_H
|
||||
|
||||
#include "core/enum_type.hpp"
|
||||
|
||||
enum {
|
||||
GOAL_QUESTION_BUTTON_COUNT = 18, ///< Amount of buttons available.
|
||||
};
|
||||
|
||||
/** Types of goal destinations */
|
||||
enum GoalType {
|
||||
GT_NONE, ///< Destination is not linked
|
||||
|
||||
+1
-1
@@ -22,13 +22,13 @@
|
||||
#include "gfx_func.h"
|
||||
#include "sortlist_type.h"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "math.h"
|
||||
#include "currency.h"
|
||||
|
||||
#include "widgets/graph_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
#include <math.h>
|
||||
|
||||
/* Bitmasks of company and cargo indices that shouldn't be drawn. */
|
||||
static uint _legend_excluded_companies;
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "train.h"
|
||||
#include "roadveh.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "window_func.h"
|
||||
|
||||
/**
|
||||
* Recalculates the cached total power of a vehicle. Should be called when the consist is changed.
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "vehicle_gui.h"
|
||||
#include "landscape.h"
|
||||
#include "window_func.h"
|
||||
#include "widgets/vehicle_widget.h"
|
||||
|
||||
/** What is the status of our acceleration? */
|
||||
enum AccelStatus {
|
||||
@@ -226,10 +227,10 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
|
||||
/**
|
||||
* Checks if the vehicle is in a slope and sets the required flags in that case.
|
||||
* @param new_tile True if the vehicle reached a new tile.
|
||||
* @param turned Indicates if the vehicle has turned.
|
||||
* @param update_delta Indicates to also update the delta.
|
||||
* @return Old height of the vehicle.
|
||||
*/
|
||||
inline byte UpdateInclination(bool new_tile, bool turned)
|
||||
inline byte UpdateInclination(bool new_tile, bool update_delta)
|
||||
{
|
||||
byte old_z = this->z_pos;
|
||||
|
||||
@@ -239,7 +240,7 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
|
||||
this->UpdateZPosition();
|
||||
}
|
||||
|
||||
this->UpdateViewport(true, turned);
|
||||
this->UpdateViewport(true, update_delta);
|
||||
return old_z;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,8 @@
|
||||
#include "stdafx.h"
|
||||
#include "cmd_helper.h"
|
||||
#include "command_func.h"
|
||||
#include "group.h"
|
||||
#include "train.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "vehiclelist.h"
|
||||
#include "window_func.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "autoreplace_base.h"
|
||||
#include "autoreplace_func.h"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "command_func.h"
|
||||
#include "vehicle_gui.h"
|
||||
#include "vehicle_base.h"
|
||||
#include "group.h"
|
||||
#include "string_func.h"
|
||||
#include "strings_func.h"
|
||||
#include "window_func.h"
|
||||
@@ -29,7 +28,6 @@
|
||||
|
||||
#include "widgets/group_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
|
||||
typedef GUIList<const Group*> GUIGroupList;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "gfx_type.h"
|
||||
#include "economy_type.h"
|
||||
#include "tile_type.h"
|
||||
#include "strings_type.h"
|
||||
#include "transport_type.h"
|
||||
|
||||
struct Window;
|
||||
@@ -30,6 +29,7 @@ void ShowGameOptions();
|
||||
void ShowGameDifficulty();
|
||||
void ShowGameSettings();
|
||||
void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right);
|
||||
void DrawBoolButton(int x, int y, bool state, bool clickable);
|
||||
|
||||
/* train_gui.cpp */
|
||||
void ShowOrdersWindow(const Vehicle *v);
|
||||
@@ -53,6 +53,7 @@ void ShowTownDirectory();
|
||||
void ShowIndustryDirectory();
|
||||
void ShowSubsidiesList();
|
||||
void ShowGoalsList();
|
||||
void ShowGoalQuestion(uint16 id, uint32 button_mask, const char *question);
|
||||
|
||||
void ShowEstimatedCostOrIncome(Money cost, int x, int y);
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
static inline byte RGBToGrayscale(byte red, byte green, byte blue)
|
||||
{
|
||||
/* To avoid doubles and stuff, multiple it with a total of 65536 (16bits), then
|
||||
/* To avoid doubles and stuff, multiply it with a total of 65536 (16bits), then
|
||||
* divide by it to normalize the value to a byte again. */
|
||||
return ((red * 19595) + (green * 38470) + (blue * 7471)) / 65536;
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file hotkeys.h Hotkey related functions. */
|
||||
/** @file hotkeys.h %Hotkey related functions. */
|
||||
|
||||
#ifndef HOTKEYS_H
|
||||
#define HOTKEYS_H
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
#ifndef HOUSE_H
|
||||
#define HOUSE_H
|
||||
|
||||
#include "strings_type.h"
|
||||
#include "cargo_type.h"
|
||||
#include "economy_type.h"
|
||||
#include "date_type.h"
|
||||
#include "house_type.h"
|
||||
#include "newgrf_animation_type.h"
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#ifndef INDUSTRY_H
|
||||
#define INDUSTRY_H
|
||||
|
||||
#include "core/pool_type.hpp"
|
||||
#include "newgrf_storage.h"
|
||||
#include "subsidy_type.h"
|
||||
#include "industry_map.h"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "clear_map.h"
|
||||
#include "industry.h"
|
||||
#include "station_base.h"
|
||||
#include "train.h"
|
||||
#include "landscape.h"
|
||||
#include "viewport_func.h"
|
||||
#include "command_func.h"
|
||||
#include "town.h"
|
||||
@@ -1321,8 +1321,8 @@ static CheckNewIndustryProc * const _check_new_industry_procs[CHECK_END] = {
|
||||
* @param [out] town Pointer to return town for the new industry, \c NULL is written if no good town can be found.
|
||||
* @return Succeeded or failed command.
|
||||
*
|
||||
* @precond \c *t != NULL
|
||||
* @postcon \c *t points to a town on success, and \c NULL on failure.
|
||||
* @pre \c *t != NULL
|
||||
* @post \c *t points to a town on success, and \c NULL on failure.
|
||||
*/
|
||||
static CommandCost FindTownForIndustry(TileIndex tile, int type, Town **t)
|
||||
{
|
||||
@@ -2064,7 +2064,7 @@ void IndustryBuildData::Reset()
|
||||
void IndustryBuildData::MonthlyLoop()
|
||||
{
|
||||
static const int NEWINDS_PER_MONTH = 0x38000 / (10 * 12); // lower 16 bits is a float fraction, 3.5 industries per decade, divided by 10 * 12 months.
|
||||
if (_settings_game.difficulty.industry_density == ID_FUND_ONLY) return; // 'no industries' setting,
|
||||
if (_settings_game.difficulty.industry_density == ID_FUND_ONLY) return; // 'no industries' setting.
|
||||
|
||||
/* To prevent running out of unused industries for the player to connect,
|
||||
* add a fraction of new industries each month, but only if the manager can keep up. */
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "textbuf_gui.h"
|
||||
#include "command_func.h"
|
||||
#include "viewport_func.h"
|
||||
#include "gfx_func.h"
|
||||
#include "industry.h"
|
||||
#include "town.h"
|
||||
#include "cheat_type.h"
|
||||
@@ -40,7 +39,6 @@
|
||||
#include "widgets/industry_widget.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
|
||||
bool _ignore_restrictions;
|
||||
uint64 _displayed_industries; ///< Communication from the industry chain window to the smallmap window about what industries to display.
|
||||
@@ -1847,7 +1845,7 @@ private:
|
||||
* @param left Left-most coordinate to draw.
|
||||
* @param right Right-most coordinate to draw.
|
||||
* @param top Top coordinate of the cargo connection.
|
||||
* @csp Cargo to draw.
|
||||
* @param csp Cargo to draw.
|
||||
*/
|
||||
static void DrawHorConnection(int left, int right, int top, const CargoSpec *csp)
|
||||
{
|
||||
|
||||
+1
-3
@@ -7,17 +7,15 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file industrytype.h Industry type specs. */
|
||||
/** @file industrytype.h %Industry type specs. */
|
||||
|
||||
#ifndef INDUSTRYTYPE_H
|
||||
#define INDUSTRYTYPE_H
|
||||
|
||||
#include "economy_type.h"
|
||||
#include "map_type.h"
|
||||
#include "slope_type.h"
|
||||
#include "industry_type.h"
|
||||
#include "landscape_type.h"
|
||||
#include "strings_type.h"
|
||||
#include "cargo_type.h"
|
||||
#include "newgrf_animation_type.h"
|
||||
#include "newgrf_commons.h"
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include "animated_tile_func.h"
|
||||
#include "core/random_func.hpp"
|
||||
#include "object_base.h"
|
||||
#include "water_map.h"
|
||||
#include "economy_func.h"
|
||||
#include "company_func.h"
|
||||
#include "pathfinder/npf/aystar.h"
|
||||
#include <list>
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "core/geometry_type.hpp"
|
||||
#include "tile_cmd.h"
|
||||
#include "zoom_type.h"
|
||||
|
||||
static const uint SNOW_LINE_MONTHS = 12; ///< Number of months in the snow line table.
|
||||
static const uint SNOW_LINE_DAYS = 32; ///< Number of days in each month in the snow line table.
|
||||
|
||||
@@ -1413,7 +1413,6 @@ STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Speel a
|
||||
STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Tower stootskraper (uitwis nywerhede, onbeweegbares): {ORANGE}{STRING}
|
||||
STR_CHEAT_CROSSINGTUNNELS :{LTBLUE}Tonnels mag vir mekaar kruis: {ORANGE}{STRING}
|
||||
STR_CHEAT_NO_JETCRASH :{LTBLUE}Straalvliegtuie sal nie (dikwels) op klein lughawe bots nie: {ORANGE} {STRING}
|
||||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Skakel klimaat: {ORANGE} {STRING}
|
||||
STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE :Magtig landskap
|
||||
STR_CHEAT_SWITCH_CLIMATE_SUB_ARCTIC_LANDSCAPE :Sub-artiese landskap
|
||||
STR_CHEAT_SWITCH_CLIMATE_SUB_TROPICAL_LANDSCAPE :Sub-tropiese landskap
|
||||
@@ -2235,7 +2234,7 @@ STR_LAI_OBJECT_DESCRIPTION_COMPANY_OWNED_LAND :Maatskappy-besi
|
||||
STR_ABOUT_OPENTTD :{WHITE}Oor OpenTTD
|
||||
STR_ABOUT_ORIGINAL_COPYRIGHT :{BLACK}Oorspronklike kopiereg {COPYRIGHT} 1995 Chris Sawyer, Alle regte voorbehou
|
||||
STR_ABOUT_VERSION :{BLACK}OpenTTD uitgawe {REV}
|
||||
STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD {COPYRIGHT} 2002-2011 Die OpenTTD span
|
||||
STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD {COPYRIGHT} 2002-2012 Die OpenTTD span
|
||||
|
||||
# Save/load game/scenario
|
||||
STR_SAVELOAD_SAVE_CAPTION :{WHITE}Spaar Spel
|
||||
|
||||
@@ -1437,7 +1437,6 @@ STR_CHEAT_CHANGE_COMPANY :{LTBLUE}الع
|
||||
STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}الجرافة السحرية - لازالة المصانع و الاجسام غير القابلة للازالة.{ORANGE}{STRING}
|
||||
STR_CHEAT_CROSSINGTUNNELS :{LTBLUE}يمكن للانفاق ان تتقاطع: {ORANGE}{STRING}
|
||||
STR_CHEAT_NO_JETCRASH :{LTBLUE}الطائرات النفاثة لن تتحطم كثيرا في المطارات الصغيرة {ORANGE} {STRING}
|
||||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}بدل الطقس {ORANGE} {STRING}
|
||||
STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE :مناطق معتدلة
|
||||
STR_CHEAT_SWITCH_CLIMATE_SUB_ARCTIC_LANDSCAPE :مناطق ثلجية
|
||||
STR_CHEAT_SWITCH_CLIMATE_SUB_TROPICAL_LANDSCAPE :مناطق مدارية
|
||||
@@ -2292,7 +2291,7 @@ STR_LAI_OBJECT_DESCRIPTION_COMPANY_OWNED_LAND :ارض مملو
|
||||
STR_ABOUT_OPENTTD :{WHITE}حول النسخة المفتوحة
|
||||
STR_ABOUT_ORIGINAL_COPYRIGHT :{BLACK}الحقوق الاصلية {COPYRIGHT} كريس سوير 1995 , جميع الحقوق محفوظة
|
||||
STR_ABOUT_VERSION :{BLACK}النسخة المفتوحة رقم {REV}
|
||||
STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}النسخة المفتوحة {COPYRIGHT}2002-2011 فريق النسخة المفتوحة
|
||||
STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}النسخة المفتوحة {COPYRIGHT}2002-2012 فريق النسخة المفتوحة
|
||||
|
||||
# Save/load game/scenario
|
||||
STR_SAVELOAD_SAVE_CAPTION :{WHITE}حفظ اللعبة
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user