388 Commits

Author SHA1 Message Date
Chris Beck
1796b4d7a0 remove unnecessary resources.hpp include from unit.hpp
It turned out that alot of compilation units were using resources
but not including the header, and only getting circuitously
through the display.hpp header which got it from unit.hpp. This
is an improvement since unit itself doesn't need the header,
and most classes probably don't either.
2014-06-14 17:17:45 -04:00
Chris Beck
22cc827d71 finish removing resources::game_map
The remaining uses are just, checking whether or not the pointer
is null, or resets to its value, or simply storing it in a local
variable.

It might be appropriate to add resources::game_map back as a
function taking no parameters, at least this is flexible
enough to be changed later easily.
2014-06-10 21:26:41 -04:00
Chris Beck
4830b8ee3c partially remove resources::game_map (part 1)
This is the result of running, in src/ directory, the following:

find . -type f -exec sed -i 's/resources::game_map->/resources::gameboard->map()./g' '{}' \;

and carefully inspecting the result, and adding "game_board.hpp"
2014-06-10 20:13:11 -04:00
Boldizsár Lipka
ac96a2b91b Move some functions to sdl/rect. 2014-06-03 10:30:12 +02:00
Chris Beck
03a956d05c Make sure all warning logs are flushed, so travis gets the results.
This is the result of running command, in src/,

find . -type f -exec sed -i 's/\(WRN.*\)\\n\"\;/\1\" << std::endl\;/g' '{}' \;

and inspecting the results.

Also ran this subsequently:

find . -type f -exec sed -i 's/\(WARN.*\)\\n\"\;/\1\" << std::endl\;/g' '{}' \;

which only affected render.cpp
2014-05-20 15:48:36 -04:00
David Mikos
6475cd1ad2 Fix bug 22020: correct help pointer for base units with variations 2014-05-18 10:42:40 +09:30
Mark de Wever
80d49c6011 Use a variable as const ref instead of const.
Issue found by cppcheck.
2014-04-12 20:48:56 +02:00
Alexander van Gessel
ea8a3bbcd9 Further reorganise unicode.hpp
Create a unicode_cast<utf8::string, ucs4::char_t> specialisation.
Move remaining functions in the utils namespace to implemenation.
2014-04-01 03:11:59 +02:00
Alexander van Gessel
6b5f357b6e Follow up the utf8 namespace with ucs4 and utf16 namespaces 2014-03-23 04:24:02 +01:00
Alexander van Gessel
b0d31d07e3 Merge branch 'wide_string_elimination'
Conflicts:
	src/dialogs.cpp
	src/gui/dialogs/addon_list.cpp
	src/gui/widgets/password_box.cpp
	src/gui/widgets/text.cpp
	src/gui/widgets/text_box.cpp
	src/marked-up_text.cpp
	src/serialization/string_utils.cpp
	src/serialization/string_utils.hpp
	src/text.cpp
2014-03-23 03:46:01 +01:00
Alexander van Gessel
6318b37ffd Get rid of utils::wide_string
utils::wide_string was a std::vector<wchar_t>
On most unix systems, this is 32 bits wide, and therefore a UCS-4 encoding.
On windows however, wchar_t is 16 bits wide, and the naive approach results
in UCS-2, which can only represent the Basic Multilingual Plane.

Most functions that used wide_string have been moved over to ucs4_string.
The Win32 API has been moved over to a specially created utf16_string instead.

Specialty tolower #ifdefs have been removed, as the towlower function has
been available since OS X 10.3, OpenBSD 3.7 and probably ancient versions of
all other BSDs too. The only issue is that on windows, the function cannot
be applied to characters outside the BMP.
2014-03-23 01:56:40 +01:00
aquileia
2f6a6a7d0e move UTF-8 functions to a separate namespace 2014-03-22 20:57:01 +01:00
Nathan Walker
efec4735ed (cosmetic) fix code tabs
Codeblocks made some of my tabs into spaces and I had to fix it.
Also, forgot to mention this before, but I cleaned up some of the code
for astarsearch.cpp as well.
2014-03-19 22:16:56 -05:00
Nathan Walker
5eee20be97 clean up instances of std::copy
In many places, std::copy was used with back_inserters, or other
std::inserters. These have in most cases been replaced by using the
ranged insert member function of each stl container. Firstly, this makes more
readable code. Also, this is often more efficient because,
if the compiler can find the distance between the source iterators,
it only has to make one block allocation and then fill it
with values. In other cases, containers were being default constructed
and then std::copy'd into with some form of inserter. These were cleaned up
by using the iterator range constructor instead.
Use of std::copy was especially egregious in the case of associative
containers such as map and set. Sometimes back_inserter was
being used, other times std::inserter set at front, but it doesn't matter
because there is no front or back when inserting, and it's much cleaner
to just use set or map::insert(iterator begin, iterator end).
2014-03-19 21:23:27 -05:00
fendrin
1814f21321 Abuse the hotkey scope system to show undiscovered units in the editor. 2014-03-01 09:01:26 +01:00
Sachith Hasaranga Seneviratne
e5193966b4 Fixed bug#21358: Dead links in help for unit variations
The ".." in the unit reference for new soulless/walking corpses was not being added by the code.

