104 Commits

Author SHA1 Message Date
Mark de Wever
bae50a5556 Remove a not allowed typename. 2011-09-08 19:33:48 +00:00
Thonsew
9ce82aec1a Upgraded game_events.cpp...
...and files that interacted with game_events to use t_token in place
of std::string for config objects
2011-09-08 19:16:49 +00:00
Thonsew
576a3feab1 Updated parts of unit class to use t_token...
...in place of std:string in order to speed up comparisons, copies and
hashing which are 1 cycle operations.

Added z_sub t_token.

Added lru_cache unit test
2011-09-08 19:16:26 +00:00
Thonsew
2bf6377351 Changed config and vconfig to use a token representation...
...t_token in place of std::string.  t_token compares, copies, copy
constructs and hashes in 1 operation instead of proportional to the
length of the string.
2011-09-08 19:16:01 +00:00
Thonsew
3d29107eff Refactored string interpolation to use tokens to improve speed...
...once token are used in config

Added unit tests for string interpolation
2011-09-08 19:15:40 +00:00
Mark de Wever
b304723c5b Append private variables with an underscore. 2011-03-13 18:59:05 +00:00
Mark de Wever
1f2bab3930 Rethrow original exception instead of a copy.
Issue found by cppcheck.
2011-03-06 19:08:03 +00:00
Mark de Wever
ecbabea838 New year copyright update. 2011-01-01 15:57:50 +00:00
Guillaume Melquiond
f82fcc6c85 Allowed skipping over [insert_tag] children when visiting vconfig objects. 2010-12-28 15:09:06 +00:00
Ignacio R. Morelle
d6a3de1938 Apply patch #2213 by stikonas, using file #11274 2010-11-21 01:56:29 +00:00
Guillaume Melquiond
eeb047de55 Fixed file headers so that they match the content of the COPYING file. 2010-09-01 21:12:38 +00:00
Guillaume Melquiond
ae7cc0a6d2 Modified vconfig so that it is no longer forced...
...to return translatable strings after variable expansion.

