add operators ==,!= (attribute_value, std::string)
previously comparisions like c["a"] = "b" were evaluated by
inline bool operator==(const std::string &a, const t_string &b)
by casting atribute_value to std::string, and const char * to t_string
we fix this by adding explicit equality operator for these cases.
Not creating t_string also results in significant preformance improvements in some cases.
The functionality of tracking observers and displaying chat messages
is moved to a manager class, which the gui owns.
The functionality of displaying notifications is similarly moved out
of the game_display and to a private namespace. (Static singleton
pattern seems okay here since there really won't need to be more
than one of these for a single application, it seems.)
since we don't use t_string's == operator anymore in this case, c["a"]
!= "" will evaluate to true in case of "a" beeing not existent. To get
the desired behaviour we need to use the .empty() method.
I also add an assert in map_generation for a possible segfault that i
noticed during fixing this.
There was a subtle flaw introduced by using safebool in halo_record,
but defining the handle as a pointer to this -- the pointer also
is castable to bool so it makes mistakes very easy. We replace the
safe bool stuff with a function "valid" of halo_record, and fixup
the places that were supposed to be using this test.
Also move the NO_HALO variable back to the header.
fixes up commit 82c6b98907d9709aef0d23a3846c1e75ac48e1d5
fixes up commit 82c6b98907d9709aef0d23a3846c1e75ac48e1d5
Use smart "handles" for halos which have been added to a halo
manager. The handles remember what manager they came from, and
delete themselves automatically on destruction.
This wasn't an issue when haloes were basically managed by a
C library, but if we want to get rid of the static singleton
system, the handles need to be smarter than just int's.
Fixes the build with the fuh enabled on clang 3.3:
> src/server/forum_user_handler.cpp:206:10: error: expression which evaluates to zero treated as a null pointer constant of type 'const char *' [-Werror,-Wnon-literal-null-conversion]
> return time_t(0);
> ^~~~~~~~~
> src/server/forum_user_handler.cpp:215:10: error: expression which evaluates to zero treated as a null pointer constant of type 'const char *' [-Werror,-Wnon-literal-null-conversion]
> return time_t(0);
> ^~~~~~~~~
A time_t(0) is cast equivalently to a null pointer, and an empty C
string is equivalent to a null pointer for std::string instantiation.
These attributes work similarly as all other lock attributes such as
'gold_lock': 'faction_lock' locks faction selection, while 'leader_lock' locks
both leader and its gender selections.
These attributes were added to fix#21978.
Dialogue changed to have proper English formatting. Eradion death
message fixed to remove potential of an enemy side expressing concern
over his death.
The changes in config required changes in ai/contexts which
cascaded, also many places were throwing game::game_error without
including its definition except from config.