diff --git a/src/unit/depend.cpp b/src/unit/depend.cpp index 72e061732..30aeb7043 100644 --- a/src/unit/depend.cpp +++ b/src/unit/depend.cpp @@ -153,7 +153,7 @@ global void AddDependency(const char* target,const char* required,int count } /** -** Check if this upgrade or unit is availalbe. +** Check if this upgrade or unit is available. ** ** @param player For this player available. ** @param target Unit or Upgrade. diff --git a/src/unit/upgrade.cpp b/src/unit/upgrade.cpp index 30b33ea69..ea418a0b8 100644 --- a/src/unit/upgrade.cpp +++ b/src/unit/upgrade.cpp @@ -1408,30 +1408,42 @@ global void UpgradeLost( Player* player, int id ) // all the following functions are just map handlers, no specific notes /** -** FIXME: docu +** Change allow for an unit-type. +** +** @param player Player to change +** @param id unit type id +** @param af `A'llow/`F'orbid/`R'eseached */ -global void AllowUnitId( Player* player, int id, char af ) // id -- unit type id, af -- `A'llow/`F'orbid +global void AllowUnitId(Player* player, int id, char af) { - DebugCheck(!( af == 'A' || af == 'F' )); - player->Allow.Units[id] = af; + DebugCheck(!(af == 'A' || af == 'F' || af == 'R' )); + player->Allow.Units[id] = af; +} + +/** +** Change allow for an upgrade. +** +** @param player Player to change +** @param id upgrade id +** @param af `A'llow/`F'orbid/`R'eseached +*/ +global void AllowUpgradeId(Player* player, int id, char af) +{ + DebugCheck(!(af == 'A' || af == 'F' || af == 'R')); + player->Allow.Upgrades[id] = af; } /** ** FIXME: docu */ -global void AllowUpgradeId( Player* player, int id, char af ) +global char UnitIdAllowed(const Player* player, int id) { - DebugCheck(!( af == 'A' || af == 'F' || af == 'R' )); - player->Allow.Upgrades[id] = af; -} - -/** -** FIXME: docu -*/ -global char UnitIdAllowed(const Player* player, int id ) -{ - if ( id < 0 || id >= UpgradeMax ) return 'F'; - return player->Allow.Units[id]; + // JOHNS: Don't be kind, the people should code correct! + DebugCheck( id < 0 || id >= UpgradeMax ); + if (id < 0 || id >= UpgradeMax) { + return 'F'; + } + return player->Allow.Units[id]; } /**