The fact that client.mouse_pointer_icon does not take an icon_state as argument is kind of defeating my attempts of keeping the code object-oriented and yet not loosing out on performance.
Consider the idea of having several players, with several different units. Each player should have a unique colour for her "army".
Now while I could simply use icon_state = "[player.colour][unit.type]" to handle giving the unit an icon and thus could set the definition at a common node for all units, I can not do the same for icon = '[p.c][u.t].dmi'.
The only way I could think of would be to create a new icon on the fly, like var/icon/I = new('units.dmi',icon_state = "[p.c][u.t]"). The reference speaks of "quite a bit of overhead" here though.
Any ideas would be welcome!
Thank you in advance.
ID:159518
Feb 24 2009, 5:25 am
|
|
Feb 24 2009, 12:48 pm
|
|
|
In response to ACWraith
|
|
ACWraith wrote:
Give each unit a proc that takes a color and returns and icon. This is the very point I wanted to avoid by making use of inheritance. With 20 units and 5 players, that would make more than 100 lines of code already, compared to a single line. |
In response to Schnitzelnagler
|
|
You can use the same proc. Just refer to a different list of icons ordered by color.
|