#include <thing.h>#include <moving.h>#include <defines.h>#include "../files.h"
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | NEED_PROTOTYPES |
| #define | STD_WACHSTUM 7200 |
| #define | BS(x) break_string(x, 78) |
Funktionen | |
| void | AddDetail (mixed *keys, mixed descr) |
| varargs int | AddPlant (string filename, string npcId) |
| string | AddPlantDetail (string filename) |
| int | CheckPlant (string filename) |
| object | GetPlant (string filename) |
| static int | _pfluecken (string str) |
Variablen | |
| mapping | plantMap |
| static int _pfluecken | ( | string | str | ) | [static] |
Definiert in Zeile 105 der Datei proom.c.
00106 { 00107 int i, res; 00108 string *keys; 00109 mixed ids, adj; 00110 object ob; 00111 00112 if (!mappingp(plantMap)) return 0; 00113 _notify_fail("WAS moechtest Du pfluecken?\n"); 00114 ids=Query(P_IDS); 00115 adj=Query(P_ADJECTIVES); 00116 for (i=sizeof(keys=m_indices(plantMap))-1; i>=0; i--) { 00117 if (sizeof(plantMap[keys[i]])!=6) continue; 00118 Set(P_IDS, plantMap[keys[i]][2]); 00119 Set(P_ADJECTIVES, plantMap[keys[i]][3]); 00120 if (!catch(res=id(str)) && res) { 00121 if (stringp(str=plantMap[keys[i]][5]) && 00122 objectp(ob=present(str, ME))) { 00123 write(BS(ob->Name(WER, 2) 00124 +" laesst Dich leider nicht nah genug heran. Irgendwie" 00125 +" musst Du Dich wohl zunaechst um " 00126 +ob->QueryPronoun(WEN)+" kuemmern.")); 00127 } 00128 else if (objectp(ob=GetPlant(keys[i]))) { 00129 if (ob->move(PL, M_GET)==1) 00130 write(BS("Vorsichtig pflueckst Du "+ob->name(WEN, 1) 00131 +" und nimmst "+ob->QueryPronoun(WEN)+" an Dich.")); 00132 else { 00133 write(BS("Vorsichtig pflueckst Du "+ob->name(WEN, 1)+" kannst " 00134 +ob->QueryPronoun(WEN)+" aber nicht nehmen.")); 00135 ob->move(environment(PL), M_SILENT|M_NOCHECK); 00136 } 00137 } 00138 else write(BS(plantMap[keys[i]][4]+" ist noch nicht reif genug " 00139 +"und muss erst noch etwas wachsen.")); 00140 break; 00141 } 00142 } 00143 Set(P_IDS, ids); 00144 Set(P_ADJECTIVES, adj); 00145 return (i>=0); 00146 }
| void AddDetail | ( | mixed * | keys, | |
| mixed | descr | |||
| ) |
| varargs int AddPlant | ( | string | filename, | |
| string | npcId | |||
| ) |
Definiert in Zeile 19 der Datei proom.c.
Benutzt gender, i, ids, ob(), P_ADJECTIVES, P_GENDER, P_IDS, P_NAME_ADJ, plantMap, Query(), Set() und WER.
00020 { 00021 int i,j,gender; 00022 object ob; 00023 string *ids, *adj, *det; 00024 mixed arr; 00025 00026 if (!stringp(filename)) return -1; 00027 call_other(filename, "???"); 00028 ob=find_object(filename); 00029 if (!objectp(ob)) raise_error("AddPlant(): Can't load "+filename+".\n"); 00030 if (!mappingp(plantMap)) plantMap=([]); 00031 if (pointerp(arr=plantMap[filename]) && sizeof(arr)>2) 00032 raise_error("AddPlant(): "+filename+" already exists.\n"); 00033 ids=ob->Query(P_IDS)-({ "Ding" }); 00034 adj=ob->Query(P_ADJECTIVES); 00035 if (!pointerp(arr) || sizeof(arr)<2) arr=({0,0}); 00036 plantMap[filename]=({arr[0], arr[1], ids, adj, ob->Name(WER, 1), npcId }); 00037 det=({}); 00038 adj=ob->QueryProp(P_NAME_ADJ); 00039 gender=Query(P_GENDER); 00040 Set(P_GENDER, ob->Query(P_GENDER)); 00041 adj=map(adj, #'DeclAdj, WEN, 0); 00042 for (i=sizeof(ids)-1; i>=0; i--) { 00043 for (j=sizeof(adj)-1; j>=0; j--) det+=({ adj[j]+ids[i] }); 00044 } 00045 det+=ids; 00046 det-=m_indices(Query(P_DETAILS)||([])); 00047 if (sizeof(det)) AddDetail(det, ob->Query(PLANT_ROOMDETAIL)); 00048 AddCmd(({"pflueck", "pfluecke"}), "_pfluecken"); 00049 }

| string AddPlantDetail | ( | string | filename | ) |
Definiert in Zeile 53 der Datei proom.c.
00054 { 00055 int i,j,gender; 00056 object ob; 00057 string *ids, *det, *adj; 00058 call_other(filename, "???"); 00059 ob=find_object(filename); 00060 if (!objectp(ob)) raise_error("AddPlantDetail(): Can't load "+filename+".\n"); 00061 det=({}); 00062 ids=ob->Query(P_IDS)-({ "Ding" }); 00063 adj=ob->QueryProp(P_NAME_ADJ); 00064 gender=Query(P_GENDER); 00065 Set(P_GENDER, ob->Query(P_GENDER)); 00066 adj=map(adj, #'DeclAdj, WEN, 0); 00067 for (i=sizeof(ids)-1; i>=0; i--) { 00068 for (j=sizeof(adj)-1; j>=0; j--) det+=({ adj[j]+ids[i] }); 00069 } 00070 AddDetail(det+ids, ob->Query(PLANT_ROOMDETAIL)); 00071 Set(P_GENDER, gender); 00072 }
| int CheckPlant | ( | string | filename | ) |
| object GetPlant | ( | string | filename | ) |
Definiert in Zeile 90 der Datei proom.c.
00091 { 00092 mixed arr; 00093 if (!mappingp(plantMap)) plantMap=([]); 00094 if (!pointerp(arr=plantMap[filename]) || sizeof(arr)<2) { 00095 arr=plantMap[filename]=({ 0, 0 }); 00096 } 00097 if (time()<arr[0]) return 0; // noch nicht nachgewachsen 00098 arr[1]-=time(); 00099 arr[1]=(arr[1]<=0 ? STD_WACHSTUM : (arr[1]<<1)+STD_WACHSTUM); 00100 arr[0]=time()+(arr[1]>>1); // Resetzeit 00101 arr[1]+=time(); // Zeit voelliger Regeneration 00102 return clone_object(filename); 00103 }
| mapping plantMap |
Definiert in Zeile 11 der Datei proom.c.
Wird benutzt von AddPlant().
1.6.3