If you want to, I was hoping to get this merged into the main project. There's not really a whole lot of actual code changes required to get it to work. Just like 3 or 4 minor commits addressing iterators, locality, and a couple other small things (Well, this is if you ignore the commits about warnings. I hate warnings. I can always ease back the warning options in the IDE though. :P)
{
it = can_be(useful);
}
void EventSupervisor::Update()
{
...
if(it->first <= 0) { // Timer has expired
MapEvent *start_event = it->second;
it = _active_delayed_events.erase(it);
// We begin the event only after it has been removed from the launch list
StartEvent(start_event);
}
...
}
void EventSupervisor::_ExamineEventLinks(MapEvent *parent_event, bool event_start)
{
...
// Case 3: The child event has a timer associated with it and needs to be placed in the event launch container
else {
MapEvent *child = GetEvent(link.child_event_id);
if(child == NULL) {
IF_PRINT_WARNING(MAP_DEBUG) << "can not launch child event, no event with this ID existed: "
<< link.child_event_id << std::endl;
continue;
} else {
_active_delayed_events.push_back(std::make_pair(static_cast<int32>(link.launch_timer), child));
}
}
...
}
it = _active_delayed_events.erase(it);
// We begin the event only after it has been removed from the launch list
StartEvent(start_event);
it = _active_delayed_events.erase(it);
it = StartEvent(it);
// will store the events that became active in the delayed event loop.
std::vector<MapEvent *> events_to_start;
// Update all launch event timers and start all events whose timers have finished
for(std::vector<std::pair<int32, MapEvent *> >::iterator it = _active_delayed_events.begin();
it != _active_delayed_events.end();) {
it->first -= SystemManager->GetUpdateTime();
if(it->first <= 0) { // Timer has expired
MapEvent *start_event = it->second;
it = _active_delayed_events.erase(it);
// We add the event ready to start in a vector, waiting for the loop to end
// before actually starting it.
events_to_start.push_back(start_event);
} else {
++it;
}
}
// Starts the events that became active.
for(std::vector<MapEvent *>::iterator it = events_to_start.begin(); it != events_to_start.end(); ++it) {
StartEvent(*it);
}
void SystemEngine::SetLanguage(const std::string& lang)
{
Reinitl10n();
_language = lang;
setlocale(LC_MESSAGES, _language.c_str());
setlocale(LC_ALL, "");
#ifdef _WIN32
std::string lang_var = "LANGUAGE=" + _language;
putenv(lang_var.c_str());
SetEnvironmentVariable("LANGUAGE", _language.c_str());
SetEnvironmentVariable("LANG", _language.c_str());
#else
setenv("LANGUAGE", _language.c_str(), 1);
setenv("LANG", _language.c_str(), 1);
#endif
}
setlocale(LC_MESSAGES, _language.c_str());
/* Locale categories */
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5
#define LC_MIN LC_ALL
#define LC_MAX LC_TIME
void SystemEngine::SetLanguage(const std::string& lang)
{
Reinitl10n();
_language = lang;
#ifdef _WIN32
setlocale(LC_ALL, "");
std::string lang_var = "LANGUAGE=" + _language;
putenv(lang_var.c_str());
SetEnvironmentVariable("LANGUAGE", _language.c_str());
SetEnvironmentVariable("LANG", _language.c_str());
#else
setlocale(LC_MESSAGES, _language.c_str());
setlocale(LC_ALL, "");
setenv("LANGUAGE", _language.c_str(), 1);
setenv("LANG", _language.c_str(), 1);
#endif
}
// define the LC_MESSAGES if it isn't already done
#ifndef LC_MESSAGES
#define LC_MESSAGES LC_ALL
#endif
#include <locale.h>
/* The LC_MESSAGES locale category is the category used by the functions
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
On systems that don't define it, use an arbitrary value instead.
On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
then includes <libintl.h> (i.e. this file!) and then only defines
LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
in this case. */
#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
# define LC_MESSAGES 1729
#endif
# define LC_MESSAGES LC_ALL
_weapon_animations[char_id].insert(std::make_pair<std::string, std::string>(anim_alias, anim_file));
frames_offsets.push_back(std::make_pair<float, float>(x_offset, y_offset));
_weapon_animations[char_id].insert(std::make_pair(anim_alias, anim_file));
frames_offsets.push_back(std::make_pair(x_offset, y_offset));
Now, I have no idea why it's 1729. Maybe I configured the library incorrectly when I built it?
Now, I've never tested this, but g++ might require similar adjustments if you configured it to compile with the new C++11 features flag.
Now, don't get me wrong, I agree with you on the compatibility with features. I am not going sit and argue about adopting lambda functions or whatever else. At the end of the day, it just doesn't really matter. There's no real need.
Bertram {l Wrote}:How did you get to know about Valyria Tear, btw?
Bertram {l Wrote}:Also, what is left? Do you want to merge the vs project files? Is it possible to do that in a folder? (Alla XCode)?
I still need to fix up some things related to lua before I would recommend merging it in. This was the first time I've ever integrated lua and luabind into a C++ project. Originally, I was getting a lot of run time warnings related to both luabind and lua. I went back and reconfigured and rebuilt luabind to fix it. I still need to do the same thing for the lua library itself.
It's not a huge problem. It still works correctly. However, it's really annoying. It spams the console window way too much.
Users browsing this forum: No registered users and 1 guest