https://gna.org/bugs/index.php?21358
2014-02-15 11:56:27 +05:30
Mark de Wever
ff4c0ebb09 Pre instead of post increment a variable.
Issue found by cppcheck.
2014-02-09 10:06:30 +01:00
Ignacio R. Morelle
e150c1d56f Don't list hide_help=yes unit type variations in the help system 2014-01-08 05:09:17 -03:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
David Mikos
d874f57aaa Fix bug #21339 with help unit menu entry links 2013-12-28 15:25:09 +10:30
fendrin
4e3338f90d Enhanced the terrain symbol handling.
1) Dehardcoded the terrain symbol icon.
2) Use mix colors for mixed terrain in the minimap.
3) Show colored terrain symbol in the help browser.
4) Don't show magenta colored empty symbol for offmap locations.
2013-11-30 13:10:11 +01:00
fendrin
a28cfc3fd9 New attribute in [terrain_type] for the help topic text. 2013-11-30 10:25:12 +01:00
fendrin
ca7a220e9e Add the terrain symbol icons to the unit terrain tables. 2013-11-27 02:16:16 +01:00
fendrin
a561e1b3ed Autogenerated terrain help sections. 2013-11-16 16:27:55 +01:00
fendrin
3ccfab9a2c Show multihex range of weapons in the help browser. 2013-11-16 16:27:53 +01:00
fendrin
bddaa3ddb3 Show weapon range in the unit help browser. 2013-11-16 16:27:52 +01:00
Alexander van Gessel
5786753341 Fix faction->unit links for units with variations 2013-11-05 18:34:55 +01:00
Alexander van Gessel
7feeeb33c4 Fix advance references to units that have variations
Reported by bumbadadabum
2013-11-05 15:23:04 +01:00
Alexander van Gessel
2b61f2a897 Make all help links use make_link(), instead of rolling their own 2013-11-05 15:17:52 +01:00
fendrin
e26f4f3bc5 Don't skip the current viewed variation to avoid shuffling. 2013-10-19 15:13:24 +02:00
Mark de Wever
2ce2139564 Remove an unused const variable.
The issue was detected by the upcomming Clang 3.4.
2013-10-06 17:35:57 +02:00
gfgtdf
a14f90a6a0 msvc bugfix: renaming unit_type::HELP_INDEX to prevent naming conflicts with a marco in a windows header 2013-10-04 16:53:06 +02:00
Alexander van Gessel
3bb03f094f Merge pull request #58 from gfgtdf/master 2013-09-29 09:17:51 +02:00
fendrin
deda49a0d7 Updates to the unit help browser.
Don't display base_units and variations twice.
Fix some linking according to the new situation (sectioned parents).
2013-09-26 20:41:33 +02:00
fendrin
5aa89dcd97 Basic support for base_unit sections.
Units which are base_units for variants are now displayed as sections
with their variants as topics in the help dialog.
2013-09-26 20:41:33 +02:00
fendrin
669f2d58fe Show siblings and base units in the unit profile dialog. 2013-09-26 20:41:32 +02:00
gfgtdf
a208620cf0 added hotkeys for wml menu items, step1 (changes in game_events.cpp missing) 2013-08-31 01:43:04 +02:00
Mark de Wever
ddd84f36e6 Use a const ref variable instead of const value.
Issue found by cppcheck.
2013-07-07 11:19:38 +02:00
JaMiT
6692510e23 Rework the deprecation message for ability/special descriptions.
Most notably, the name of the ability/special is now in the message,
addressing bug #20716. Firings are also limited to once per ability/
special per game execution.
2013-06-23 19:13:57 -05:00
fendrin
fa86e2e350 Fix some wrong spelling, mostly in comments. 2013-06-23 17:18:49 +02:00
fendrin
811c4068eb Removed the map argument from the help_manager's constructor. 2013-05-06 21:19:08 +02:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
J. Tyne
96618861e6 New scheme for coloring vision costs in the help:
white for "normal" (that is, same as movement cost), yellow for
"worse" (more than movement cost), and green for "better" (less than
movement cost). This should work out better for players, as it plays
against the default of vision costs equaling movement costs.
2013-02-21 02:49:08 +00:00
J. Tyne
32468a2a1f Improve the condition for when to display vision costs in the help.
Previously, vision costs defined via movetype= were not displayed.
2013-02-21 01:39:42 +00:00
J. Tyne
5115c490ae Have unit_type::vision() return movement()...
...when vision_ is negative by default (as is done in unit::vision()).
This fixes an issue where the help would display all vision costs in
red.
2013-02-21 00:18:26 +00:00
J. Tyne
bb70a29017 Overhaul of unit_movement_type
This is a general overhaul of the class embodying movement types,
featuring:

* Better data encapsulation

* Less duplication of code between unit.cpp and unit_type.cpp

* Easier to use

* New files for the class (VC and XCode projects still need updating)

* New (shorter) name for the class

Some additional revisions will be coming.

The primary motivation for this was to get a class that embodies
movement costs (part of the data encapsulation).
2013-02-20 02:25:14 +00:00
J. Tyne
51273aceb4 Eliminate some parameters that are always *resources::game_map. 2013-02-15 02:38:42 +00:00
Fabian Müller
991a3a0878 Put a procedure from unit_helper in use to avoid duplicate code. 2013-01-15 22:24:16 +00:00
J. Tyne
119d02ecbd Improve the laziness of the lazy bulding of unit types. 2013-01-04 00:09:55 +00:00
J. Tyne
273b2ccc62 Make unit_type_data::build_unit_type() public,
...and update various parts of the code to call it (instead of using
unit_type_data::find() to "find" a known unit_type).

There was one call in the editor's code where I am unsure if there are
supposed to be side effects other than building the unit_type. So I
left the code as-is and just added a comment for someone else to
evaluate later.
2013-01-03 23:29:45 +00:00