On Thu, 2006-04-06 at 23:34 +0200, Jörg Hinrichs wrote:
> Hi,
>
> during my refactoring i changed a _lot_ of things, especially for
> playlevel.cpp and playturn.cpp.
Hi Jörg,
I did notice a couple of things while cutting down gcc-4.0 warnings in
this code:
(1) play_controller initializer doesn't initialize everything? I can't
see where teams_ is initialized, even though other things are
initialized using it, which seems really odd. Also, the destructor
deletes pointers which are not initialized.
(2) Code like this keeps appearing in the tree:
first_player_ = atoi(level_["playing_team"].c_str());
if(first_player_ < 0 || first_player_ >= int(teams_.size())) {
first_player_ = 0;
}
This casts an unsigned (size()) to an int to avoid a warning, but it's
pretty obvious that first_player is always an unsigned value, and should
be declared as such. IMHO sizes, lengths, indexes and counts should be
unsigned unless -1 really is needed as a special flag value.
(I realize this code is probably not yours but pasted from previous, but
it gave me a chance to talk about this issue 8).
Thanks!
Rusty.
PS. I like your changes; cleaning this up is really nice. Thanks!
--
ccontrol: http://ozlabs.org/~rusty/ccontrol
_______________________________________________
Wesnoth-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-dev