chore: add 3.4.3
chore: add 3.4.4 chore: add 3.4.5 chore: add 3.4.5.1 chore: add 3.4.6.1 chore: add 3.4.6.2 chore: add 3.4.6.3 chore: add 3.4.6.4 chore: add 3.4.6.5
This commit is contained in:
@@ -100,7 +100,7 @@ for (obj = objs; obj < objs + 5; obj++)
|
||||
|
||||
但是,对象通常具有同样有效的其他特征:
|
||||
|
||||
- <strong>Locations: 通过</strong><strong>道路</strong><strong>连接(将在后面介绍)。如果一个物体无法通过一条通道到达,那么它就不是一个位置。就是这么简单。</strong>
|
||||
- <strong>Locations:通过</strong><strong>道路</strong><strong>连接(将在后面介绍)。如果一个物体无法通过一条通道到达,那么它就不是一个位置。就是这么简单。</strong>
|
||||
- <strong>Items:玩家唯一可以捡起的物品;</strong><strong>可以给他们整一个重量的属性</strong>
|
||||
- <strong>Actors:玩家唯一可以与之交谈,交易,战斗的对象;当然,前提是他们还活着!</strong><strong>可以加一个 HP 属性</strong>
|
||||
|
||||
@@ -122,7 +122,7 @@ player->location->description
|
||||
|
||||
是时候把它们放在一起了。我们从对象数组的全新模块开始
|
||||
|
||||
# Object.h
|
||||
## Object.h
|
||||
|
||||
```c
|
||||
typedef struct object {
|
||||
@@ -143,7 +143,7 @@ extern OBJECT objs[];
|
||||
#define endOfObjs (objs + 6)
|
||||
```
|
||||
|
||||
# Object.c
|
||||
## Object.c
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
@@ -163,15 +163,15 @@ OBJECT objs[] = {
|
||||
|
||||
以下模块将帮助我们找到与指定名词匹配的对象。
|
||||
|
||||
# noun.h
|
||||
## noun.h
|
||||
|
||||
```c
|
||||
extern OBJECT *getVisible(const char *intention, const char *noun);
|
||||
```
|
||||
|
||||
# 指针?函数?希望你已经掌握这是什么了
|
||||
## 指针?函数?希望你已经掌握这是什么了
|
||||
|
||||
# noun.c
|
||||
## noun.c
|
||||
|
||||
```c
|
||||
#include <stdbool.h>
|
||||
@@ -229,13 +229,13 @@ OBJECT *getVisible(const char *intention, const char *noun)
|
||||
|
||||
这是另一个辅助程序的函数。它打印存在于特定位置的对象(物品,NPC)的列表。它将用于函数 <em>executeLook</em>,在下一章中,我们将介绍另一个需要它的命令。
|
||||
|
||||
# misc.h
|
||||
## misc.h
|
||||
|
||||
```c
|
||||
extern int listObjectsAtLocation(OBJECT *location);
|
||||
```
|
||||
|
||||
# misc.c
|
||||
## misc.c
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
@@ -251,7 +251,7 @@ int listObjectsAtLocation(OBJECT *location)
|
||||
//排除玩家在玩家的位置这种蠢东西
|
||||
{
|
||||
if (count++ == 0)
|
||||
//我们需要保证找到一个东西之前他不会打印you see
|
||||
//我们需要保证找到一个东西之前他不会打印 you see
|
||||
{
|
||||
printf("You see:\n");
|
||||
}
|
||||
@@ -265,14 +265,14 @@ int listObjectsAtLocation(OBJECT *location)
|
||||
|
||||
在 <em>location.c</em> 中,命令环<em>顾四周的实现</em>,并根据新的数据结构进行调整。旧的位置数组被删除,变量 <em>locationOfPlayer</em> 也是如此。
|
||||
|
||||
# location.h
|
||||
## location.h
|
||||
|
||||
```c
|
||||
extern void executeLook(const char *noun);
|
||||
extern void executeGo(const char *noun);
|
||||
```
|
||||
|
||||
# location.c
|
||||
## location.c
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
|
||||
Reference in New Issue
Block a user