From 9f2cb366695f8327f55fee0b0a7313f4d911ce98 Mon Sep 17 00:00:00 2001
From: mr-russ <>
Date: Sun, 31 Aug 2003 09:47:01 +0000
Subject: [PATCH] Added Income improvements to ccl, removed hard coded versions
---
doc/ChangeLog.html | 1 +
doc/scripts/unittype.html | 20 ++++++++++++--------
src/unit/script_unittype.cpp | 10 ++++++++++
src/unit/unittype.cpp | 35 -----------------------------------
4 files changed, 23 insertions(+), 43 deletions(-)
diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html
index 6d644e417..f84016782 100644
--- a/doc/ChangeLog.html
+++ b/doc/ChangeLog.html
@@ -36,6 +36,7 @@
Future 1.19 Release
- ++
+
- Added Income improvements to ccl, removed hard coded versions (from Russell Smith).
- Fixed Pathfinder cost bug, which stopped units from moving (from Russell Smith).
- Fixed Pathfinder bug and cleaned up vision table management (from Russell Smith).
- Added Circular Goal support, Major vision and pathfinding changes (from Russell Smith).
diff --git a/doc/scripts/unittype.html b/doc/scripts/unittype.html
index cd43c8acd..a4a8958aa 100644
--- a/doc/scripts/unittype.html
+++ b/doc/scripts/unittype.html
@@ -197,8 +197,8 @@ Define unit stats.
Syntax
(define-unit-type ident name graphics pixel_size animations icon
- speed overlay sight_range hitpoints magic costs tile_size box_size
- attack_range computer_reaction_range human_reaction_range armor
+ speed overlay sight_range hitpoints magic costs improve_production tile_size
+ box_size attack_range computer_reaction_range human_reaction_range armor
priorty damage piercing_damge weapon_upgradable armor_upgradeable
decay annoy_factor points missle corpse type right_mouse can_target
flags sounds attack_sound)
@@ -271,14 +271,18 @@ NOTE: this will be changed to identifiers sometime.
- Flag to determine whether this unit is a spell user. 0 = false (not a magic
user), 1 = true (magic user). F.E. 1, 0
- costs
-- Define the costs to build (or aquire) this unit. It is an array of #(
-time gold wood oil) or #(time gold wood oil ore stone coal). Time is in frames
-to build this unit.
+
- Define the costs to build (or aquire) this unit. It is an array of '(
+resource-name amount) pairs. Time is in frames to build this unit.
Gold is the amount required to build this unit. Wood is the amount required
to build this unit. Oil is the amount required to build this unit.
-F.E.: #( 200 2000 1000 200 ).
-NOTE: This is extendable more costs could be added. (using 6 resources insteed
-of 3. Or redefining the gold resource into a crytal resource)
+F.E.: '( time 200 gold 2000 wood 1000 oil 200 ).
+
+ - improve_production
+- Define the production increase from defaults that this unit adds. It is an array of '(
+rosource-name amount) pairs.
+Gold is the amount it increase the default gold by. All other defined resources are
+treated the same way.
+F.E.: 'improve-production '( gold 20 wood 5 ).
- tile_size
- Define the unit-type size in tiles. NOTE: currently only buildings could
diff --git a/src/unit/script_unittype.cpp b/src/unit/script_unittype.cpp
index c67833a3f..ffbe6b026 100644
--- a/src/unit/script_unittype.cpp
+++ b/src/unit/script_unittype.cpp
@@ -223,6 +223,16 @@ local SCM CclDefineUnitType(SCM list)
type->_Costs[CclGetResourceByName(value)]=gh_scm2int(gh_car(sublist));
sublist=gh_cdr(sublist);
}
+ } else if( gh_eq_p(value,gh_symbol2scm("improve-production")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ while( !gh_null_p(sublist) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ type->ImproveIncomes[CclGetResourceByName(value)]=
+ DefaultIncomes[CclGetResourceByName(value)]+gh_scm2int(gh_car(sublist));
+ sublist=gh_cdr(sublist);
+ }
} else if( gh_eq_p(value,gh_symbol2scm("construction")) ) {
// FIXME: What if constructions arn't yet loaded?
str=gh_scm2newstr(gh_car(list),NULL);
diff --git a/src/unit/unittype.cpp b/src/unit/unittype.cpp
index d9c55ab7d..88511e488 100644
--- a/src/unit/unittype.cpp
+++ b/src/unit/unittype.cpp
@@ -1188,41 +1188,6 @@ global void InitUnitTypes(int reset_player_stats)
//
*(UnitType**)hash_add(UnitTypeHash,UnitTypes[type]->Ident)
=UnitTypes[type];
- //
- // Hardcoded incomes, FIXME: should be moved to some configs.
- //
- if( !strcmp(UnitTypes[type]->Ident,"unit-elven-lumber-mill") ) {
- UnitTypes[type]->ImproveIncomes[WoodCost]=
- DefaultIncomes[WoodCost]+25;
- }
- if( !strcmp(UnitTypes[type]->Ident,"unit-troll-lumber-mill") ) {
- UnitTypes[type]->ImproveIncomes[WoodCost]=
- DefaultIncomes[WoodCost]+25;
- }
- if( !strcmp(UnitTypes[type]->Ident,"unit-human-refinery") ) {
- UnitTypes[type]->ImproveIncomes[OilCost]=
- DefaultIncomes[OilCost]+25;
- }
- if( !strcmp(UnitTypes[type]->Ident,"unit-orc-refinery") ) {
- UnitTypes[type]->ImproveIncomes[OilCost]=
- DefaultIncomes[OilCost]+25;
- }
- if( !strcmp(UnitTypes[type]->Ident,"unit-keep") ) {
- UnitTypes[type]->ImproveIncomes[GoldCost]=
- DefaultIncomes[GoldCost]+10;
- }
- if( !strcmp(UnitTypes[type]->Ident,"unit-stronghold") ) {
- UnitTypes[type]->ImproveIncomes[GoldCost]=
- DefaultIncomes[GoldCost]+10;
- }
- if( !strcmp(UnitTypes[type]->Ident,"unit-castle") ) {
- UnitTypes[type]->ImproveIncomes[GoldCost]=
- DefaultIncomes[GoldCost]+20;
- }
- if( !strcmp(UnitTypes[type]->Ident,"unit-fortress") ) {
- UnitTypes[type]->ImproveIncomes[GoldCost]=
- DefaultIncomes[GoldCost]+20;
- }
}
// LUDO : called after game is loaded -> don't reset stats !