[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.2,1.3
From: |
Ingo Ruhnke |
Subject: |
Re: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.2,1.3 |
Date: |
12 Oct 2002 14:59:39 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
address@hidden writes:
> Index: liquid.cxx
> ===================================================================
> RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/liquid.cxx,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -d -r1.2 -r1.3
> --- liquid.cxx 27 Sep 2002 18:36:41 -0000 1.2
> +++ liquid.cxx 12 Oct 2002 00:49:10 -0000 1.3
> @@ -51,10 +51,10 @@
> void
> Liquid::on_startup ()
> {
> - CL_Surface sur = PingusResource::load_surface("Liquid/water_cmap",
> "global");
> + CL_Surface sur_ = PingusResource::load_surface("Liquid/water_cmap",
> "global");
>
> for(int i=0; i < data->width; ++i)
> - world->get_colmap()->put(sur,
> + world->get_colmap()->put(sur_,
> static_cast<int>(data->pos.x + i),
> static_cast<int>(data->pos.y),
> Groundtype::GP_WATER);
If you want to 'fix' variable shadowing, could you please give one of
the variables a meaning full name? Simply adding a '_' add the end of
the variable will only introduce new bugs, since a '_' is easily
missed, which would have not happend with a shadowed variable.
> ===================================================================
> RCS file: /usr/local/cvsroot/Games/Pingus/src/editor/editor_event.cxx,v
> retrieving revision 1.37
> retrieving revision 1.38
> diff -u -d -r1.37 -r1.38
> --- editor_event.cxx 28 Sep 2002 11:52:23 -0000 1.37
> +++ editor_event.cxx 12 Oct 2002 00:49:10 -0000 1.38
> @@ -393,7 +393,7 @@
> i != objs->end();
> ++i)
> {
> - EditorObj* obj = (*i)->duplicate ();
> + obj = (*i)->duplicate ();
> if (obj)
> {
> object_manager->add (obj);
Same here, 'recycling' a variable, which had a completly different
meaning a few lines before will not do any good, give one of them a
different name.
Removing varibable shadowing is ok, but it should result in better
readable code, not worse.
--
WWW: http://pingus.seul.org/~grumbel/
Games: http://pingus.seul.org/~grumbel/gamedesigns/
JabberID: address@hidden
ICQ: 59461927
- Re: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.2,1.3,
Ingo Ruhnke <=
- Re: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.2,1.3, David Philippi, 2002/10/12
- General Windows Cleanups, Neil Hotmail, 2002/10/12
- Re: General Windows Cleanups, David Philippi, 2002/10/12
- Re: General Windows Cleanups, Neil Hotmail, 2002/10/12
- Re: General Windows Cleanups, David Philippi, 2002/10/12
- Re: General Windows Cleanups, Neil Hotmail, 2002/10/12
- Re: General Windows Cleanups, David Philippi, 2002/10/12
Re: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs liquid.cxx,1.2,1.3, Ingo Ruhnke, 2002/10/12