In particular, the engine no longer tries to expand variables inside
plain numbers or booleans.
2010-08-19 22:07:53 +00:00
Guillaume Melquiond
ba06242145 Removed unused assignment operator for class vconfig. 2010-08-14 14:15:25 +00:00
Guillaume Melquiond
d48a63a995 Avoided copying scoped units. (Partial fix for bug #16363.)
This brings the profile footprint of variable_info from 9% to 4%.
2010-08-06 17:31:14 +00:00
Mark de Wever
a99c78e0d8 Update doxygen comment.
The filename after the @file comment is optional (spotted by alink).
2010-07-26 21:32:18 +00:00
Guillaume Melquiond
908e470543 Avoided copies. 2010-07-23 14:43:40 +00:00
Guillaume Melquiond
85a6592a1c Cleaned typing of proxy iterators a bit. 2010-07-23 14:43:28 +00:00
Guillaume Melquiond
050cd9495a Removed auto_ptr from proxy iterator. 2010-07-23 13:34:01 +00:00
Guillaume Melquiond
04a240c55e Reverted change of vconfig::child introduced by 2010-05-25T00:54:52Z!ai0867@gmail.com.
(Fix for bug #16211.)
2010-07-20 10:47:04 +00:00
Guillaume Melquiond
9aa0af7fe6 Avoided costly roundtrip through strings. 2010-06-12 18:58:02 +00:00
Alexander van Gessel
0872afac6c Factor out vconfig's tstring variable interpolation...
...to formula_string_utils and document its issues
2010-05-30 21:22:58 +01:00
Alexander van Gessel
e0f819292f Split vconfig no-arg constructor into unconstructed_vconfig() and...
...empty_vconfig(), the latter of which is backed by an empty config
object, rather than NULL.

This should eliminate segfaults due to accidental dereferencing of
the nullpointer in default-constructed vconfigs
2010-05-25 01:54:52 +01:00
Guillaume Melquiond
76c34a23d3 Modified WML attributes so that they are stored with...
...smaller effective types when they are not translatable.

This patch considerably reduces the memory footprint of WML and speeds it up.

It should not change any WML behavior, except for a few corner cases
detailled below:

- "off" is no longer a synonym for "no" (it wasn't used anyway),

- _"42" is no longer an integer,

- untranslatable "true" and "false" are stored as booleans, hence
  displayed as "yes" and "no",

- "042" is now understood as octal notation (hence 34) rather than decimal,

- hexadecimal notation "0x42" is now recognized.
2010-05-24 08:01:31 +00:00
Guillaume Melquiond
8119629789 Removed functions [v]config::all_children_iterator::get_index. 2010-04-05 06:00:00 +00:00
Guillaume Melquiond
bf148d8dd9 Switched variable_info::array_range to config::child_itors.
Fixed [set_variable/join] when separator and remove_empty attributes
are combined.
2010-04-05 05:59:53 +00:00
Guillaume Melquiond
ad3ebbba05 Removed locations from unit maps so that they are not duplicated.
As a side effect, iterators became much nicer, e.g. usable in foreach.
2010-03-28 10:42:41 +00:00
Guillaume Melquiond
bd9937e53c Renamed config::get_children...
...so that people stop adding it again and again in new places.
2010-03-27 18:49:19 +00:00
Guillaume Melquiond
8f32240573 Added accessors for the nth child of a config object. 2010-03-27 18:49:14 +00:00
Guillaume Melquiond
f451a8991b Removed usage of config::get_children. 2010-03-27 18:49:02 +00:00
Guillaume Melquiond
1896b603f1 Prevented t_string non-const references from being returned by functions.
(Original patch #1139 by Frank Richter.)

This avoids leaking an implementation detail from the config class and
opens the door to a considerable reduction of the memory footprint of
lexical data.
2010-03-27 09:32:58 +00:00
Mark de Wever
92f5f92ce5 New year copyright update. 2010-01-01 13:16:49 +00:00
Guillaume Melquiond
2ce41e58d2 Enabled warning only when dubious attributes/children are about to be created. 2009-12-24 08:22:09 +00:00
Mark de Wever
66076dd89f Pre instead of post increment a variable.
Issue found by cppcheck.
2009-11-27 22:59:52 +00:00
Gunter Labes
8565377fd7 corrected off-by-1 error in log messages 2009-07-23 21:01:18 +00:00
Guillaume Melquiond
b181364752 Cleaned code a bit. 2009-07-19 16:30:17 +00:00
Eugen Jiresch
7775ac8ad0 removed unused player_info reference 2009-07-09 09:53:16 +00:00
Eugen Jiresch
271879ba3a replaced player_info references in variable.cpp by team references 2009-07-09 09:46:31 +00:00
Tomasz Śniatowski
204c2017d0 make the code call the proper vconfig ctor
- config*,config* instead of config&,bool
2009-05-01 23:29:09 +01:00
Guillaume Melquiond
14abb2f0f4 The dependency graph of Wesnoth is plain idiotic.
As if pathfind.cpp needed to depend on font.hpp...
2009-05-01 16:14:33 +00:00
Guillaume Melquiond
789736ac91 Removed specialized domains from log.hpp,
...so that adding a new domain no longer forces to recompile the whole
game.
2009-04-24 23:18:31 +00:00
Guillaume Melquiond
55ab65ecec Removed config::all_children_iterator...
...and vconfig::all_children_iterator default constructors.
2009-04-12 14:13:46 +00:00
Patrick Parker
4ffceb57a8 fix a bug with auto-stored WML variables...
...not being restored correctly to their previous state afterwards
(spotted by silene)
2009-04-05 19:07:06 +00:00
Guillaume Melquiond
84ed1d6117 Removed almost unused and redundant functions. 2009-04-05 18:03:14 +00:00
Guillaume Melquiond
4dd3b62080 Removed config::get_children.
Note that the code does not make sense to me, hence the FIXME
comments; we are most certainly destroying WML variables there.
2009-04-05 17:05:07 +00:00
Guillaume Melquiond
60808a88ba Got rid of pointers to config objects. Removed code duplication along the way. 2009-04-04 17:51:20 +00:00
Guillaume Melquiond
3b70748b6e Moved to loops based on config::all_children_range. 2009-03-21 18:44:49 +00:00
Guillaume Melquiond
cf8325c20c Replaced field config::values by function...
...config::attribute_range which returns opaque iterators.
2009-03-20 07:08:43 +00:00
Guillaume Melquiond
75937cea1a Removed config::values. 2009-03-20 07:08:24 +00:00
Guillaume Melquiond
bee7ad1385 Modified config::child_range so that it returns opaque iterators. 2009-03-20 07:06:27 +00:00
Patrick Parker
cd378cecfa make the public memory-managed vconfig constructor a little friendlier
eliminate one vconfig pass-by-value (many more remain)
2009-02-26 01:34:22 +00:00